Standard Isabelle Finite.thy contains a very useful notion of finite powerset: the set of finite subsets of a given set. The definition, however, is specific to Isabelle and based on the notion of "datatype", obviously not something that belongs to ZF set theory. This theory file devolops the notion of finite powerset similarly as in Finite.thy, but based on standard library's Cardinal.thy. This theory file is intended to replace IsarMathLib's Finite1 and Finite_ZF_1 theories that are currently derived from the "datatype" approach.
The goal of this section is to prove an induction theorem about finite powersets: if the empty set has some property and this property is preserved by adding a single element of a set, then this property is true for all finite subsets of this set.
We defined the finite powerset \( \text{FinPow}(X) \) as those elements of the powerset that are finite.
definition
\( \text{FinPow}(X) \equiv \{A \in Pow(X).\ Finite(A)\} \)
The cardinality of an element of finite powerset is a natural number.
lemma card_fin_is_nat:
assumes \( A \in \text{FinPow}(X) \)
shows \( |A| \in nat \) and \( A \approx |A| \) using assms, FinPow_def, Finite_def, cardinal_cong, nat_into_Card, Card_cardinal_eqA reformulation of card_fin_is_nat: for a finit set \(A\) there is a bijection between \(|A|\) and \(A\).
lemma fin_bij_card:
assumes A1: \( A \in \text{FinPow}(X) \)
shows \( \exists b.\ b \in \text{bij}(|A|, A) \)proofIf a set has the same number of elements as \(n \in \mathbb{N}\), then its cardinality is \(n\). Recall that in set theory a natural number \(n\) is a set that has \(n\) elements.
lemma card_card:
assumes \( A \approx n \) and \( n \in nat \)
shows \( |A| = n \) using assms, cardinal_cong, nat_into_Card, Card_cardinal_eqIf we add a point to a finite set, the cardinality increases by one. To understand the second assertion \(| A \cup \{ a\}| = |A| \cup \{ |A|\} \) recall that the cardinality \(|A|\) of \(A\) is a natural number and for natural numbers we have \(n+1 = n \cup \{ n\}\).
lemma card_fin_add_one:
assumes A1: \( A \in \text{FinPow}(X) \) and A2: \( a \in X-A \)
shows \( |A \cup \{a\}| = succ( |A| ) \), \( |A \cup \{a\}| = |A| \cup \{|A|\} \)proofWe can decompose the finite powerset into collection of sets of the same natural cardinalities.
lemma finpow_decomp:
shows \( \text{FinPow}(X) = (\bigcup n \in nat.\ \{A \in Pow(X).\ A \approx n\}) \) using Finite_def, FinPow_defFinite powerset is the union of sets of cardinality bounded by natural numbers.
lemma finpow_union_card_nat:
shows \( \text{FinPow}(X) = (\bigcup n \in nat.\ \{A \in Pow(X).\ A \preceq n\}) \)proofA different form of finpow_union_card_nat (see above) - a subset that has not more elements than a given natural number is in the finite powerset.
lemma lepoll_nat_in_finpow:
assumes \( n \in nat \), \( A \subseteq X \), \( A \preceq n \)
shows \( A \in \text{FinPow}(X) \) using assms, finpow_union_card_natNatural numbers are finite subsets of the set of natural numbers.
lemma nat_finpow_nat:
assumes \( n \in nat \)
shows \( n \in \text{FinPow}(nat) \) using assms, nat_into_Finite, nat_subset_nat, FinPow_defA finite subset is a finite subset of itself.
lemma fin_finpow_self:
assumes \( A \in \text{FinPow}(X) \)
shows \( A \in \text{FinPow}(A) \) using assms, FinPow_defIf we remove an element and put it back we get the set back.
lemma rem_add_eq:
assumes \( a\in A \)
shows \( (A-\{a\}) \cup \{a\} = A \) using assmsInduction for finite powerset. This is smilar to the standard Isabelle's Fin_induct.
theorem FinPow_induct:
assumes A1: \( P(0) \) and A2: \( \forall A \in \text{FinPow}(X).\ P(A) \longrightarrow (\forall a\in X.\ P(A \cup \{a\})) \) and A3: \( B \in \text{FinPow}(X) \)
shows \( P(B) \)proofA subset of a finite subset is a finite subset.
lemma subset_finpow:
assumes \( A \in \text{FinPow}(X) \) and \( B \subseteq A \)
shows \( B \in \text{FinPow}(X) \) using assms, FinPow_def, subset_FiniteIf we subtract anything from a finite set, the resulting set is finite.
lemma diff_finpow:
assumes \( A \in \text{FinPow}(X) \)
shows \( A-B \in \text{FinPow}(X) \) using assms, subset_finpowIf we remove a point from a finites subset, we get a finite subset.
corollary fin_rem_point_fin:
assumes \( A \in \text{FinPow}(X) \)
shows \( A - \{a\} \in \text{FinPow}(X) \) using assms, diff_finpowCardinality of a nonempty finite set is a successsor of some natural number.
lemma card_non_empty_succ:
assumes A1: \( A \in \text{FinPow}(X) \) and A2: \( A \neq 0 \)
shows \( \exists n \in nat.\ |A| = succ(n) \)proofNonempty set has non-zero cardinality. This is probably true without the assumption that the set is finite, but I couldn't derive it from standard Isabelle theorems.
lemma card_non_empty_non_zero:
assumes \( A \in \text{FinPow}(X) \) and \( A \neq 0 \)
shows \( |A| \neq 0 \)proofAnother variation on the induction theme: If we can show something holds for the empty set and if it holds for all finite sets with at most \(k\) elements then it holds for all finite sets with at most \(k+1\) elements, the it holds for all finite sets.
theorem FinPow_card_ind:
assumes A1: \( P(0) \) and A2: \( \forall k\in nat.\ \) \( (\forall A \in \text{FinPow}(X).\ A \preceq k \longrightarrow P(A)) \longrightarrow \) \( (\forall A \in \text{FinPow}(X).\ A \preceq succ(k) \longrightarrow P(A)) \) and A3: \( A \in \text{FinPow}(X) \)
shows \( P(A) \)proofAnother type of induction (or, maybe recursion). In the induction step we try to find a point in the set that if we remove it, the fact that the property holds for the smaller set implies that the property holds for the whole set.
lemma FinPow_ind_rem_one:
assumes A1: \( P(0) \) and A2: \( \forall A \in \text{FinPow}(X).\ A \neq 0 \longrightarrow (\exists a\in A.\ P(A-\{a\}) \longrightarrow P(A)) \) and A3: \( B \in \text{FinPow}(X) \)
shows \( P(B) \)proofYet another induction theorem. This is similar, but slightly more complicated than FinPow_ind_rem_one. The difference is in the treatment of the empty set to allow to show properties that are not true for empty set.
lemma FinPow_rem_ind:
assumes A1: \( \forall A \in \text{FinPow}(X).\ \) \( A = 0 \vee (\exists a\in A.\ A = \{a\} \vee P(A-\{a\}) \longrightarrow P(A)) \) and A2: \( A \in \text{FinPow}(X) \) and A3: \( A\neq 0 \)
shows \( P(A) \)proofIf a family of sets is closed with respect to taking intersections of two sets then it is closed with respect to taking intersections of any nonempty finite collection.
lemma inter_two_inter_fin:
assumes A1: \( \forall V\in T.\ \forall W\in T.\ V \cap W \in T \) and A2: \( N \neq 0 \) and A3: \( N \in \text{FinPow}(T) \)
shows \( (\bigcap N \in T) \)proofIf a family of sets contains the empty set and is closed with respect to taking unions of two sets then it is closed with respect to taking unions of any finite collection.
lemma union_two_union_fin:
assumes A1: \( 0 \in C \) and A2: \( \forall A\in C.\ \forall B\in C.\ A\cup B \in C \) and A3: \( N \in \text{FinPow}(C) \)
shows \( \bigcup N \in C \)proofEmpty set is in finite power set.
lemma empty_in_finpow:
shows \( 0 \in \text{FinPow}(X) \) using FinPow_defSingleton is in the finite powerset.
lemma singleton_in_finpow:
assumes \( x \in X \)
shows \( \{x\} \in \text{FinPow}(X) \) using assms, FinPow_defUnion of two finite subsets is a finite subset.
lemma union_finpow:
assumes \( A \in \text{FinPow}(X) \) and \( B \in \text{FinPow}(X) \)
shows \( A \cup B \in \text{FinPow}(X) \) using assms, FinPow_defUnion of finite number of finite sets is finite.
lemma fin_union_finpow:
assumes \( M \in \text{FinPow}( \text{FinPow}(X)) \)
shows \( \bigcup M \in \text{FinPow}(X) \) using assms, empty_in_finpow, union_finpow, union_two_union_finIf a set is finite after removing one element, then it is finite.
lemma rem_point_fin_fin:
assumes A1: \( x \in X \) and A2: \( A - \{x\} \in \text{FinPow}(X) \)
shows \( A \in \text{FinPow}(X) \)proofAn image of a finite set is finite.
lemma fin_image_fin:
assumes \( \forall V\in B.\ K(V)\in C \) and \( N \in \text{FinPow}(B) \)
shows \( \{K(V).\ V\in N\} \in \text{FinPow}(C) \)proofUnion of a finite indexed family of finite sets is finite.
lemma union_fin_list_fin:
assumes A1: \( n \in nat \) and A2: \( \forall k \in n.\ N(k) \in \text{FinPow}(X) \)
shows \( \{N(k).\ k \in n\} \in \text{FinPow}( \text{FinPow}(X)) \) and \( (\bigcup k \in n.\ N(k)) \in \text{FinPow}(X) \)proofassumes \( A \in \text{FinPow}(X) \)
shows \( |A| \in nat \) and \( A \approx |A| \)assumes \( A \approx n \) and \( n \in nat \)
shows \( |A| = n \)assumes \( n \in nat \)
shows \( n \subseteq nat \)assumes \( n \in nat \), \( A \subseteq X \), \( A \preceq n \)
shows \( A \in \text{FinPow}(X) \)assumes \( n\in nat \) and \( P(0) \) and \( \forall k\in nat.\ P(k)\longrightarrow P(succ(k)) \)
shows \( P(n) \)assumes \( A \in \text{FinPow}(X) \) and \( B \subseteq A \)
shows \( B \in \text{FinPow}(X) \)assumes \( A \in \text{FinPow}(X) \)
shows \( A-B \in \text{FinPow}(X) \)assumes \( A \in \text{FinPow}(X) \)
shows \( A - \{a\} \in \text{FinPow}(X) \)assumes \( A \in \text{FinPow}(X) \) and \( a \in X-A \)
shows \( |A \cup \{a\}| = succ( |A| ) \), \( |A \cup \{a\}| = |A| \cup \{|A|\} \)assumes \( A \in \text{FinPow}(X) \) and \( A \neq 0 \)
shows \( \exists n \in nat.\ |A| = succ(n) \)assumes \( P(0) \) and \( \forall k\in nat.\ \) \( (\forall A \in \text{FinPow}(X).\ A \preceq k \longrightarrow P(A)) \longrightarrow \) \( (\forall A \in \text{FinPow}(X).\ A \preceq succ(k) \longrightarrow P(A)) \) and \( A \in \text{FinPow}(X) \)
shows \( P(A) \)assumes \( P(0) \) and \( \forall A \in \text{FinPow}(X).\ P(A) \longrightarrow (\forall a\in X.\ P(A \cup \{a\})) \) and \( B \in \text{FinPow}(X) \)
shows \( P(B) \)assumes \( A \in \text{FinPow}(X) \) and \( B \in \text{FinPow}(X) \)
shows \( A \cup B \in \text{FinPow}(X) \)assumes \( 0 \in C \) and \( \forall A\in C.\ \forall B\in C.\ A\cup B \in C \) and \( N \in \text{FinPow}(C) \)
shows \( \bigcup N \in C \)assumes \( x \in X \)
shows \( \{x\} \in \text{FinPow}(X) \)assumes \( n \in nat \)
shows \( n \in \text{FinPow}(nat) \)assumes \( A \in \text{FinPow}(X) \)
shows \( A \in \text{FinPow}(A) \)assumes \( \forall V\in B.\ K(V)\in C \) and \( N \in \text{FinPow}(B) \)
shows \( \{K(V).\ V\in N\} \in \text{FinPow}(C) \)assumes \( M \in \text{FinPow}( \text{FinPow}(X)) \)
shows \( \bigcup M \in \text{FinPow}(X) \)