This theory treats finite sequences (i.e. maps \(n\rightarrow X\), where \(n=\{0,1,..,n-1\}\) is a natural number) as lists. It defines and proves the properties of basic operations on lists: concatenation, appending and element etc.
A natural way of representing (finite) lists in set theory is through (finite) sequences. In such view a list of elements of a set \(X\) is a function that maps the set \(\{0,1,..n-1\}\) into \(X\). Since natural numbers in set theory are defined so that \(n =\{0,1,..n-1\}\), a list of length \(n\) can be understood as an element of the function space \(n\rightarrow X\).
We define the set of lists with values in set \(X\) as \( \text{Lists}(X) \).
definition
\( \text{Lists}(X) \equiv \bigcup n\in nat.\ (n\rightarrow X) \)
The set of nonempty \(X\)-value listst will be called \( \text{NELists}(X) \).
definition
\( \text{NELists}(X) \equiv \bigcup n\in nat.\ (succ(n)\rightarrow X) \)
We first define the shift that moves the second sequence to the domain \(\{n,..,n+k-1\}\), where \(n,k\) are the lengths of the first and the second sequence, resp. To understand the notation in the definitions below recall that in Isabelle/ZF \( pred(n) \) is the previous natural number and denotes the difference between natural numbers \(n\) and \(k\).
definition
\( \text{ShiftedSeq}(b,n) \equiv \{\langle j, b(j - n)\rangle .\ j \in Nat \text{Interval}(n,domain(b))\} \)
We define concatenation of two sequences as the union of the first sequence with the shifted second sequence. The result of concatenating lists \(a\) and \(b\) is called \( \text{Concat}(a,b) \).
definition
\( \text{Concat}(a,b) \equiv a \cup \text{ShiftedSeq}(b,domain(a)) \)
For a finite sequence we define the sequence of all elements except the first one. This corresponds to the "tail" function in Haskell. We call it Tail here as well.
definition
\( \text{Tail}(a) \equiv \{\langle k, a(succ(k))\rangle .\ k \in pred(domain(a))\} \)
A dual notion to Tail is the list of all elements of a list except the last one. Borrowing the terminology from Haskell again, we will call this Init.
definition
\( \text{Init}(a) \equiv \text{restrict}(a,pred(domain(a))) \)
Another obvious operation we can talk about is appending an element at the end of a sequence. This is called Append.
definition
\( \text{Append}(a,x) \equiv a \cup \{\langle domain(a),x\rangle \} \)
If lists are modeled as finite sequences (i.e. functions on natural intervals \(\{0,1,..,n-1\} = n\)) it is easy to get the first element of a list as the value of the sequence at \(0\). The last element is the value at \(n-1\). To hide this behind a familiar name we define the Last element of a list.
definition
\( \text{Last}(a) \equiv a(pred(domain(a))) \)
A formula for tail of a finite list.
lemma tail_as_set:
assumes \( n \in nat \) and \( a: n + 1 \rightarrow X \)
shows \( \text{Tail}(a) = \{\langle k,a(k + 1)\rangle .\ k\in n\} \) using assms, func1_1_L1, elem_nat_is_nat(2), succ_add_one(1) unfolding Tail_defFormula for the tail of a list defined by an expression:
lemma tail_formula:
assumes \( n \in nat \) and \( \forall k \in n + 1.\ q(k) \in X \)
shows \( \text{Tail}(\{\langle k,q(k)\rangle .\ k \in n + 1\}) = \{\langle k,q(k + 1)\rangle .\ k \in n\} \)proofCodomain of a nonempty list is nonempty.
lemma nelist_vals_nonempty:
assumes \( a:succ(n)\rightarrow Y \)
shows \( Y\neq 0 \) using assms, codomain_nonemptyShifted sequence is a function on a the interval of natural numbers.
lemma shifted_seq_props:
assumes A1: \( n \in nat \), \( k \in nat \) and A2: \( b:k\rightarrow X \)
shows \( \text{ShiftedSeq}(b,n): Nat \text{Interval}(n,k) \rightarrow X \), \( \forall i \in Nat \text{Interval}(n,k).\ \text{ShiftedSeq}(b,n)(i) = b(i - n) \), \( \forall j\in k.\ \text{ShiftedSeq}(b,n)(n + j) = b(j) \)proofBasis properties of the contatenation of two finite sequences.
theorem concat_props:
assumes A1: \( n \in nat \), \( k \in nat \) and A2: \( a:n\rightarrow X \), \( b:k\rightarrow X \)
shows \( \text{Concat}(a,b): n + k \rightarrow X \), \( \forall i\in n.\ \text{Concat}(a,b)(i) = a(i) \), \( \forall i \in Nat \text{Interval}(n,k).\ \text{Concat}(a,b)(i) = b(i - n) \), \( \forall j \in k.\ \text{Concat}(a,b)(n + j) = b(j) \)proofProperties of concatenating three lists.
lemma concat_concat_list:
assumes A1: \( n \in nat \), \( k \in nat \), \( m \in nat \) and A2: \( a:n\rightarrow X \), \( b:k\rightarrow X \), \( c:m\rightarrow X \) and A3: \( d = \text{Concat}( \text{Concat}(a,b),c) \)
shows \( d : n + k + m \rightarrow X \), \( \forall j \in n.\ d(j) = a(j) \), \( \forall j \in k.\ d(n + j) = b(j) \), \( \forall j \in m.\ d(n + k + j) = c(j) \)proofProperties of concatenating a list with a concatenation of two other lists.
lemma concat_list_concat:
assumes A1: \( n \in nat \), \( k \in nat \), \( m \in nat \) and A2: \( a:n\rightarrow X \), \( b:k\rightarrow X \), \( c:m\rightarrow X \) and A3: \( e = \text{Concat}(a, \text{Concat}(b,c)) \)
shows \( e : n + k + m \rightarrow X \), \( \forall j \in n.\ e(j) = a(j) \), \( \forall j \in k.\ e(n + j) = b(j) \), \( \forall j \in m.\ e(n + k + j) = c(j) \)proofConcatenation is associative.
theorem concat_assoc:
assumes A1: \( n \in nat \), \( k \in nat \), \( m \in nat \) and A2: \( a:n\rightarrow X \), \( b:k\rightarrow X \), \( c:m\rightarrow X \)
shows \( \text{Concat}( \text{Concat}(a,b),c) = \text{Concat}(a, \text{Concat}(b,c)) \)proofProperties of Tail.
theorem tail_props:
assumes A1: \( n \in nat \) and A2: \( a: succ(n) \rightarrow X \)
shows \( \text{Tail}(a) : n \rightarrow X \), \( \forall k \in n.\ \text{Tail}(a)(k) = a(succ(k)) \)proofEssentially the second assertion of tail_props but formulated using notation \(n+1\) instead of \( succ(n) \):
lemma tail_props2:
assumes \( n \in nat \), \( a: n + 1 \rightarrow X \), \( k\in n \)
shows \( \text{Tail}(a)(k) = a(k + 1) \) using assms, succ_add_one(1), tail_props(2), elem_nat_is_nat(2)A nonempty list can be decomposed into concatenation of its first element and the tail.
lemma first_concat_tail:
assumes \( n\in nat \), \( a:succ(n)\rightarrow X \)
shows \( a = \text{Concat}(\{\langle 0,a(0)\rangle \}, \text{Tail}(a)) \)proofProperties of Append. It is a bit surprising that the we don't need to assume that \(n\) is a natural number.
theorem append_props:
assumes A1: \( a: n \rightarrow X \) and A2: \( x\in X \) and A3: \( b = \text{Append}(a,x) \)
shows \( b : succ(n) \rightarrow X \), \( \forall k\in n.\ b(k) = a(k) \), \( b(n) = x \)proofA special case of append_props: appending to a nonempty list does not change the head (first element) of the list.
corollary head_of_append:
assumes \( n\in nat \) and \( a: succ(n) \rightarrow X \) and \( x\in X \)
shows \( \text{Append}(a,x)(0) = a(0) \) using assms, append_props, empty_in_every_succTail commutes with Append.
theorem tail_append_commute:
assumes A1: \( n \in nat \) and A2: \( a: succ(n) \rightarrow X \) and A3: \( x\in X \)
shows \( \text{Append}( \text{Tail}(a),x) = \text{Tail}( \text{Append}(a,x)) \)proof@{term NELists} are non-empty lists
lemma non_zero_List_func_is_NEList:
shows \( \text{NELists}(X) = \{a\in \text{Lists}(X).\ a\neq 0\} \)proofProperties of Init.
theorem init_props:
assumes A1: \( n \in nat \) and A2: \( a: succ(n) \rightarrow X \)
shows \( \text{Init}(a) : n \rightarrow X \), \( \forall k\in n.\ \text{Init}(a)(k) = a(k) \), \( a = \text{Append}( \text{Init}(a), a(n)) \)proofThe initial part of a non-empty list is a list, and the domain of the original list is the successor of its initial part.
theorem init_NElist:
assumes \( a \in \text{NELists}(X) \)
shows \( \text{Init}(a) \in \text{Lists}(X) \) and \( succ(domain( \text{Init}(a))) = domain(a) \)proofIf we take init of the result of append, we get back the same list.
lemma init_append:
assumes A1: \( n \in nat \) and A2: \( a:n\rightarrow X \) and A3: \( x \in X \)
shows \( \text{Init}( \text{Append}(a,x)) = a \)proofA reformulation of definition of Init.
lemma init_def:
assumes \( n \in nat \) and \( a:succ(n)\rightarrow X \)
shows \( \text{Init}(a) = \text{restrict}(a,n) \) using assms, func1_1_L1, Init_defAnother reformulation of the definition of Init, starting with the expression defining the list.
lemma init_def_alt:
assumes \( n\in nat \) and \( \forall k\in n + 1.\ q(k) \in X \)
shows \( \text{Init}(\{\langle k,q(k)\rangle .\ k\in n + 1\}) = \{\langle k,q(k)\rangle .\ k\in n\} \)proofA lemma about extending a finite sequence by one more value. This is just a more explicit version of append_props.
lemma finseq_extend:
assumes \( a:n\rightarrow X \), \( y\in X \), \( b = a \cup \{\langle n,y\rangle \} \)
shows \( b: succ(n) \rightarrow X \), \( \forall k\in n.\ b(k) = a(k) \), \( b(n) = y \) using assms, Append_def, func1_1_L1, append_propsThe next lemma is a bit displaced as it is mainly about finite sets. It is proven here because it uses the notion of Append. Suppose we have a list of element of \(A\) is a bijection. Then for every element that does not belong to \(A\) we can we can construct a bijection for the set \(A \cup \{ x\}\) by appending \(x\). This is just a specialised version of lemma bij_extend_point from func1.thy.
lemma bij_append_point:
assumes A1: \( n \in nat \) and A2: \( b \in \text{bij}(n,X) \) and A3: \( x \notin X \)
shows \( \text{Append}(b,x) \in \text{bij}(succ(n), X \cup \{x\}) \)proofThe next lemma rephrases the definition of Last. Recall that in ZF we have \(\{0,1,2,..,n\} = n+1=\)succ\((n)\).
lemma last_seq_elem:
assumes \( a: succ(n) \rightarrow X \)
shows \( \text{Last}(a) = a(n) \) using assms, func1_1_L1, pred_succ_eq, Last_defThe last element of a non-empty list valued in \(X\) is in \(X\).
lemma last_type:
assumes \( a \in \text{NELists}(X) \)
shows \( \text{Last}(a) \in X \) using assms, last_seq_elem, apply_funtype unfolding NELists_defThe last element of a list of length at least 2 is the same as the last element of the tail of that list.
lemma last_tail_last:
assumes \( n\in nat \), \( a: succ(succ(n)) \rightarrow X \)
shows \( \text{Last}( \text{Tail}(a)) = \text{Last}(a) \)proofIf two finite sequences are the same when restricted to domain one shorter than the original and have the same value on the last element, then they are equal.
lemma finseq_restr_eq:
assumes A1: \( n \in nat \) and A2: \( a: succ(n) \rightarrow X \), \( b: succ(n) \rightarrow X \) and A3: \( \text{restrict}(a,n) = \text{restrict}(b,n) \) and A4: \( a(n) = b(n) \)
shows \( a = b \)proofConcatenating a list of length \(1\) is the same as appending its first (and only) element. Recall that in ZF set theory \(1 = \{ 0 \} \).
lemma append_1elem:
assumes A1: \( n \in nat \) and A2: \( a: n \rightarrow X \) and A3: \( b : 1 \rightarrow X \)
shows \( \text{Concat}(a,b) = \text{Append}(a,b(0)) \)proofIf \(x\in X\) then the singleton set with the pair \(\langle 0,x\rangle\) as the only element is a list of length 1 and hence a nonempty list.
lemma list_len1_singleton:
assumes \( x\in X \)
shows \( \{\langle 0,x\rangle \} : 1 \rightarrow X \) and \( \{\langle 0,x\rangle \} \in \text{NELists}(X) \)proofA singleton list is in fact a singleton set with a pair as the only element.
lemma list_singleton_pair:
assumes A1: \( x:1\rightarrow X \)
shows \( x = \{\langle 0,x(0)\rangle \} \)proofWhen we append an element to the empty list we get a list with length \(1\).
lemma empty_append1:
assumes A1: \( x\in X \)
shows \( \text{Append}(0,x): 1 \rightarrow X \) and \( \text{Append}(0,x)(0) = x \)proofAppending an element is the same as concatenating with certain pair.
lemma append_concat_pair:
assumes \( n \in nat \) and \( a: n \rightarrow X \) and \( x\in X \)
shows \( \text{Append}(a,x) = \text{Concat}(a,\{\langle 0,x\rangle \}) \) using assms, list_len1_singleton, append_1elem, pair_valAn associativity property involving concatenation and appending. For proof we just convert appending to concatenation and use concat_assoc.
lemma concat_append_assoc:
assumes A1: \( n \in nat \), \( k \in nat \) and A2: \( a:n\rightarrow X \), \( b:k\rightarrow X \) and A3: \( x \in X \)
shows \( \text{Append}( \text{Concat}(a,b),x) = \text{Concat}(a, \text{Append}(b,x)) \)proofAn identity involving concatenating with init and appending the last element.
lemma concat_init_last_elem:
assumes \( n \in nat \), \( k \in nat \) and \( a: n \rightarrow X \) and \( b : succ(k) \rightarrow X \)
shows \( \text{Append}( \text{Concat}(a, \text{Init}(b)),b(k)) = \text{Concat}(a,b) \) using assms, init_props, apply_funtype, concat_append_assocA lemma about creating lists by composition and how Append behaves in such case.
lemma list_compose_append:
assumes A1: \( n \in nat \) and A2: \( a : n \rightarrow X \) and A3: \( x \in X \) and A4: \( c : X \rightarrow Y \)
shows \( c\circ \text{Append}(a,x) : succ(n) \rightarrow Y \), \( c\circ \text{Append}(a,x) = \text{Append}(c\circ a, c(x)) \)proofA lemma about appending an element to a list defined by set comprehension.
lemma set_list_append:
assumes A1: \( \forall i \in succ(k).\ b(i) \in X \) and A2: \( a = \{\langle i,b(i)\rangle .\ i \in succ(k)\} \)
shows \( a: succ(k) \rightarrow X \), \( \{\langle i,b(i)\rangle .\ i \in k\}: k \rightarrow X \), \( a = \text{Append}(\{\langle i,b(i)\rangle .\ i \in k\},b(k)) \)proofA version of set_list_append using \(n+1\) instead of \( succ(n) \).
lemma set_list_append1:
assumes \( n\in nat \) and \( \forall k\in n + 1.\ q(k) \in X \)
defines \( a\equiv \{\langle k,q(k)\rangle .\ k\in n + 1\} \)
shows \( a: n + 1 \rightarrow X \), \( \{\langle k,q(k)\rangle .\ k \in n\}: n \rightarrow X \), \( \text{Init}(a) = \{\langle k,q(k)\rangle .\ k \in n\} \), \( a = \text{Append}(\{\langle k,q(k)\rangle .\ k \in n\},q(n)) \), \( a = \text{Append}( \text{Init}(a), q(n)) \), \( a = \text{Append}( \text{Init}(a), a(n)) \)proofAn induction theorem for lists.
lemma list_induct:
assumes A1: \( \forall b\in 1\rightarrow X.\ P(b) \) and A2: \( \forall b\in \text{NELists}(X).\ P(b) \longrightarrow (\forall x\in X.\ P( \text{Append}(b,x))) \) and A3: \( d \in \text{NELists}(X) \)
shows \( P(d) \)proofA dual notion to Append is Prepend where we add an element to the list at the beginning of the list. We define the value of the list \(a\) prepended by an element \(x\) as \(x\) if index is 0 and \(a(k-1)\) otherwise.
definition
\( \text{Prepend}(a,x) \equiv \{\langle k,\text{if }k = 0\text{ then }x\text{ else }a(k - 1)\rangle .\ k\in domain(a) + 1\} \)
If \(a:n\rightarrow X\) is a list, then \(a\) with prepended \(x\in X\) is a list as well and its first element is \(x\).
lemma prepend_props:
assumes \( n\in nat \), \( a:n\rightarrow X \), \( x\in X \)
shows \( \text{Prepend}(a,x):(n + 1)\rightarrow X \) and \( \text{Prepend}(a,x)(0) = x \)proofWhen prepending an element to a list the values at positive indices do not change.
lemma prepend_val:
assumes \( n\in nat \), \( a:n\rightarrow X \), \( x\in X \), \( k\in n \)
shows \( \text{Prepend}(a,x)(k + 1) = a(k) \)proofThe tail of a list prepended by an element is equal to the list.
lemma tail_prepend:
assumes \( n\in nat \), \( a:n\rightarrow X \), \( x\in X \)
shows \( \text{Tail}( \text{Prepend}(a,x)) = a \)proofLists of length \(n\) of elements of some set \(X\) can be thought of as a model of the cartesian product \(X^n\) which is more convenient in many applications.
There is a natural bijection between the space \((n+1)\rightarrow X\) of lists of length \(n+1\) of elements of \(X\) and the cartesian product \((n\rightarrow X)\times X\).
lemma lists_cart_prod:
assumes \( n \in nat \)
shows \( \{\langle x,\langle \text{Init}(x),x(n)\rangle \rangle .\ x \in succ(n)\rightarrow X\} \in \text{bij}(succ(n)\rightarrow X,(n\rightarrow X)\times X) \)proofWe can identify a set \(X\) with lists of length one of elements of \(X\).
lemma singleton_list_bij:
shows \( \{\langle x,x(0)\rangle .\ x\in 1\rightarrow X\} \in \text{bij}(1\rightarrow X,X) \)proofWe can identify a set of \(X\)-valued lists of length with \(X\).
lemma list_singleton_bij:
shows \( \{\langle x,\{\langle 0,x\rangle \}\rangle .\ x\in X\} \in \text{bij}(X,1\rightarrow X) \) and \( \{\langle y,y(0)\rangle .\ y\in 1\rightarrow X\} = converse(\{\langle x,\{\langle 0,x\rangle \}\rangle .\ x\in X\}) \) and \( \{\langle x,\{\langle 0,x\rangle \}\rangle .\ x\in X\} = converse(\{\langle y,y(0)\rangle .\ y\in 1\rightarrow X\}) \)proofWhat is the inverse image of a set by the natural bijection between \(X\)-valued singleton lists and \(X\)?
lemma singleton_vimage:
assumes \( U\subseteq X \)
shows \( \{x\in 1\rightarrow X.\ x(0) \in U\} = \{ \{\langle 0,y\rangle \}.\ y\in U\} \)proofA technical lemma about extending a list by values from a set.
lemma list_append_from:
assumes A1: \( n \in nat \) and A2: \( U \subseteq n\rightarrow X \) and A3: \( V \subseteq X \)
shows \( \{x \in succ(n)\rightarrow X.\ \text{Init}(x) \in U \wedge x(n) \in V\} = (\bigcup y\in V.\ \{ \text{Append}(x,y).\ x\in U\}) \)proofassumes \( f:A\rightarrow C \)
shows \( domain(f) = A \)assumes \( n \in nat \) and \( k\in n \)
shows \( k \lt n \), \( k \in nat \), \( k \leq n \), \( \langle k,n\rangle \in Le \)assumes \( n\in nat \)
shows \( n + 1 = succ(n) \), \( n + 1 \in nat \), \( \{0\} + n = succ(n) \), \( n + \{0\} = succ(n) \), \( succ(n) \in nat \), \( 0 \in n + 1 \), \( n \subseteq n + 1 \)assumes \( \forall x\in X.\ b(x) \in Y \)
shows \( \{\langle x,b(x)\rangle .\ x\in X\} : X\rightarrow Y \)assumes \( n \in nat \) and \( a: n + 1 \rightarrow X \)
shows \( \text{Tail}(a) = \{\langle k,a(k + 1)\rangle .\ k\in n\} \)assumes \( n \in nat \), \( i\in n \)
shows \( succ(i) \in succ(n) \), \( i + 1 \in n + 1 \), \( i \in n + 1 \)assumes \( x\in X \)
shows \( \{\langle x,b(x)\rangle .\ x\in X\}(x)=b(x) \)assumes \( f:X\rightarrow Y \), \( X\neq \emptyset \)
shows \( Y\neq \emptyset \)assumes \( k \in nat \) and \( i \in Nat \text{Interval}(n,k) \)
shows \( i - n \in k \)assumes \( f:X\rightarrow Y \), \( x\in X \) and \( f = \{\langle x,b(x)\rangle .\ x\in X\} \)
shows \( f(x) = b(x) \) and \( b(x)\in Y \)assumes \( n \in nat \) and \( k\in n \)
shows \( k \lt n \), \( k \in nat \), \( k \leq n \), \( \langle k,n\rangle \in Le \)assumes \( n \in nat \), \( k \in nat \) and \( b:k\rightarrow X \)
shows \( \text{ShiftedSeq}(b,n): Nat \text{Interval}(n,k) \rightarrow X \), \( \forall i \in Nat \text{Interval}(n,k).\ \text{ShiftedSeq}(b,n)(i) = b(i - n) \), \( \forall j\in k.\ \text{ShiftedSeq}(b,n)(n + j) = b(j) \)assumes \( n \in nat \), \( k \in nat \)
shows \( n \cap Nat \text{Interval}(n,k) = 0 \), \( n \cup Nat \text{Interval}(n,k) = n + k \)assumes \( n \in nat \), \( k \in nat \) and \( a:n\rightarrow X \), \( b:k\rightarrow X \)
shows \( \text{Concat}(a,b): n + k \rightarrow X \), \( \forall i\in n.\ \text{Concat}(a,b)(i) = a(i) \), \( \forall i \in Nat \text{Interval}(n,k).\ \text{Concat}(a,b)(i) = b(i - n) \), \( \forall j \in k.\ \text{Concat}(a,b)(n + j) = b(j) \)assumes \( n \in nat \) and \( k \in nat \)
shows \( n \leq n + k \), \( n \subseteq n + k \), \( n \subseteq k + n \)assumes \( k \in nat \) and \( j\in k \)
shows \( (n + j) \lt (n + k) \), \( (n + j) \in (n + k) \)assumes \( n \in nat \), \( k \in nat \), \( m \in nat \) and \( a:n\rightarrow X \), \( b:k\rightarrow X \), \( c:m\rightarrow X \) and \( d = \text{Concat}( \text{Concat}(a,b),c) \)
shows \( d : n + k + m \rightarrow X \), \( \forall j \in n.\ d(j) = a(j) \), \( \forall j \in k.\ d(n + j) = b(j) \), \( \forall j \in m.\ d(n + k + j) = c(j) \)assumes \( n \in nat \), \( k \in nat \), \( m \in nat \) and \( a:n\rightarrow X \), \( b:k\rightarrow X \), \( c:m\rightarrow X \) and \( e = \text{Concat}(a, \text{Concat}(b,c)) \)
shows \( e : n + k + m \rightarrow X \), \( \forall j \in n.\ e(j) = a(j) \), \( \forall j \in k.\ e(n + j) = b(j) \), \( \forall j \in m.\ e(n + k + j) = c(j) \)assumes \( n \in nat \), \( k \in nat \), \( m \in nat \)
shows \( n + k + m = (n + k) \cup Nat \text{Interval}(n + k,m) \), \( n + k + m = n \cup Nat \text{Interval}(n,k + m) \), \( n + k + m = n \cup Nat \text{Interval}(n,k) \cup Nat \text{Interval}(n + k,m) \)assumes \( f: X\rightarrow Y \), \( g: X\rightarrow Z \) and \( \forall x\in X.\ f(x) = g(x) \)
shows \( f = g \)assumes \( n \in nat \)
shows \( \forall i \in n.\ succ(i) \in succ(n) \)assumes \( f:X\rightarrow Y \) and \( f = \{\langle x,b(x)\rangle .\ x\in X\} \)
shows \( \forall x\in X.\ f(x) = b(x) \)assumes \( n \in nat \) and \( a: succ(n) \rightarrow X \)
shows \( \text{Tail}(a) : n \rightarrow X \), \( \forall k \in n.\ \text{Tail}(a)(k) = a(succ(k)) \)assumes \( n \in nat \)
shows \( 0 \in succ(n) \)assumes \( y \in Y \)
shows \( \{\langle x,y\rangle \} : \{x\} \rightarrow Y \)assumes \( n \in nat \) and \( a: succ(n) \rightarrow X \)
shows \( \text{Tail}(a) : n \rightarrow X \), \( \forall k \in n.\ \text{Tail}(a)(k) = a(succ(k)) \)assumes \( n \in nat \), \( k \in nat \) and \( a:n\rightarrow X \), \( b:k\rightarrow X \)
shows \( \text{Concat}(a,b): n + k \rightarrow X \), \( \forall i\in n.\ \text{Concat}(a,b)(i) = a(i) \), \( \forall i \in Nat \text{Interval}(n,k).\ \text{Concat}(a,b)(i) = b(i - n) \), \( \forall j \in k.\ \text{Concat}(a,b)(n + j) = b(j) \)assumes \( n\in nat \)
shows \( n + 1 = succ(n) \), \( n + 1 \in nat \), \( \{0\} + n = succ(n) \), \( n + \{0\} = succ(n) \), \( succ(n) \in nat \), \( 0 \in n + 1 \), \( n \subseteq n + 1 \)assumes \( n \in nat \), \( k \in nat \) and \( a:n\rightarrow X \), \( b:k\rightarrow X \)
shows \( \text{Concat}(a,b): n + k \rightarrow X \), \( \forall i\in n.\ \text{Concat}(a,b)(i) = a(i) \), \( \forall i \in Nat \text{Interval}(n,k).\ \text{Concat}(a,b)(i) = b(i - n) \), \( \forall j \in k.\ \text{Concat}(a,b)(n + j) = b(j) \)assumes \( n \in nat \) and \( n\neq 0 \)
shows \( \exists k\in nat.\ n = succ(k) \)assumes \( n \in nat \), \( succ(k) \in succ(n) \)
shows \( k\in n \)assumes \( n \in nat \), \( k \in nat \) and \( a:n\rightarrow X \), \( b:k\rightarrow X \)
shows \( \text{Concat}(a,b): n + k \rightarrow X \), \( \forall i\in n.\ \text{Concat}(a,b)(i) = a(i) \), \( \forall i \in Nat \text{Interval}(n,k).\ \text{Concat}(a,b)(i) = b(i - n) \), \( \forall j \in k.\ \text{Concat}(a,b)(n + j) = b(j) \)assumes \( f:X\rightarrow Y \) and \( a\notin X \) and \( g = f \cup \{\langle a,b\rangle \} \)
shows \( g : X\cup \{a\} \rightarrow Y\cup \{b\} \), \( \forall x\in X.\ g(x) = f(x) \), \( g(a) = b \)assumes \( x\in X \)
shows \( X \cup \{x\} = X \)assumes \( a: n \rightarrow X \) and \( x\in X \) and \( b = \text{Append}(a,x) \)
shows \( b : succ(n) \rightarrow X \), \( \forall k\in n.\ b(k) = a(k) \), \( b(n) = x \)assumes \( n \in nat \) and \( a: succ(n) \rightarrow X \)
shows \( \text{Tail}(a) : n \rightarrow X \), \( \forall k \in n.\ \text{Tail}(a)(k) = a(succ(k)) \)assumes \( n \in nat \) and \( a: succ(n) \rightarrow X \)
shows \( \text{Init}(a) : n \rightarrow X \), \( \forall k\in n.\ \text{Init}(a)(k) = a(k) \), \( a = \text{Append}( \text{Init}(a), a(n)) \)assumes \( n \in nat \) and \( a: succ(n) \rightarrow X \)
shows \( \text{Init}(a) : n \rightarrow X \), \( \forall k\in n.\ \text{Init}(a)(k) = a(k) \), \( a = \text{Append}( \text{Init}(a), a(n)) \)assumes \( n \in nat \) and \( a:succ(n)\rightarrow X \)
shows \( \text{Init}(a) = \text{restrict}(a,n) \)assumes \( A\subseteq X \)
shows \( \text{restrict}(\{\langle x,q(x)\rangle .\ x\in X\},A) = \{\langle x,q(x)\rangle .\ x\in A\} \)assumes \( f \in \text{bij}(X,Y) \), \( a\notin X \), \( b\notin Y \)
shows \( (f \cup \{\langle a,b\rangle \}) \in \text{bij}(X\cup \{a\},Y\cup \{b\}) \)assumes \( f:X\rightarrow Y \) and \( Y\subseteq Z \)
shows \( f:X\rightarrow Z \)assumes \( a: succ(n) \rightarrow X \)
shows \( \text{Last}(a) = a(n) \)assumes \( f:X\rightarrow Y \)
shows \( f = \{\langle x, f(x)\rangle .\ x \in X\} \)assumes \( x\in X \)
shows \( \{\langle 0,x\rangle \} : 1 \rightarrow X \) and \( \{\langle 0,x\rangle \} \in \text{NELists}(X) \)assumes \( n \in nat \) and \( a: n \rightarrow X \) and \( b : 1 \rightarrow X \)
shows \( \text{Concat}(a,b) = \text{Append}(a,b(0)) \)assumes \( n \in nat \) and \( a: n \rightarrow X \) and \( x\in X \)
shows \( \text{Append}(a,x) = \text{Concat}(a,\{\langle 0,x\rangle \}) \)assumes \( n \in nat \), \( k \in nat \), \( m \in nat \) and \( a:n\rightarrow X \), \( b:k\rightarrow X \), \( c:m\rightarrow X \)
shows \( \text{Concat}( \text{Concat}(a,b),c) = \text{Concat}(a, \text{Concat}(b,c)) \)assumes \( n \in nat \), \( k \in nat \) and \( a:n\rightarrow X \), \( b:k\rightarrow X \) and \( x \in X \)
shows \( \text{Append}( \text{Concat}(a,b),x) = \text{Concat}(a, \text{Append}(b,x)) \)assumes \( \forall i \in succ(k).\ b(i) \in X \) and \( a = \{\langle i,b(i)\rangle .\ i \in succ(k)\} \)
shows \( a: succ(k) \rightarrow X \), \( \{\langle i,b(i)\rangle .\ i \in k\}: k \rightarrow X \), \( a = \text{Append}(\{\langle i,b(i)\rangle .\ i \in k\},b(k)) \)assumes \( n\in nat \) and \( \forall k\in n + 1.\ q(k) \in X \)
shows \( \text{Init}(\{\langle k,q(k)\rangle .\ k\in n + 1\}) = \{\langle k,q(k)\rangle .\ k\in n\} \)assumes \( \forall i \in succ(k).\ b(i) \in X \) and \( a = \{\langle i,b(i)\rangle .\ i \in succ(k)\} \)
shows \( a: succ(k) \rightarrow X \), \( \{\langle i,b(i)\rangle .\ i \in k\}: k \rightarrow X \), \( a = \text{Append}(\{\langle i,b(i)\rangle .\ i \in k\},b(k)) \)assumes \( n\in nat \) and \( P(0) \) and \( \forall k\in nat.\ P(k)\longrightarrow P(succ(k)) \)
shows \( P(n) \)assumes \( n\in nat \), \( n\neq 0 \), \( k\in succ(n) \)
shows \( pred(k)\in n \)assumes \( n\in nat \), \( n\neq 0 \)
shows \( n - 1 = pred(n) \)assumes \( n\in nat \), \( a:n\rightarrow X \), \( x\in X \)
shows \( \text{Prepend}(a,x):(n + 1)\rightarrow X \) and \( \text{Prepend}(a,x)(0) = x \)assumes \( n \in nat \), \( a: n + 1 \rightarrow X \), \( k\in n \)
shows \( \text{Tail}(a)(k) = a(k + 1) \)assumes \( n\in nat \), \( a:n\rightarrow X \), \( x\in X \), \( k\in n \)
shows \( \text{Prepend}(a,x)(k + 1) = a(k) \)assumes \( n \in nat \) and \( a: succ(n) \rightarrow X \), \( b: succ(n) \rightarrow X \) and \( \text{restrict}(a,n) = \text{restrict}(b,n) \) and \( a(n) = b(n) \)
shows \( a = b \)assumes \( n \in nat \) and \( a:n\rightarrow X \) and \( x \in X \)
shows \( \text{Init}( \text{Append}(a,x)) = a \)assumes \( x:1\rightarrow X \)
shows \( x = \{\langle 0,x(0)\rangle \} \)assumes \( f : \{a\}\rightarrow X \)
shows \( f = \{\langle a, f(a)\rangle \} \)assumes \( a \in \text{bij}(A,B) \) and \( b:B\rightarrow A \) and \( \forall x\in A.\ b(a(x)) = x \)
shows \( b \in \text{bij}(B,A) \) and \( a = converse(b) \) and \( b = converse(a) \)