In this theory we discuss sequences defined by conditions of the form \(a_0 = x,\ a_{n+1} = f(a_n)\) and similar.
One way of defining a sequence (that is a function \(a:\mathbb{N}\rightarrow X\)) is to provide the first element of the sequence and a function to find the next value when we have the current one. This is usually called "defining a sequence by induction". In this section we set up the notion of a sequence defined by induction and prove the theorems needed to use it.
First we define a helper notion of the sequence defined inductively up to a given natural number \(n\).
Definition
\( InductiveSequenceN(x,f,n) \equiv \) \( \text{The } a.\ a: succ(n) \rightarrow domain(f) \wedge a(0) = x \wedge (\forall k\in n.\ a(succ(k)) = f(a(k))) \)
From that we define the inductive sequence on the whole set of natural numbers. Recall that in Isabelle/ZF the set of natural numbers is denoted nat.
Definition
\( InductiveSequence(x,f) \equiv \bigcup n\in nat.\ InductiveSequenceN(x,f,n) \)
First we will consider the question of existence and uniqueness of finite inductive sequences. The proof is by induction and the next lemma is the \(P(0)\) step. To understand the notation recall that for natural numbers in set theory we have \(n = \{0,1,..,n-1\}\) and \( succ(n) \)\( = \{0,1,..,n\}\).
lemma indseq_exun0:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \)
shows \( \exists ! a.\ a: succ(0) \rightarrow X \wedge a(0) = x \wedge ( \forall k\in 0.\ a(succ(k)) = f(a(k)) ) \)proofA lemma about restricting finite sequences needed for the proof of the inductive step of the existence and uniqueness of finite inductive seqences.
lemma indseq_restrict:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( n \in nat \) and A4: \( a: succ(succ(n))\rightarrow X \wedge a(0) = x \wedge (\forall k\in succ(n).\ a(succ(k)) = f(a(k))) \) and A5: \( a_r = restrict(a,succ(n)) \)
shows \( a_r: succ(n) \rightarrow X \wedge a_r(0) = x \wedge ( \forall k\in n.\ a_r(succ(k)) = f(a_r(k)) ) \)proofExistence and uniqueness of finite inductive sequences. The proof is by induction and the next lemma is the inductive step.
lemma indseq_exun_ind:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( n \in nat \) and A4: \( \exists ! a.\ a: succ(n) \rightarrow X \wedge a(0) = x \wedge (\forall k\in n.\ a(succ(k)) = f(a(k))) \)
shows \( \exists ! a.\ a: succ(succ(n)) \rightarrow X \wedge a(0) = x \wedge \) \( ( \forall k\in succ(n).\ a(succ(k)) = f(a(k)) ) \)proofThe next lemma combines indseq_exun0 and indseq_exun_ind to show the existence and uniqueness of finite sequences defined by induction.
lemma indseq_exun:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( n \in nat \)
shows \( \exists ! a.\ a: succ(n) \rightarrow X \wedge a(0) = x \wedge (\forall k\in n.\ a(succ(k)) = f(a(k))) \)proofWe are now ready to prove the main theorem about finite inductive sequences.
theorem fin_indseq_props:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( n \in nat \) and A4: \( a = InductiveSequenceN(x,f,n) \)
shows \( a: succ(n) \rightarrow X \), \( a(0) = x \), \( \forall k\in n.\ a(succ(k)) = f(a(k)) \)proofA corollary about the domain of a finite inductive sequence.
corollary fin_indseq_domain:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( n \in nat \)
shows \( domain(InductiveSequenceN(x,f,n)) = succ(n) \)proofThe collection of finite sequences defined by induction is consistent in the sense that the restriction of the sequence defined on a larger set to the smaller set is the same as the sequence defined on the smaller set.
lemma indseq_consistent:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( i \in nat \), \( j \in nat \) and A4: \( i \subseteq j \)
shows \( restrict(InductiveSequenceN(x,f,j),succ(i)) = InductiveSequenceN(x,f,i) \)proofFor any two natural numbers one of the corresponding inductive sequences is contained in the other.
lemma indseq_subsets:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( i \in nat \), \( j \in nat \) and A4: \( a = InductiveSequenceN(x,f,i) \), \( b = InductiveSequenceN(x,f,j) \)
shows \( a \subseteq b \vee b \subseteq a \)proofThe first theorem about properties of infinite inductive sequences: inductive sequence is a indeed a sequence (i.e. a function on the set of natural numbers.
theorem indseq_seq:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \)
shows \( InductiveSequence(x,f) : nat \rightarrow X \)proofRestriction of an inductive sequence to a finite domain is the corresponding finite inductive sequence.
lemma indseq_restr_eq:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( n \in nat \)
shows \( restrict(InductiveSequence(x,f),succ(n)) = InductiveSequenceN(x,f,n) \)proofThe first element of the inductive sequence starting at \(x\) and generated by \(f\) is indeed \(x\).
theorem indseq_valat0:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \)
shows \( InductiveSequence(x,f)(0) = x \)proofAn infinite inductive sequence satisfies the inductive relation that defines it.
theorem indseq_vals:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( n \in nat \)
shows \( InductiveSequence(x,f)(succ(n)) = f(InductiveSequence(x,f)(n)) \)proofIn this section we consider the properties of sets that are images of inductive sequences, that is are of the form \(\{f^{(n)} (x) : n \in N\}\) for some \(x\) in the domain of \(f\), where \(f^{(n)}\) denotes the \(n\)'th iteration of the function \(f\). For a function \(f:X\rightarrow X\) and a point \(x\in X\) such set is set is sometimes called the orbit of \(x\) generated by \(f\).
The basic properties of orbits.
theorem ind_seq_image:
assumes A1: \( f: X\rightarrow X \) and A2: \( x\in X \) and A3: \( A = InductiveSequence(x,f)(nat) \)
shows \( x\in A \) and \( \forall y\in A.\ f(y) \in A \)proofIn algebra we often talk about sets "generated" by an element, that is sets of the form (in multiplicative notation) \(\{a^n | n\in Z\}\). This is a related to a general notion of "power" (as in \(a^n = a\cdot a \cdot .. \cdot a\) ) or multiplicity \(n\cdot a = a+a+..+a\). The intuitive meaning of such notions is obvious, but we need to do some work to be able to use it in the formalized setting. This sections is devoted to sequences that are created by repeatedly applying a binary operation with the second argument fixed to some constant.
Basic propertes of sets generated by binary operations.
theorem binop_gen_set:
assumes A1: \( f: X\times Y \rightarrow X \) and A2: \( x\in X \), \( y\in Y \) and A3: \( a = InductiveSequence(x,Fix2ndVar(f,y)) \)
shows \( a : nat \rightarrow X \), \( a(nat) \in Pow(X) \), \( x \in a(nat) \), \( \forall z \in a(nat).\ Fix2ndVar(f,y)(z) \in a(nat) \)proofA simple corollary to the theorem binop_gen_set: a set that contains all iterations of the application of a binary operation exists.
lemma binop_gen_set_ex:
assumes A1: \( f: X\times Y \rightarrow X \) and A2: \( x\in X \), \( y\in Y \)
shows \( \{A \in Pow(X).\ x\in A \wedge (\forall z \in A.\ f\langle z,y\rangle \in A) \} \neq 0 \)proofA more general version of binop_gen_set where the generating binary operation acts on a larger set.
theorem binop_gen_set1:
assumes A1: \( f: X\times Y \rightarrow X \) and A2: \( X_1 \subseteq X \) and A3: \( x\in X_1 \), \( y\in Y \) and A4: \( \forall t\in X_1.\ f\langle t,y\rangle \in X_1 \) and A5: \( a = InductiveSequence(x,Fix2ndVar(restrict(f,X_1\times Y),y)) \)
shows \( a : nat \rightarrow X_1 \), \( a(nat) \in Pow(X_1) \), \( x \in a(nat) \), \( \forall z \in a(nat).\ Fix2ndVar(f,y)(z) \in a(nat) \), \( \forall z \in a(nat).\ f\langle z,y\rangle \in a(nat) \)proofA generalization of binop_gen_set_ex that applies when the binary operation acts on a larger set. This is used in our Metamath translation to prove the existence of the set of real natural numbers. Metamath defines the real natural numbers as the smallest set that cantains \(1\) and is closed with respect to operation of adding \(1\).
lemma binop_gen_set_ex1:
assumes A1: \( f: X\times Y \rightarrow X \) and A2: \( X_1 \subseteq X \) and A3: \( x\in X_1 \), \( y\in Y \) and A4: \( \forall t\in X_1.\ f\langle t,y\rangle \in X_1 \)
shows \( \{A \in Pow(X_1).\ x\in A \wedge (\forall z \in A.\ f\langle z,y\rangle \in A) \} \neq 0 \)proofA seemingly more general form of a sequence defined by induction is a sequence generated by the difference equation \(x_{n+1} = f_{n} (x_n)\) where \(n\mapsto f_n\) is a given sequence of functions such that each maps \(X\) into inself. For example when \(f_n (x) := x + x_n\) then the equation \(S_{n+1} = f_{n} (S_n)\) describes the sequence \(n \mapsto S_n = s_0 +\sum_{i=0}^n x_n\), i.e. the sequence of partial sums of the sequence \(\{s_0, x_0, x_1, x_3,..\}\).
The situation where the function that we iterate changes with \(n\) can be derived from the simpler case if we define the generating function appropriately. Namely, we replace the generating function in the definitions of InductiveSequenceN by the function \(f: X\times n \rightarrow X\times n\), \(f\langle x,k\rangle = \langle f_k(x), k+1 \rangle\) if \(k < n\), \(\langle f_k(x), k \rangle\) otherwise. The first notion defines the expression we will use to define the generating function. To understand the notation recall that in standard Isabelle/ZF for a pair \(s=\langle x,n \rangle\) we have fst\((s)=x\) and snd\((s)=n\).
Definition
\( StateTransfFunNMeta(F,n,s) \equiv \) \( if (snd(s) \in n) then \langle F(snd(s))(fst(s)), succ(snd(s))\rangle else s \)
Then we define the actual generating function on sets of pairs from \(X\times \{0,1, .. ,n\}\).
Definition
\( StateTransfFunN(X,F,n) \equiv \{\langle s, StateTransfFunNMeta(F,n,s)\rangle .\ s \in X\times succ(n)\} \)
Having the generating function we can define the expression that we cen use to define the inductive sequence generates.
Definition
\( StatesSeq(x,X,F,n) \equiv \) \( InductiveSequenceN(\langle x,0\rangle , StateTransfFunN(X,F,n),n) \)
Finally we can define the sequence given by a initial point \(x\), and a sequence \(F\) of \(n\) functions.
Definition
\( InductiveSeqVarFN(x,X,F,n) \equiv \{\langle k,fst(StatesSeq(x,X,F,n)(k))\rangle .\ k \in succ(n)\} \)
The state transformation function (StateTransfFunN is a function that transforms \(X\times n\) into itself.
lemma state_trans_fun:
assumes A1: \( n \in nat \) and A2: \( F: n \rightarrow (X\rightarrow X) \)
shows \( StateTransfFunN(X,F,n): X\times succ(n) \rightarrow X\times succ(n) \)proofWe can apply fin_indseq_props to the sequence used in the definition of InductiveSeqVarFN to get the properties of the sequence of states generated by the StateTransfFunN.
lemma states_seq_props:
assumes A1: \( n \in nat \) and A2: \( F: n \rightarrow (X\rightarrow X) \) and A3: \( x\in X \) and A4: \( b = StatesSeq(x,X,F,n) \)
shows \( b : succ(n) \rightarrow X\times succ(n) \), \( b(0) = \langle x,0\rangle \), \( \forall k \in succ(n).\ snd(b(k)) = k \), \( \forall k\in n.\ b(succ(k)) = \langle F(k)(fst(b(k))), succ(k)\rangle \)proofBasic properties of sequences defined by equation \(x_{n+1}=f_n (x_n)\).
theorem fin_indseq_var_f_props:
assumes A1: \( n \in nat \) and A2: \( x\in X \) and A3: \( F: n \rightarrow (X\rightarrow X) \) and A4: \( a = InductiveSeqVarFN(x,X,F,n) \)
shows \( a: succ(n) \rightarrow X \), \( a(0) = x \), \( \forall k\in n.\ a(succ(k)) = F(k)(a(k)) \)proofA consistency condition: if we make the sequence of generating functions shorter, then we get a shorter inductive sequence with the same values as in the original sequence.
lemma fin_indseq_var_f_restrict:
assumes A1: \( n \in nat \), \( i \in nat \), \( x\in X \), \( F: n \rightarrow (X\rightarrow X) \), \( G: i \rightarrow (X\rightarrow X) \) and A2: \( i \subseteq n \) and A3: \( \forall j\in i.\ G(j) = F(j) \) and A4: \( k \in succ(i) \)
shows \( InductiveSeqVarFN(x,X,G,i)(k) = InductiveSeqVarFN(x,X,F,n)(k) \)proof