1.5: B.5- Structural Induction

Sets, Logic, Computation · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    Read aloud

    How

    Speed: 1×
    Light up
    Highlight

    Symbols: Mulberry Symbols, © 2018–2026 Steve Lee, CC BY-SA 4.0 (licence, the set), the site's own copies.

    From LibreTexts, under CC BY, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    1.5: B.5- Structural Induction

    \(\def\Assign#1#2{ { #1^{\Struct{#2}} } }\)
    \(\def\Atom#1#2{ { \mathord{#1}(#2) } }\)
    \(\def\Bin{ {\mathbb{B}} }\)
    \(\def\cardeq#1#2{ { #1 \approx #2 } }\)
    \(\def\cardle#1#2{ { #1 \preceq #2 } }\)
    \(\def\cardless#1#2{ { #1 \prec #2 } }\)
    \(\def\cardneq#1#2{ { #1 \not\approx #2 } }\)
    \(\def\comp#1#2{ { #2 \circ #1 } }\)
    \(\def\concat{ { \;\frown\; } }\)
    \(\def\Cut{ { \text{Cut} } }\)
    \(\def\Discharge#1#2{ { [#1]^#2 } }\)
    \(\def\DischargeRule#1#2{ { \RightLabel{#1}\LeftLabel{\scriptsize{#2} } } }\)
    \(\def\dom#1{ {\operatorname{dom}(#1)} }\)
    \(\def\Domain#1{ {\left| \Struct{#1} \right|} }\)
    \(\def\Elim#1{ { {#1}\mathrm{Elim} } }\)
    \(\newcommand{\Entails}{\vDash}\)
    \(\newcommand{\EntailsN}{\nvDash}\)
    \(\def\eq[#1][#2]{ { #1 = #2 } }\)
    \(\def\eqN[#1][#2]{ { #1 \neq #2 } }\)
    \(\def\equivclass#1#2{ { #1/_{#2} } }\)
    \(\def\equivrep#1#2{ { [#1]_{#2} } }\)
    \(\def\Exchange{ { \text{X} } }\)
    \(\def\False{ { \mathbb{F} } }\)
    \(\def\FalseCl{ { \lfalse_C } }\)
    \(\def\FalseInt{ { \lfalse_I } }\)
    \(\def\fCenter{ { \,\Sequent\, } }\)
    \(\def\fdefined{ { \;\downarrow } }\)
    \(\def\fn#1{ { \operatorname{#1} } }\)
    \(\def\Frm[#1]{ {\operatorname{Frm}(\Lang #1)} }\)
    \(\def\fundefined{ { \;\uparrow } }\)
    \(\def\funimage#1#2{ { #1[#2] } }\)
    \(\def\funrestrictionto#1#2{ { #1 \restriction_{#2} } }\)
    \(\newcommand{\ident}{\equiv}\)
    \(\newcommand{\indcase}[2]{#1 \ident #2\text{:}}\)
    \(\newcommand{\indcaseA}[2]{#1 \text{ is atomic:}}\)
    \(\def\indfrm{ { A } }\)
    \(\def\indfrmp{ { A } }\)
    \(\def\joinrel{\mathrel{\mkern-3mu}}\)
    \(\def\lambd[#1][#2]{\lambda #1 . #2}\)
    \(\def\Lang#1{ { \mathcal{#1} } }\)
    \(\def\LeftR#1{ { {#1}\mathrm{L} } }\)
    \(\def\len#1{ {\operatorname{len}(#1)} }\)
    \(\def\lexists#1#2{ { \exists #1\, #2 } }\)
    \(\def\lfalse{ {\bot} }\)
    \(\def\lforall#1#2{ { \forall#1\, #2 } }\)
    \(\newcommand{\lif}{\rightarrow}\)
    \(\newcommand{\liff}{\leftrightarrow}\)
    \(\def\Log#1{ { \mathbf{#1} } }\)
    \(\def\ltrue{ {\top} }\)
    \(\def\Id#1{ {\operatorname{Id}_#1} }\)
    \(\def\Int{ {\mathbb{Z}} }\)
    \(\def\Intro#1{ { {#1}\mathrm{Intro} } }\)
    \(\def\mModel#1{ { \mathfrak{#1} } }\)
    \(\newcommand{\mSat}[3][{}]{\mModel{#2}{#1}\Vdash{#3}}\)
    \(\newcommand{\mSatN}[3][{}]{\mModel{#2}{#1}\nVdash{#3}}\)
    \(\def\Nat{ {\mathbb{N}} }\)
    \(\def\nicefrac#1#2{ {{}^#1/_#2} }\)
    \(\def\num#1{ { \overline{#1} } }\)
    \(\def\ran#1{ {\operatorname{ran}(#1)} }\)
    \(\newcommand{\Obj}[1]{\mathsf{#1}}\)
    \(\def\Rat{ {\mathbb{Q}} }\)
    \(\def\Real{ {\mathbb{R}} }\)
    \(\def\RightR#1{ { {#1}\mathrm{R} } }\)
    \(\def\Part#1#2{ { \Atom{\Obj P}{#1, #2} } }\)
    \(\def\pto{ { \hspace{0.1 cm}\to\hspace{-0.44 cm}\vcenter{\tiny{\hbox{|}}}\hspace{0.35 cm} } }\)
    \(\def\PosInt{ {\mathbb{Z}^+} }\)
    \(\def\Pow#1{ {\wp(#1)} }\)
    \(\newcommand{\Proves}{\vdash}\)
    \(\newcommand{\ProvesN}{\nvdash}\)
    \(\def\Relbar{\mathrel{=}}\)
    \(\newcommand{\Sat}[3][{}]{\Struct{#2}{#1}\vDash{#3}}\)
    \(\newcommand{\SatN}[3][{}]{\Struct{#2}{#1}\nvDash{#3}}\)
    \(\newcommand{\Sequent}{\Rightarrow}\)
    \(\def\Setabs#1#2{ { \{#1:#2\} } }\)
    \(\newcommand{\sFmla}[2]{#1\,#2}\)
    \(\def\Struct#1{ {#1} }\)
    \(\def\subst#1#2{ { #1/#2 } }\)
    \(\def\Subst#1#2#3{ { #1[\subst{#2}{#3}] } }\)
    \(\def\TMblank{ { 0 } }\)
    \(\newcommand{\TMendtape}{\triangleright}\)
    \(\def\TMleft{ { L } }\)
    \(\def\TMright{ { R } }\)
    \(\def\TMstay{ { N } }\)
    \(\def\TMstroke{ { 1 } }\)
    \(\def\TMtrans#1#2#3{ { #1,#2,#3 } }\)
    \(\def\Trm[#1]{ {\operatorname{Trm}(\Lang #1)} }\)
    \(\def\True{ { \mathbb{T} } }\)
    \(\newcommand{\TRule}[2]{#2#1}\)
    \(\def\tuple#1{ {\langle #1 \rangle} }\)
    \(\newcommand{\Value}[3][\,]{\mathrm{Val}_{#1}^{#3}(#2)}\)
    \(\def\Var{ { \mathrm{Var} } }\)
    \(\newcommand{\varAssign}[3]{#1 \sim_{#3} #2}\)
    \(\def\Weakening{ { \text{W} } }\)

    So far we have used induction to establish results about all natural numbers. But a corresponding principle can be used directly to prove results about all elements of an inductively defined set. This often called structural induction, because it depends on the structure of the inductively defined objects.

    Generally, an inductive definition is given by (a) a list of “initial” elements of the set and (b) a list of operations which produce new elements of the set from old ones. In the case of nice terms, for instance, the initial objects are the letters. We only have one operation: the operations are \[\begin{aligned} o(s_1, s_2) = & [s_1 \circ s_2]\end{aligned}\] You can even think of the natural numbers \(\Nat\) themselves as being given by an inductive definition: the initial object is \(0\), and the operation is the successor function \(x + 1\).

    In order to prove something about all elements of an inductively defined set, i.e., that every element of the set has a property \(P\), we must:

    1. Prove that the initial objects have \(P\)
    2. Prove that for each operation \(o\), if the arguments have \(P\), so does the result.

    For instance, in order to prove something about all nice terms, we would prove that it is true about all letters, and that it is true about \([s_1 \circ s_2]\) provided it is true of \(s_1\) and \(s_2\) individually.

    Proposition \(\PageIndex{1}\)

    The number of \([\) equals the number of \(]\) in any nice term \(t\).

    Proof. We use structural induction. Nice terms are inductively defined, with letters as initial objects and the operations \(o\) for constructing new nice terms out of old ones.

    1. The claim is true for every letter, since the number of \([\) in a letter by itself is \(0\) and the number of \(]\) in it is also \(0\).
    2. Suppose the number of \([\) in \(s_1\) equals the number of \(]\), and the same is true for \(s_2\). The number of \([\) in \(o(s_1, s_2)\), i.e., in \([s_1 \circ s_2]\), is the sum of the number of \([\) in \(s_1\) and \(s_2\). The number of \(]\) in \(o(s_1, s_2)\) is the sum of the number of \(]\) in \(s_1\) and \(s_2\). Thus, the number of \([\) in \(o(s_1, s_2)\) equals the number of \(]\) in \(o(s_1,s_2)\).

    ◻

    Problem \(\PageIndex{1}\)

    Prove by structural induction that no nice term starts with \(]\).

    Let’s give another proof by structural induction: a proper initial segment of a string \(t\) of symbols is any string \(s\) that agrees with \(t\) symbol by symbol, read from the left, but \(t\) is longer. So, e.g., \([a \circ {}\) is a proper initial segment of \([a \circ b]\), but neither are \([b \circ {}\) (they disagree at the second symbol) nor \([a \circ b]\) (they are the same length).

    Proposition \(\PageIndex{2}\)

    Every proper initial segment of a nice term \(t\) has more \([\)’s than \(]\)’s.

    Proof. By induction on \(t\):

    1. \(t\) is a letter by itself: Then \(t\) has no proper initial segments.
    2. \(t = [s_1 \circ s_2]\) for some nice terms \(s_1\) and \(s_2\). If \(r\) is a proper initial segment of \(t\), there are a number of possibilities:
      1. \(r\) is just \([\): Then \(r\) has one more \([\) than it does \(]\).
      2. \(r\) is \([r_1\) where \(r_1\) is a proper initial segment of \(s_1\): Since \(s_1\) is a nice term, by induction hypothesis, \(r_1\) has more \([\) than \(]\) and the same is true for \([r_1\).
      3. \(r\) is \([s_1\) or \([s_1 \circ {}\): By the previous result, the number of \([\) and \(]\) in \(s_1\) are equal; so the number of \([\) in \([s_1\) or \([s_1 \circ {}\) is one more than the number of \(]\).
      4. \(r\) is \([s_1 \circ r_2\) where \(r_2\) is a proper initial segment of \(s_2\): By induction hypothesis, \(r_2\) contains more \([\) than \(]\). By the previous result, the number of \([\) and of \(]\) in \(s_1\) are equal. So the number of \([\) in \([s_1 \circ r_2\) is greater than the number of \(]\).
      5. \(r\) is \([s_1 \circ s_2\): By the previous result, the number of \([\) and \(]\) in \(s_1\) are equal, and the same for \(s_2\). So there is one more \([\) in \([s_1 \circ s_2\) than there are \(]\).

    ◻