Examples on Proofs by Induction Example1: Let U be the set of all strings over the alphabet {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, #, $}, i.e., U = {a, …, s, #, $}*. We define my-words as follows: 1) Base Clause: Any single character of the set {a, …, s} is a my-word. 2) Inductive Clause: (a) If F is a my-word, then #F# is also a my-word. (b) If F and G are my-words, then G$H is also a my-word. 3) Final Clause: No element of U is a my-word unless it has to be one by 1) or 2) above. Prove that for every my-word F the following property P(F) holds: the length of F is odd, i.e., the number of characters in F is odd, where a character is any member of the set {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, #, $}. Proof by Induction: Let F be an arbitrary my-word. (a) Base case: Assume F is an element of the set {a, …, s}. Then, F has length one, which is odd. Therefore, P(F) holds. Induction Step: (b) Suppose F = #G#, where G is a my-word. Induction hypotheses: For my-word G the property P(G) holds, i.e., G has odd length. The length of F equals to the length of G + 2 (we add two more elements to G, which are the elements # #). By the induction hypothesis, the length of G is odd. So, we add 2 to an odd number, which results to another odd number. Therefore, the length of F is odd, i.e., P(F) holds. (c) Suppose F = G$H, where G and H are a my-words. Induction hypotheses: For my-words G and H, P(G) and P(H) hold, i.e., G and H have odd length. The length of F equals to the length of G + length of H + 1 (we add one more element to the length of G plus the length of H, which is the element $). By the induction hypothesis, the length of G and the length of H are odd. So, we add two odd numbers together, which results in an even number, and then, we add 1 to that even number, which results in an odd number. Therefore, the length of F is odd, i.e., P(F) holds. Since F was an arbitrary my-word and we covered all the possibilities for the structure of F, we proved the proposition. Example2: Let U be the set of all strings over the alphabet { , {, }, , (, ), Ai: i IN+}, i.e., U = { , {, }, , (, ), Ai: i IN+}*. We define my-formulas as follows: 1. Base Clause: Every propositional sentence Ai (i IN+) is a my-formula. 2. Inductive Clause: a. If G is a my-formula, then ( G} is also a my-formula. b. If G and H are my-formulas, then {{G H) is also my-formula. 3. Final Clause: No element of U is a my-formula, unless it has to be one by 1. or 2. above. Prove that for every my-formula F the following property P(F) holds: the number of “(” in F plus the number of “{” in F, equals the number of “}” in F plus the number of “)” in F plus the number of “ ” in F (i.e., n((F) + n{(F) = n)(F) + n}(F) + n (F)) Proof by Induction: Let F be an arbitrary my-formula. (a) Base case: Assume F is a propositional letter, i.e. F = Ai for some i{1,2,.....}. Then F has 0 (, and 0 {, 0 }, 0 ), and 0 , so the number of ( plus the number if { is equal to the number of ) plus the number of }, plus the number of , i.e., n((F) + n{(F) = n)(F) + n}(F) + n (F). Induction Step: (b) Suppose F = ( G} and G is a my-formula. Induction hypotheses: For my-formula G the property P(G) holds, i.e., the number of ( in G plus the number of { in G, is equal to the number of } in G plus the number of ) in G plus the number of in G, i.e., n((G) + n{(G) = n)(G) + n}(G) + n (G). n((F) = n((G) + 1 n{(F) = n{(G) n)(F) = n)(G) n}(F) = n}(G) + 1 n (F) = n (G). Then, n((F) + n{(F) = n((G) + n{(G) + 1 =(by induction hypothesis) n)(G) + n}(G) n (G) + 1= n)(F) + n}(F) + n (F) Therefore P(F) holds (i.e., n((F) + n{(F) = n)(F) + n}(F) + n (F) ). (c) Suppose F = {{G H), where G and H are my-formulas. Induction hypotheses: For my-formula G the property P(G) holds, i.e., the number of ( in G plus the number of { in G, is equal to the number of } in G plus the number of ) in G plus the number of in G, i.e., n((G) + n{(G) = n)(G) + n}(G) + n (G). For my-formula H the property P(H) holds, i.e., the number of ( in H plus the number of { in H, is equal to the number of } in H plus the number of ) in H plus the number of in H, i.e., n((H) + n{(H) = n)(H) + n}(H) + n (H). n((F) = n((G) + n((H) n{(F) = n{(G) + n{(H) +2 n)(F) = n)(G) + n)(H) + 1 n}(F) = n}(G) + n}(H) n (F) = n (G) + n (H) + 1. Then, n((F) + n{(F) = n((G) + n((H) + n{(G) + n{(G) + 2 =(by induction hypothesis) n)(G) + n)(H) + n}(G) + n}(H) + n (G) + n (H) + 2= n)(F) + n}(F) + n (F) Therefore P(F) holds (i.e., n((F) + n{(F) = n)(F) + n}(F) + n (F) ). Since F was an arbitrary my-formula and we covered all the possibilities for the structure of F, we proved the proposition. Example3: Let U be the set of all strings over the alphabet {♥, ♦, ●, ■, ♣, Ai: i IN+}, i.e., U = {♥, ♦, ●, ■, ♣, Ai: i IN+}*. We define draw-lines as follows: 1. Every Ai, where i IN+ is a draw-line. 2. If G is a draw-line, then ♥G♦ is also a draw-line. 3. If G and H are draw-lines, then ●●G■H♣ is also a draw-line. Prove that for every draw-line F the following property P(F) holds: the number of “♥” in F plus the number of “●” in F, equals the number of “♦” in F plus the number of “♣” in F plus the number of “■” in F (i.e., n♥(F) + n●(F) = n♦(F) + n♣(F) + n■(F)). Proof by Induction: Let F be an arbitrary draw-line. (a) Base case: Assume F = Ai for some i{1,2,.....}. Then F has 0 ♥, and 0 ●, 0 ♦, 0 ♣, and 0■, so the number of ♥ plus the number of ● is equal to the number of ♦ plus the number of ♣, plus the number of ■, i.e., n♥(F) + n●(F) = n♦(F) + n♣(F) + n■(F). Induction Step: (b) Suppose F = ♥G♦, where G is a draw-line. Induction hypotheses: For draw-line G the property P(G) holds, i.e., the number of ♥ in G plus the number of ● in G, is equal to the number of ♣ in G plus the number of ♦ in G plus the number of ■ in G, i.e., n♥(G) + n●(G) = n♦(G) + n♣(G) + n■(G). n♥(F) = n♥(G) + 1 n●(F) = n●(G) n♦(F) = n♦(G) + 1 n♣(F) = n♣(G) n■(F) = n■(G). Then, n♥(F) + n●(F) = n♥(G) + 1 + n●(G) (by induction hypothesis) = n♦(G) + n♣(G) + n■(G) + 1= n♦(F) + n♣(F) + n■(F). Therefore P(F) holds (i.e., n♥(F) + n●(F) = n♦(F) + n♣(F) + n■(F)). (c) Suppose F = ●●G■H♣, where G and H are draw-lines. Induction hypotheses: For draw-line G the property P(G) holds, i.e., the number of ♥ in G plus the number of ● in G, is equal to the number of ♣ in G plus the number of ♦ in G plus the number of ■ in G, i.e., n♥(G) + n●(G) = n♦(G) + n♣(G) + n■(G). For draw-line H the property P(H) holds, i.e., the number of ♥ in H plus the number of ● in H, is equal to the number of ♣ in H plus the number of ♦ in H plus the number of ■ in H, i.e., n♥(H) + n●(H) = n♦(H) + n♣(H) + n■(H). n♥(F) = n♥(G) + n♥(H) n●(F) = n●(G) + n●(H) + 2 n♦(F) = n♦(G) + n♦(H) n♣(F) = n♣(G) + n♣(H) + 1 n■(F) = n■(G) + n■(H) + 1. Then, n♥(F) + n●(F) = n♥(G) + n♥(H) + n●(G) + n●(H) + 2 =(by induction hypothesis) n♦(G) + n♦(H) + n♣(G) + n♣(H) + n■(G) + n■(H) + 2= n♦(F) + n♣(F) + n■(F) Therefore P(F) holds (i.e., n♥(F) + n●(F) = n♦(F) + n♣(F) + n■(F)). Since F was an arbitrary draw-line and we covered all the possibilities for the structure of F, we proved the proposition. Example4: Let U be the set of all strings over the alphabet {♥, ♦, ☺, ●, ■, ♣}, i.e., U = {♥, ♦, ☺, ●, ■, ♣}*. We define drawing-figures as follows: 1. Base Clause: Every member of the set {♥, ☺, ■} is a drawing-figure. 2. Inductive Clause: a. If G is a drawing-figure, then ♥☺G■ is also a drawing-figure. b. If G and H are drawing-figures, then ●G♦H♣♣ is also a drawing-figure. 3. Final Clause: No element of U is a drawing figure unless it has to be one by 1. or 2. above. Prove that for every drawing-figure F the following property P(F) holds: the number of “♥” in F plus the number of “♣” in F, equals the number of “●” in F plus the number of “♦” in F plus the number of “☺” in F (i.e., n♥(F) + n♣(F) = n●(F) + n♦(F) + n☺(F)). Proof by Induction: Let F be an arbitrary drawing-figure. (a) Base case: Assume F is a member of the set {♥, ☺, ■}. Then F has 0 ♥, 0 ♣, 0 ●, 0 ♦,and 0☺, so the number of ♥ in F plus the number of ♣ in F is equal to the number of ● in F plus the number of ♦ in F, plus the number of ☺ in F, i.e., n♥(F) + n♣(F) = n●(F) + n♦(F) + n☺(F). Induction Step: (b) Suppose F = ♥☺G■, where G is a drawing-figure. Induction hypotheses: For drawing-figure G the property P(G) holds, i.e., the number of ♥ in G plus the number of ♣ in G is equal to the number of ● in G plus the number of ♦ in G, plus the number of ☺ in G, i.e., n♥(G) + n♣(G) = n●(G) + n♦(G) + n☺(G). n♥(F) = n♥(G) + 1 n♣(F) = n♣(G) n●(F) = n●(G) n♦(F) = n♦(G) n☺(F) = n☺(G) + 1. Then, n♥(F) + n♣(F) = n♥(G) + n♣(G) + 1 (by induction hypothesis) = n●(G) + n♦(G) + n☺(G) + 1= n●(F) + n♦(F) + n☺(F). Therefore P(F) holds (i.e., n♥(F) + n♣(F) = n●(F) + n♦(F) + n☺(F)). (c) Suppose F = ●G♦H♣♣, where G and H are drawing-figures. Induction hypotheses: For drawing-figure G the property P(G) holds, i.e., the number of ♥ in G plus the number of ♣ in G is equal to the number of ● in G plus the number of ♦ in G, plus the number of ☺ in G, i.e., n♥(G) + n♣(G) = n●(G) + n♦(G) + n☺(G). For drawing-figure H the property P(H) holds, i.e., the number of ♥ in H plus the number of ♣ in H is equal to the number of ● in H plus the number of ♦ in H, plus the number of ☺ in H, i.e., n♥(H) + n♣(H) = n●(H) + n♦(H) + n☺(H). n♥(F) = n♥(G) + n♥(H) n♣(F) = n♣(G) + n♣(H) + 2 n●(F) = n●(G) + n●(H) + 1 n♦(F) = n♦(G) + n♦(H) + 1 n☺(F) = n☺(G) + n☺(H). Then, n♥(F) + n♣(F) = n♥(G) + n♣(G) + n♥(H) + n♣(H) + 2 =(by induction hypothesis) n●(G) + n♦(G) + n☺(G) + n●(H) + n♦(H) + n☺(H) + 2 = n●(F) + n♦(F) + n☺ (F). Therefore P(F) holds (i.e., n♥(F) + n♣(F) = n●(F) + n♦(F) + n☺(F)). Since F was an arbitrary drawing-figure and we covered all the possibilities for the structure of F, we proved the proposition.