Category Archives: Uncategorized

Generalizing a problem can make the solution simpler or more complicated, and it’s often hard to predict which beforehand. Here’s a mini-example of a puzzle and four generalizations which alternately make it simpler or more complicated.Continue reading →

There is a class of all cardinalities , and it
has elements , and operations , , and so forth defined on it. Furthermore, there is a map which takes
sets to cardinalities such that (and so on).

Ordinary generating functions can be thought of entirely analogously
with set maps replacing sets:
There is a class with elements ,, and operations , . Furthermore,
there is a (partial) map such that (and so on). Here, is defined by . Other operations on set maps (like disjoint union) are similarly defined pointwise.

(This is probably obvious and trivial to anyone who actually works
with generating functions, but it only occurred to me recently, so I
thought I’d write a blog post about it.)

The class is in fact a set, and is just the set of formal power series . The partial map takes to just in case is “canonically isomorphic” (a notion I’ll leave slippery and undefined but that can be made precise) to the map , where indicates disjoint union.

That provides a semantics for ordinary generating functions. Furthermore, this semantics has a number of features beyond those of cardinality. For example, in addition to respecting and , represents composition.

A similar semantics can be provided for exponential generating functions, but it takes a little more work. In particular, we have to single out as a distinguished set. Let be the smallest set containing all measurable subsets of for any finite and which is closed under finite products, countable disjoint unions, and products with sets for finite .

We can define the measure of all sets in by extending Lebesgue measure in the obvious way (taking the product of a set with will multiply the measure by ). Furthermore, notice that, by construction, every element of every set in is a tuple which (after flattening) has all of its elements either natural numbers or elements of and has at least one element of . Therefore, we can define a pre-ordering on by comparing the corresponding first elements that are in .

The point of all that is that, for , we can form the set which will again be in and its measure will be . The corresponding statement with cardinality is not true since you have to worry about the case when elements in the tuple are equal () but the set of tuples that have duplicates has measure 0, so by working with measure, we can get the equality we want.

Finally, let be the set of formal power series . The partial map takes to just in case is “canonically isomorphic” to the map for all in . Just as before, this map respects , , composition, etc.

Note that the exponential generating functions are usually explained via labeled objects and some sort of relabeling operation. This approach weasels out of that by observing that the event that there was a label collision has probability 0, so you can just ignore it.

In 1931, Alfred Tarski proved that the real ordered field allows quantifier elimination: i.e., every first-order formula is equivalent to one with no quantifiers. This is implemented in Mathematica’s “Resolve” function.

The Resolve function is called like Resolve[formula,domain] where domain gives the domain for the quantifiers in formula. Since we’ll always be working over in this blog post, let’s set that to be the default at the start.

(A couple of caveats first though: First, many of these algorithms are extremely inefficient. Second, I had some trouble exporting the Mathematica notebook, so I basically just copy-and-pasted the text. Apologies if it’s unreadable.)

How many solutions?

Let’s start with just existential formulas. By eliminating quantifiers from , we can tell what the conditions are on a such that there’s at least one solution . For example:

Now suppose we wanted to find when something has at least two solutions. Just like resolving told us when there was at least one, will be true exactly when there are at least two.

This is just as easy to program as atLeastOneSolution was, except that when we create the variables and we have to be careful to avoid capture (what if one of those two already appeared in ?). Mathematica provides a function called Unique where if you call Unique[], you’re guaranteed to get back a variable that’s never been used before. With that we can define atLeastTwoSolutions correctly (edit: actually, this isn’t right if the passed-in variable is also bound in the passed-in formula):

Note that (and I believe Resolve always does this) the condition given first is sufficient that the later square root is well-defined:In[8]:= Resolve[ForAll[{b, c}, c < b^2/3 ⇒ b^6 - 9 b^4 c + 27 b^2 c^2 - 27 c^3 > 0]]
Out[8]= True
It’s clear that we can determine when there at least n solutions by a very similar trick: just resolve .

We’ll first write a helper function to produce the conjunction of inequalities we’ll need:

This last calculation shows that a quadratic has exactly one solution exactly when the discriminant is both nonnegative and nonpositive (as you can see, there is no guarantee that the formula will be in it’s simplest form).
We now have a way to test whether a formula with one free variable has solutions for specific values of , since exactlyNSolutions will return either True or False if you quantify out the only variable. For example:

It would be nice, however, to have a function which will just tell you how many solutions such a formula has.

In the single-variable polynomial case, we could just try exactlyNSolutions for until we find the right . However, there might not be finitely many solutions if the formula involves inequalities or higher-dimension polynomials (e.g., has infinitely many solutions).

How can we tell if a formula has infinitely many solutions? Well, the fact that has quantifier elimination implies that for with just free must be a finite union of points and open intervals (since the only quantifier free terms are and . Therefore is infinite iff it contains a non-empty open interval, i.e., iff .

Up to now, all our functions have taken single variables, but we can accomodate tuples of variables as well. First, we’ll define the analogue of noneEqual to produce the formula asserting that none of the given tuples are equal (recall that two tuples are unequal iff a pair of corresponding components is unequal):

(There are actually four solutions. This example of a set equations for which it’s difficult to tell how many solutions there are by graphing is from Stan Wagon)

Solving Polynomial Equations

In the last section, we saw how to use quantifier elimination to find out how many roots there are. But how can you actually find the roots?

In a certain sense, you’ve already found them just when you identified how many there are! To “find” a root in this sense, you just introduce a new symbol for it, and have some means for answering questions about its properties. Given some property , if you want to determine if it holds of the 6th root of some polynomial with 17 roots, then you just have to decide .

We can implement this by a function withSpecificRoot, that takes a variable, the formula it’s supposed to be a solution to, which of the roots it’s a solution to, and a formula in which you want to use this root:

Edit: These ideas are also discussed here and here (thanks to Qiaochu Yuan: I found out about those links by him linking back to this post).

Although topology is usually motivated as a study of spatial structures, you can interpret topological spaces as being a particular type of logic, and give a purely logical, non-spatial interpretation to a number of bits of topology.

This seems like one of those facts that was obvious to everyone else already, but I’ll write a quick blog post about it anyway.Continue reading →

Let be the set of propositions considered by some rational logician (call her Sue). Further, suppose that is closed under the propositional connectives , , . Here are two related but different preorders on :

if logically entails .

if Sue considers at least as likely to be true as is.

Let be the equivalence relation defined by iff and let similarly be defined by iff .

Then we know what type of structure is: since we’re assuming classical logic in this article, it’s a Boolean algebra. What type of structure is ?

We can at least come up with a couple of examples. Since Sue is a perfect logician, it must be that if , then . If Sue is extremely conservative, she may decline to offer opinions about whether one proposition is more likely to be true than another except when she’s forced to by logic. In this case, is equal to and therefore again a Boolean algebra.

In the other extreme, Sue may have opinions about every pair of propositions, making a total ordering. A principal example of this is where is isomorphic to a subset of and Sue’s opinions about the propositions were generated by her assigning a probability to every proposition .

What’s in between on the spectrum from logic to probability? Are there totally ordered structures not isomorphic to or a subset? More ambitiously: every Boolean algebra has operations , , , while has operations , , which play similar roles in the computation of probabilities (note that is partial on ). How are these related and does every structure on the spectrum from logic to probability have analogous operations?

These structures (i.e., structures of the form for some acceptable in a sense to be defined below) were called scales and defined and explored in a very nice paper by Michael Hardy.

By “voting”, I mean the following general problem: Suppose there are candidates and voters. Each voter produces a total ordering of all candidates. A voting procedure is a function which takes as input all orderings, and produces an output ranking of all candidates. Arrow’s impossibility theorem states that there is really no satisfactory voting procedure when the number of candidates is greater than 2 (majority rule is a good voting procedure when there are two candidates).