Last time** **we saw a number of properties of graphs, such as connectivity, where the probability that an Erdős–Rényi random graph satisfies the property is asymptotically either zero or one. And this zero or one depends on whether the parameter is above or below a universal threshold (that depends only on and the property in question).

To remind the reader, the Erdős–Rényi random “graph” is a distribution over graphs that you draw from by including each edge independently with probability . Last time we saw that the existence of an isolated vertex has a sharp threshold at , meaning if is asymptotically smaller than the threshold there will certainly be isolated vertices, and if is larger there will certainly be *no* isolated vertices. We also gave a laundry list of other properties with such thresholds.

One might want to study this phenomenon in general. Even if we might not be able to find all the thresholds we want for a given property, can we classify which properties have thresholds and which do not?

The answer turns out to be mostly yes! For large classes of properties, there are proofs that say things like, “either this property holds with probability tending to one, or it holds with probability tending to zero.” These are called “zero-one laws,” and they’re sort of meta theorems. We’ll see one such theorem in this post relating to constant edge-probabilities in random graphs, and we’ll remark on another at the end.

## Sentences about graphs in first order logic

A zero-one law generally works by defining a class of properties, and then applying a generic first/second moment-type argument to every property in the class.

So first we define what kinds of properties we’ll discuss. We’ll pick a large class: **anything that can be expressed in first-order logic** in the language of graphs. That is, any finite logical statement that uses existential and universal quantifiers over variables, and whose only relation (test) is whether an edge exists between two vertices. We’ll call this test . So you write some sentence in this language, and you take a graph , and you can ask , whether the graph satisfies the sentence.

This seems like a *really* large class of properties, and it is, but let’s think carefully about what kinds of properties can be expressed this way. Clearly the existence of a triangle can be written this way, it’s just the sentence

I’m using for AND, and for OR, and for NOT. Similarly, one can express the existence of a clique of size , or the existence of an independent set of size , or a path of a fixed length, or whether there is a vertex of maximal degree .

Here’s a question: can we write a formula which will be true for a graph if and only if it’s connected? Well such a formula seems like it would have to know about how many vertices there are in the graph, so it could say something like “for all there is a path from to .” It seems like you’d need a family of such formulas that grows with to make anything work. But this isn’t a proof; the question remains whether there is some other tricky way to encode connectivity.

But as it turns out, connectivity is *not* a formula you can express in propositional logic. We won’t prove it here, but we will note at the end of the article that connectivity is in a different class of properties that you can prove has a similar zero-one law.

## The zero-one law for first order logic

So the theorem about first-order expressible sentences is as follows.

**Theorem:** Let be a property of graphs that can be expressed in the first order language of graphs (with the relation). Then for any constant , the probability that holds in has a limit of zero or one as .

*Proof. *We’ll prove the simpler case of , but the general case is analogous. Given such a graph drawn from , what we’ll do is define a countably infinite family of propositional formulas , and argue that they form a sort of “basis” for all first-order sentences about graphs.

First let’s describe the . For any , the sentence will assert that for every set of vertices and every set of vertices, there is some other vertex connected to the first but not the last .

.

In other words, these formulas encapsulate every possible incidence pattern for a single vertex. It is a strange set of formulas, but they have a very nice property we’re about to get to. So for a fixed , what is the probability that it’s false on vertices? We want to give an upper bound and hence show that the formula is true with probability approaching 1. That is, we want to show that *all* the are true with probability tending to 1.

Computing the probability: we have possibilities to choose these sets, and the probability that some other fixed vertex has the good connections is so the probability is not good is , and taking a product over all choices of gives the probability that *there is some bad vertex * with an exponent of . Combining all this together gives an upper bound of being false of:

And are constant, so the left two terms are polynomials while the rightmost term is an exponentially small function, and this implies that the whole expression tends to zero, as desired.

*Break from proof.*

## A bit of model theory

So what we’ve proved so far is that the probability of every formula of the form being satisfied in tends to 1.

Now look at the set of all such formulas

We ask: is there any graph which satisfies all of these formulas? Certainly it cannot be finite, because a finite graph would not be able to satisfy formulas with sufficiently large values of . But indeed, there is a *countably infinite* graph that works. It’s called the *Rado graph*, pictured below.

The Rado graph has some really interesting properties, such as that it contains *every finite and countably infinite graph* as induced subgraphs. Basically this means, as far as countably infinite graphs go, it’s the big momma of all graphs. It’s *the* graph in a very concrete sense of the word. It satisfies all of the formulas in , and in fact it’s uniquely determined by this, meaning that if any other countably infinite graph satisfies all the formulas in , then that graph is isomorphic to the Rado graph.

But for our purposes (proving a zero-one law), there’s a better perspective than graph theory on this object. In the logic perspective, the set is called a* theory*, meaning a set of statements that you consider “axioms” in some logical system. And we’re asking whether there any model realizing the theory. That is, is there some logical system with a semantic interpretation (some mathematical object based on numbers, or sets, or whatever) that satisfies all the axioms?

A good analogy comes from the rational numbers, because they satisfy a similar property among all ordered sets. In fact, the rational numbers are the unique countable, ordered set with the property that it has no biggest/smallest element and is dense. That is, in the ordering there is always another element between any two elements you want. So the theorem says if you have two countable sets with these properties, then they are actually isomorphic as ordered sets, and they are isomorphic to the rational numbers.

So, while we won’t prove that the Rado graph is a model for our theory , we will use that fact to great benefit. One consequence of having a theory with a model is that the theory is *consistent, *meaning it can’t imply any contradictions. Another fact is that this theory is *complete.* Completeness means that any formula or it’s negation is logically implied by the theory. Note these are syntactical implications (using standard rules of propositional logic), and have nothing to do with the model interpreting the theory.

The proof that is complete actually follows from the uniqueness of the Rado graph as the only countable model of . Suppose the contrary, that is not consistent, then there has to be some formula that is not provable, and it’s negation is also not provable, by starting from . Now extend in two ways: by adding and by adding . Both of the new theories are still countable, and by a theorem from logic this means they both still have countable models. But both of these new models are also countable models of , so they have to both be the Rado graph. But this is very embarrassing for them, because we assumed they disagree on the truth of .

So now we can go ahead and prove the zero-one law theorem.

*Return to proof.*

Given an arbitrary property . Now either or it’s negation can be derived from . Without loss of generality suppose it’s . Take all the formulas from the theory you need to derive , and note that since it is a proof in propositional logic you will only finitely many such . Now look at the probabilities of the : they are *all true *with probability tending to 1, so the implied statement of the proof of (i.e., itself) must also hold with probability tending to 1. And we’re done!

If you don’t like model theory, there is another “purely combinatorial” proof of the zero-one law using something called Ehrenfeucht–Fraïssé games. It is a bit longer, though.

## Other zero-one laws

One might naturally ask two questions: what if your probability is not constant, and what other kinds of properties have zero-one laws? Both great questions.

For the first, there are some extra theorems. I’ll just describe one that has always seemed very strange to me. If your probability is of the form but is *irrational*, then the zero-one law still holds! This is a theorem of Baldwin-Shelah-Spencer, and it really makes you wonder why irrational numbers would be so well behaved while rational numbers are not 🙂

For the second question, there is another theorem about *monotone *properties of graphs. Monotone properties come in two flavors, so called “increasing” and “decreasing.” I’ll describe increasing monotone properties and the decreasing counterpart should be obvious. A property is called *monotone increasing* if adding edges can never destroy the property. That is, with an empty graph you don’t have the property (or maybe you do), and as you start adding edges eventually you suddenly get the property, but then adding *more* edges can’t cause you to lose the property again. Good examples of this include connectivity, or the existence of a triangle.

So the theorem is that there is an identical zero-one law for monotone properties. Great!

It’s not so often that you get to see these neat applications of logic and model theory to graph theory and (by extension) computer science. But when you do get to apply them they seem very powerful and mysterious. I think it’s a good thing.

Until next time!