Suppose \(r\) is a linear order on a set \(A\) that has \(n\) elements, where \(n \in\mathbb{N}\) . In the FinOrd_ZF theory we prove a theorem stating that there is a unique order isomorphism between \(n = \{0,1,..,n-1\}\) (with natural order) and \(A\). Another way of stating that is that there is a unique way of counting the elements of \(A\) in the order increasing according to relation \(r\). Yet another way of stating the same thing is that there is a unique sorted list of elements of \(A\). We will call this list the Enumeration of \(A\).
In this section we introduce the notion of enumeration and define a proof context (a ''locale'' in Isabelle terms) that sets up the notation for writing about enumarations.
We define enumeration as the only order isomorphism beween a set \(A\) and the number of its elements. We are using the formula \(\bigcup \{x\} = x\) to extract the only element from a singleton. Le is the (natural) order on natural numbers, defined is Nat_ZF theory in the standard Isabelle library.
definition
\( \text{Enumeration}(A,r) \equiv \bigcup ord\_iso(|A|,Le,A,r) \)
To set up the notation we define a locale enums. In this locale we will assume that \(r\) is a linear order on some set \(X\). In most applications this set will be just the set of natural numbers. Standard Isabelle uses \(\leq \) to denote the "less or equal" relation on natural numbers. We will use the \( \leq \) symbol to denote the relation \(r\). Those two symbols usually look the same in the presentation, but they are different in the source.To shorten the notation the enumeration \( \text{Enumeration}(A,r) \) will be denoted as \(\sigma (A)\). Similarly as in the Semigroup theory we will write \(a\hookleftarrow x\) for the result of appending an element \(x\) to the finite sequence (list) \(a\). Finally, \(a\sqcup b\) will denote the concatenation of the lists \(a\) and \(b\).
locale enums
assumes linord: \( \text{IsLinOrder}(X,r) \)
defines \( x \leq y \equiv \langle x,y\rangle \in r \)
defines \( \sigma (A) \equiv \text{Enumeration}(A,r) \)
defines \( a \hookleftarrow x \equiv \text{Append}(a,x) \)
defines \( a \sqcup b \equiv \text{Concat}(a,b) \)
In this section we prove basic facts about enumerations.
A special case of the existence and uniqueess of the order isomorphism for finite sets when the first set is a natural number.
lemma (in enums) ord_iso_nat_fin:
assumes \( A \in \text{FinPow}(X) \) and \( n \in nat \) and \( A \approx n \)
shows \( \exists !f.\ f \in ord\_iso(n,Le,A,r) \) using assms, NatOrder_ZF_1_L2, linord, nat_finpow_nat, fin_ord_iso_ex_uniqAn enumeration is an order isomorhism, a bijection, and a list.
lemma (in enums) enum_props:
assumes \( A \in \text{FinPow}(X) \)
shows \( \sigma (A) \in ord\_iso(|A|,Le, A,r) \), \( \sigma (A) \in \text{bij}(|A|,A) \), \( \sigma (A) : |A| \rightarrow A \)proofA corollary from enum_props. Could have been attached as another assertion, but this slows down verification of some other proofs.
lemma (in enums) enum_fun:
assumes \( A \in \text{FinPow}(X) \)
shows \( \sigma (A) : |A| \rightarrow X \)proofIf a list is an order isomorphism then it must be the enumeration.
lemma (in enums) ord_iso_enum:
assumes A1: \( A \in \text{FinPow}(X) \) and A2: \( n \in nat \) and A3: \( f \in ord\_iso(n,Le,A,r) \)
shows \( f = \sigma (A) \)proofWhat is the enumeration of the empty set?
lemma (in enums) empty_enum:
shows \( \sigma (0) = 0 \)proofAdding a new maximum to a set appends it to the enumeration.
lemma (in enums) enum_append:
assumes A1: \( A \in \text{FinPow}(X) \) and A2: \( b \in X-A \) and A3: \( \forall a\in A.\ a\leq b \)
shows \( \sigma (A \cup \{b\}) = \sigma (A)\hookleftarrow b \)proofWhat is the enumeration of a singleton?
lemma (in enums) enum_singleton:
assumes A1: \( x\in X \)
shows \( \sigma (\{x\}): 1 \rightarrow X \) and \( \sigma (\{x\})(0) = x \)proofassumes \( n \in nat \)
shows \( n \in \text{FinPow}(nat) \)assumes \( \text{IsLinOrder}(X,r) \), \( \text{IsLinOrder}(Y,R) \) and \( A \in \text{FinPow}(X) \), \( B \in \text{FinPow}(Y) \) and \( B \approx A \)
shows \( \exists !f.\ f \in ord\_iso(A,r,B,R) \)assumes \( A \in \text{FinPow}(X) \)
shows \( |A| \in nat \) and \( A \approx |A| \)assumes \( \exists ! x.\ x\in A \)
shows \( (\bigcup A) \in A \)assumes \( A \in \text{FinPow}(X) \)
shows \( \sigma (A) \in ord\_iso(|A|,Le, A,r) \), \( \sigma (A) \in \text{bij}(|A|,A) \), \( \sigma (A) : |A| \rightarrow A \)assumes \( f:X\rightarrow Y \) and \( Y\subseteq Z \)
shows \( f:X\rightarrow Z \)assumes \( A \in \text{FinPow}(X) \) and \( n \in nat \) and \( A \approx n \)
shows \( \exists !f.\ f \in ord\_iso(n,Le,A,r) \)assumes \( A \approx n \) and \( n \in nat \)
shows \( |A| = n \)assumes \( A \in \text{FinPow}(X) \) and \( n \in nat \) and \( f \in ord\_iso(n,Le,A,r) \)
shows \( f = \sigma (A) \)assumes \( x \in X \)
shows \( \{x\} \in \text{FinPow}(X) \)assumes \( A \in \text{FinPow}(X) \) and \( B \in \text{FinPow}(X) \)
shows \( A \cup B \in \text{FinPow}(X) \)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 \( r \text{ is total on } X \)
shows \( \text{refl}(X,r) \)assumes \( f \in ord\_iso(A,r,B,R) \) and \( M_A \notin A \), \( M_B \notin B \) and \( \forall a\in A.\ \langle a, M_A\rangle \in r \), \( \forall b\in B.\ \langle b, M_B\rangle \in R \) and \( \text{antisym}(r) \), \( \text{antisym}(R) \) and \( \langle M_A,M_A\rangle \in r \longleftrightarrow \langle M_B,M_B\rangle \in R \)
shows \( f \cup \{\langle M_A,M_B\rangle \} \in ord\_iso(A\cup \{M_A\} ,r,B\cup \{M_B\} ,R) \)assumes \( A \in \text{FinPow}(X) \) and \( a \in X-A \)
shows \( |A \cup \{a\}| = succ( |A| ) \), \( |A \cup \{a\}| = |A| \cup \{|A|\} \)assumes \( f:A\rightarrow C \)
shows \( domain(f) = A \)assumes \( A \in \text{FinPow}(X) \) and \( b \in X-A \) and \( \forall a\in A.\ a\leq b \)
shows \( \sigma (A \cup \{b\}) = \sigma (A)\hookleftarrow b \)assumes \( x\in X \)
shows \( \text{Append}(0,x): 1 \rightarrow X \) and \( \text{Append}(0,x)(0) = x \)