IsarMathLib

A library of formalized mathematics for Isabelle/ZF theorem proving environment

theory Finite_ZF_1 imports Finite1 Order_ZF_1a
begin

This theory is based on Finite1 theory and is obsolete. It contains properties of finite sets related to order relations. See the FinOrd theory for a better approach.

Finite vs. bounded sets

The goal of this section is to show that finite sets are bounded and have maxima and minima.

Finite set has a maximum - induction step.

lemma Finite_ZF_1_1_L1:

assumes A1: \( r \text{ is total on } X \) and A2: \( trans(r) \) and A3: \( A\in Fin(X) \) and A4: \( x\in X \) and A5: \( A=0 \vee HasAmaximum(r,A) \)

shows \( A\cup \{x\} = 0 \vee HasAmaximum(r,A\cup \{x\}) \)proof
{
assume \( A=0 \)
then have T1: \( A\cup \{x\} = \{x\} \)
from A1 have \( refl(X,r) \) using total_is_refl
with T1, A4 have \( A\cup \{x\} = 0 \vee HasAmaximum(r,A\cup \{x\}) \) using Order_ZF_4_L8
}
moreover {
assume \( A\neq 0 \)
with A1, A2, A3, A4, A5 have \( A\cup \{x\} = 0 \vee HasAmaximum(r,A\cup \{x\}) \) using FinD , Order_ZF_4_L9
} ultimately show \( thesis \)
qed

For total and transitive relations finite set has a maximum.

theorem Finite_ZF_1_1_T1A:

assumes A1: \( r \text{ is total on } X \) and A2: \( trans(r) \) and A3: \( B\in Fin(X) \)

shows \( B=0 \vee HasAmaximum(r,B) \)proof
have \( 0=0 \vee HasAmaximum(r,0) \)
moreover
note A3
moreover
from A1, A2 have \( \forall A\in Fin(X).\ \forall x\in X.\ \) \( x\notin A \wedge (A=0 \vee HasAmaximum(r,A)) \longrightarrow (A\cup \{x\}=0 \vee HasAmaximum(r,A\cup \{x\})) \) using Finite_ZF_1_1_L1
ultimately show \( B=0 \vee HasAmaximum(r,B) \) by (rule Finite1_L16B )
qed

Finite set has a minimum - induction step.

lemma Finite_ZF_1_1_L2:

assumes A1: \( r \text{ is total on } X \) and A2: \( trans(r) \) and A3: \( A\in Fin(X) \) and A4: \( x\in X \) and A5: \( A=0 \vee HasAminimum(r,A) \)

shows \( A\cup \{x\} = 0 \vee HasAminimum(r,A\cup \{x\}) \)proof
{
assume \( A=0 \)
then have T1: \( A\cup \{x\} = \{x\} \)
from A1 have \( refl(X,r) \) using total_is_refl
with T1, A4 have \( A\cup \{x\} = 0 \vee HasAminimum(r,A\cup \{x\}) \) using Order_ZF_4_L8
}
moreover {
assume \( A\neq 0 \)
with A1, A2, A3, A4, A5 have \( A\cup \{x\} = 0 \vee HasAminimum(r,A\cup \{x\}) \) using FinD , Order_ZF_4_L10
} ultimately show \( thesis \)
qed

For total and transitive relations finite set has a minimum.

theorem Finite_ZF_1_1_T1B:

assumes A1: \( r \text{ is total on } X \) and A2: \( trans(r) \) and A3: \( B \in Fin(X) \)

shows \( B=0 \vee HasAminimum(r,B) \)proof
have \( 0=0 \vee HasAminimum(r,0) \)
moreover
note A3
moreover
from A1, A2 have \( \forall A\in Fin(X).\ \forall x\in X.\ \) \( x\notin A \wedge (A=0 \vee HasAminimum(r,A)) \longrightarrow (A\cup \{x\}=0 \vee HasAminimum(r,A\cup \{x\})) \) using Finite_ZF_1_1_L2
ultimately show \( B=0 \vee HasAminimum(r,B) \) by (rule Finite1_L16B )
qed

For transitive and total relations finite sets are bounded.

theorem Finite_ZF_1_T1:

assumes A1: \( r \text{ is total on } X \) and A2: \( trans(r) \) and A3: \( B\in Fin(X) \)

shows \( IsBounded(B,r) \)proof
from A1, A2, A3 have \( B=0 \vee HasAminimum(r,B) \), \( B=0 \vee HasAmaximum(r,B) \) using Finite_ZF_1_1_T1A , Finite_ZF_1_1_T1B
then have \( B = 0 \vee IsBoundedBelow(B,r) \), \( B = 0 \vee IsBoundedAbove(B,r) \) using Order_ZF_4_L7 , Order_ZF_4_L8A
then show \( IsBounded(B,r) \) using IsBounded_def , IsBoundedBelow_def , IsBoundedAbove_def
qed

For linearly ordered finite sets maximum and minimum have desired properties. The reason we need linear order is that we need the order to be total and transitive for the finite sets to have a maximum and minimum and then we also need antisymmetry for the maximum and minimum to be unique.

theorem Finite_ZF_1_T2:

assumes A1: \( IsLinOrder(X,r) \) and A2: \( A \in Fin(X) \) and A3: \( A\neq 0 \)

shows \( Maximum(r,A) \in A \), \( Minimum(r,A) \in A \), \( \forall x\in A.\ \langle x,Maximum(r,A)\rangle \in r \), \( \forall x\in A.\ \langle Minimum(r,A),x\rangle \in r \)proof
from A1 have T1: \( r \text{ is total on } X \), \( trans(r) \), \( antisym(r) \) using IsLinOrder_def
moreover
from T1, A2, A3 have \( HasAmaximum(r,A) \) using Finite_ZF_1_1_T1A
moreover
from T1, A2, A3 have \( HasAminimum(r,A) \) using Finite_ZF_1_1_T1B
ultimately show \( Maximum(r,A) \in A \), \( Minimum(r,A) \in A \), \( \forall x\in A.\ \langle x,Maximum(r,A)\rangle \in r \), \( \forall x\in A.\ \langle Minimum(r,A),x\rangle \in r \) using Order_ZF_4_L3 , Order_ZF_4_L4
qed

A special case of Finite_ZF_1_T2 when the set has three elements.

corollary Finite_ZF_1_L2A:

assumes A1: \( IsLinOrder(X,r) \) and A2: \( a\in X \), \( b\in X \), \( c\in X \)

shows \( Maximum(r,\{a,b,c\}) \in \{a,b,c\} \), \( Minimum(r,\{a,b,c\}) \in \{a,b,c\} \), \( Maximum(r,\{a,b,c\}) \in X \), \( Minimum(r,\{a,b,c\}) \in X \), \( \langle a,Maximum(r,\{a,b,c\})\rangle \in r \), \( \langle b,Maximum(r,\{a,b,c\})\rangle \in r \), \( \langle c,Maximum(r,\{a,b,c\})\rangle \in r \)proof
from A2 have I: \( \{a,b,c\} \in Fin(X) \), \( \{a,b,c\} \neq 0 \)
with A1 show II: \( Maximum(r,\{a,b,c\}) \in \{a,b,c\} \) by (rule Finite_ZF_1_T2 )
moreover
from A1, I show III: \( Minimum(r,\{a,b,c\}) \in \{a,b,c\} \) by (rule Finite_ZF_1_T2 )
moreover
from A2 have \( \{a,b,c\} \subseteq X \)
ultimately show \( Maximum(r,\{a,b,c\}) \in X \), \( Minimum(r,\{a,b,c\}) \in X \)
from A1, I have \( \forall x\in \{a,b,c\}.\ \langle x,Maximum(r,\{a,b,c\})\rangle \in r \) by (rule Finite_ZF_1_T2 )
then show \( \langle a,Maximum(r,\{a,b,c\})\rangle \in r \), \( \langle b,Maximum(r,\{a,b,c\})\rangle \in r \), \( \langle c,Maximum(r,\{a,b,c\})\rangle \in r \)
qed

If for every element of \(X\) we can find one in \(A\) that is greater, then the \(A\) can not be finite. Works for relations that are total, transitive and antisymmetric.

lemma Finite_ZF_1_1_L3:

assumes A1: \( r \text{ is total on } X \) and A2: \( trans(r) \) and A3: \( antisym(r) \) and A4: \( r \subseteq X\times X \) and A5: \( X\neq 0 \) and A6: \( \forall x\in X.\ \exists a\in A.\ x\neq a \wedge \langle x,a\rangle \in r \)

shows \( A \notin Fin(X) \)proof
from assms have \( \neg IsBounded(A,r) \) using Order_ZF_3_L14 , IsBounded_def
with A1, A2 show \( A \notin Fin(X) \) using Finite_ZF_1_T1
qed
end
lemma total_is_refl: assumes \( r \text{ is total on } X \) shows \( refl(X,r) \)
lemma Order_ZF_4_L8: assumes \( refl(X,r) \) and \( a\in X \) shows \( HasAmaximum(r,\{a\}) \), \( HasAminimum(r,\{a\}) \)
lemma Order_ZF_4_L9: assumes \( r \text{ is total on } X \) and \( trans(r) \) and \( A\subseteq X \) and \( a\in X \) and \( HasAmaximum(r,A) \) shows \( HasAmaximum(r,A\cup \{a\}) \)
lemma Finite_ZF_1_1_L1: assumes \( r \text{ is total on } X \) and \( trans(r) \) and \( A\in Fin(X) \) and \( x\in X \) and \( A=0 \vee HasAmaximum(r,A) \) shows \( A\cup \{x\} = 0 \vee HasAmaximum(r,A\cup \{x\}) \)
lemma Finite1_L16B: assumes \( P(0) \) and \( B\in Fin(X) \) and \( \forall A\in Fin(X).\ \forall x\in X.\ x\notin A \wedge P(A)\longrightarrow P(A\cup \{x\}) \) shows \( P(B) \)
lemma Order_ZF_4_L10: assumes \( r \text{ is total on } X \) and \( trans(r) \) and \( A\subseteq X \) and \( a\in X \) and \( HasAminimum(r,A) \) shows \( HasAminimum(r,A\cup \{a\}) \)
lemma Finite_ZF_1_1_L2: assumes \( r \text{ is total on } X \) and \( trans(r) \) and \( A\in Fin(X) \) and \( x\in X \) and \( A=0 \vee HasAminimum(r,A) \) shows \( A\cup \{x\} = 0 \vee HasAminimum(r,A\cup \{x\}) \)
theorem Finite_ZF_1_1_T1A: assumes \( r \text{ is total on } X \) and \( trans(r) \) and \( B\in Fin(X) \) shows \( B=0 \vee HasAmaximum(r,B) \)
theorem Finite_ZF_1_1_T1B: assumes \( r \text{ is total on } X \) and \( trans(r) \) and \( B \in Fin(X) \) shows \( B=0 \vee HasAminimum(r,B) \)
lemma Order_ZF_4_L7: assumes \( HasAmaximum(r,A) \) shows \( IsBoundedAbove(A,r) \)
lemma Order_ZF_4_L8A: assumes \( HasAminimum(r,A) \) shows \( IsBoundedBelow(A,r) \)
Definition of IsBounded: \( IsBounded(A,r) \equiv (IsBoundedAbove(A,r) \wedge IsBoundedBelow(A,r)) \)
Definition of IsBoundedBelow: \( IsBoundedBelow(A,r) \equiv (A=0 \vee (\exists l.\ \forall x\in A.\ \langle l,x\rangle \in r)) \)
Definition of IsBoundedAbove: \( IsBoundedAbove(A,r) \equiv ( A=0 \vee (\exists u.\ \forall x\in A.\ \langle x,u\rangle \in r)) \)
Definition of IsLinOrder: \( IsLinOrder(X,r) \equiv ( antisym(r) \wedge trans(r) \wedge (r \text{ is total on } X)) \)
lemma Order_ZF_4_L3: assumes \( antisym(r) \) and \( HasAmaximum(r,A) \) shows \( Maximum(r,A) \in A \), \( \forall x\in A.\ \langle x,Maximum(r,A)\rangle \in r \)
lemma Order_ZF_4_L4: assumes \( antisym(r) \) and \( HasAminimum(r,A) \) shows \( Minimum(r,A) \in A \), \( \forall x\in A.\ \langle Minimum(r,A),x\rangle \in r \)
theorem Finite_ZF_1_T2: assumes \( IsLinOrder(X,r) \) and \( A \in Fin(X) \) and \( A\neq 0 \) shows \( Maximum(r,A) \in A \), \( Minimum(r,A) \in A \), \( \forall x\in A.\ \langle x,Maximum(r,A)\rangle \in r \), \( \forall x\in A.\ \langle Minimum(r,A),x\rangle \in r \)
lemma Order_ZF_3_L14: assumes \( r \text{ is total on } X \) and \( trans(r) \) and \( antisym(r) \) and \( r \subseteq X\times X \) and \( X\neq 0 \) and \( \forall x\in X.\ \exists a\in A.\ x\neq a \wedge \langle x,a\rangle \in r \) shows \( \neg IsBoundedAbove(A,r) \)
theorem Finite_ZF_1_T1: assumes \( r \text{ is total on } X \) and \( trans(r) \) and \( B\in Fin(X) \) shows \( IsBounded(B,r) \)
38
28
12
12