# Equivalence Proofs

An equivalence proof shows that the "if and only if" relationship holds among two or more propositions. We have shown in class that for a connected undirected graph G:
G has an Euler circuit ⇐⇒ every vertex in G has even degree.
To prove this equivalence we have to show the implication in both directions. We need to show that
G has an Euler circuit ⇒ every vertex in G has even degree.
(which we did in Example 2 of the Indirect Proofs section) and we need to show that
Every vertex in G has even degree ⇒ G has an Euler circuit.
(this we will show later, when we look at loop invariants). If we did not prove this second direction, it is possible that there is a graph where every vertex has even degree, but the graph does not have an Euler circuit. It is very tempting to take a short cut and prove both directions of an equivalence proof at the same time. This almost always leads to disaster.

Another common pitfall in equivalence proofs is to prove the same direction twice. Since we can use a direct or an indirect proof for either the "if" or the "only if" direction, there are 4 possible ways we can write an equivalence proof. To prove that p ⇐⇒ q, we can use any of the following 4 methods:

1. Show pq and qp .
2. Show pq and ~p ⇒ ~q.
3. Show ~q ⇒ ~p and qp .
4. Show ~q ⇒ ~p and ~p ⇒ ~q .
However if we prove that
pq   and   ~q ⇒ ~p
then we would have actually shown the same direction twice and have neglected to show that qp.

Sometimes a theorem establishes the equivalence of several propositions p1, p2, p3, ..., pn. In this case, we do not need to prove the equivalence between every pair of statements. All we need to show is:

p1p2
p2p3
p3p4
...
pn-1pn
pnp1
Hypothetical syllogism then guarantees that every pair of propositions is equivalent.

Example: In graph theory, a tree is just a connected undirected graph that does not have any cycles. This type of tree might be different from ones you have encountered in other computer science classes because there is not a distinguished root vertex. Graph-theoretic trees also do not have parent-child relationships between the vertices. Trees have a nice characterization shown below:

Claim: Let G be a connected undirected graph with n vertices and e edges. Then, the following statements are equivalent:
1. G does not contain any cycles.
2. e = n − 1.
3. there is a unique path between every pair of vertices in G.

Proof:
(I ⇒ II)   Suppose that G does not contain any cycles. We first argue that G must have a vertex with degree 1 as long as G has at least 2 vertices. (We do this because when we remove a degree 1 vertex, we do not disconnect the graph and we reduce the number of vertices and edges by 1.) To see this, we explore the graph along a path. We start at any vertex and move along an edge to another vertex. We keep moving along edges but we do not reuse the edge that we used to arrive at the current vertex. If we revisit a vertex at any point, then we have discovered a cycle. Since G does not have any cycles, this is impossible. Thus, each vertex we visit must be a new vertex. Since there are only n vertices in G, after at most n steps we cannot discover any more new vertices. That means, the last vertex, the one we stopped at, must have degree 1. If there is an edge other than the one that we just used to arrive at the last vertex, then that edge would either lead to a previously visited vertex (creating a cycle) or to a new vertex (which implies that G has more than n vertices) — either of which leads to a contradiction.

Now, remove the degree 1 vertex we found from G. The resulting graph is still a connected graph without any cycles, which by the argument above, must have a degree 1 vertex. We keep removing the degree 1 vertices until all we have is a single vertex and no edges. Each time we removed a degree 1 vertex, we reduce the number vertices by 1 and the number of edges by 1. Let m be the number of degree 1 vertices we removed in the process. Then, e must equal m and n must equal m + 1, since the removal process took away all of the edges and all but one of the vertices. Thus, e = n − 1.

(II ⇒ III)   We prove this indirectly. That is, we show that ~III ⇒ ~II. In other words, we will show that if there are two paths in G between some pair of vertices u and v, then en - 1. So, suppose that there are two paths π1 and π2 from u to v:

As we proved in Example 2 of the Uniqueness Proofs section, there must be a cycle from x back to itself going through y, w and z. Here x, y, z and w are vertices on π1 and π2 shown in the figure above. We note that every vertex in this cycle has degree at least 2.

As before, we keep removing degree 1 vertices from G until there are no more degree 1 vertices. Now, we are not allowed to assume that G does not have any cycles, since in proving II ⇒ III we are not allowed to assume I. So, it might be the case that G does not have degree 1 vertices, but that's OK. This argument takes a different route. Suppose that m vertices are removed when we remove degree 1 vertices. (It is possible that m = 0.) Let G' be the resulting graph.

Consider the cycle from x to itself that we found above — the one going through y, w and z. None of the vertices in this cycle was removed. Why is this? Suppose some vertex a is the first vertex from the cycle to be removed. But, if a was first, then a was still connected to two vertices in the cycle. That means, a still had degree 2 and should not have been removed — a contradiction. Thus, the process of removing degree 1 vertices will leave at least 4 vertices in G'.

Let n' and e' be respectively the number of vertices and edges in G'. Every vertex in G' has degree at least 2, so we have:

 2 e'   = ∑ degree(v) v ∈ G'
and
 ∑ degree(v)   ≥   2 n'. v ∈ G'
We know summing the degrees always gives us twice the number of edges. That accounts for the first equation. The second comes from every vertex in G' having degree at least 2. Thus, 2 e' ≥ 2 n' which implies that e'n'. Finally, in terms of the number of vertices n and the number of edges e in the original graph G, we have e = e' + m and n = n' + m because m degree 1 vertices were removed from G to form G'. Thus,
e = e' + mn' + m = n.
Therefore, e is at least n (thus cannot be equal to n − 1) and we have shown that ~III ⇒ ~II.

(III ⇒ I)   We prove this indirectly and and show that if G has a cycle then the path between some pair of vertices u and v is not unique. So, suppose that G has a cycle x1, x2, x3, ..., xk, x1. Then, let u = x1 and v = x2. The edge between x1 and x2 constitutes a path from u to v. Furthermore, the reversal of the portion of the cycle from x2 to xk back to x1 is also a path from u to v. Thus, there are two paths in G from u to v.
QED