src/ZF/ord.ML
changeset 30 d49df4181f0d
parent 14 1c0926788772
child 37 cebe01deba80
--- a/src/ZF/ord.ML	Tue Oct 05 17:49:23 1993 +0100
+++ b/src/ZF/ord.ML	Wed Oct 06 09:58:53 1993 +0100
@@ -120,6 +120,9 @@
 by (fast_tac ZF_cs 1);
 val Ord_in_Ord = result();
 
+(* Ord(succ(j)) ==> Ord(j) *)
+val Ord_succD = succI1 RSN (2, Ord_in_Ord);
+
 goal Ord.thy "!!i j. [| Ord(i);  Transset(j);  j<=i |] ==> Ord(j)";
 by (REPEAT (ares_tac [OrdI] 1
      ORELSE eresolve_tac [Ord_contains_Transset, subsetD] 1));
@@ -150,6 +153,10 @@
 			  Ord_contains_Transset] 1));
 val Ord_succ = result();
 
+goal Ord.thy "Ord(succ(i)) <-> Ord(i)";
+by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1);
+val Ord_succ_iff = result();
+
 val nonempty::prems = goal Ord.thy
     "[| j:A;  !!i. i:A ==> Ord(i) |] ==> Ord(Inter(A))";
 by (rtac (nonempty RS Transset_Inter_family RS OrdI) 1);
@@ -167,6 +174,88 @@
 val Ord_INT = result();
 
 
+(*** < is 'less than' for ordinals ***)
+
+goalw Ord.thy [lt_def] "!!i j. [| i:j;  Ord(j) |] ==> i<j";
+by (REPEAT (ares_tac [conjI] 1));
+val ltI = result();
+
+val major::prems = goalw Ord.thy [lt_def]
+    "[| i<j;  [| i:j;  Ord(i);  Ord(j) |] ==> P |] ==> P";
+by (rtac (major RS conjE) 1);
+by (REPEAT (ares_tac (prems@[Ord_in_Ord]) 1));
+val ltE = result();
+
+goal Ord.thy "!!i j. i<j ==> i:j";
+by (etac ltE 1);
+by (assume_tac 1);
+val ltD = result();
+
+goalw Ord.thy [lt_def] "~ i<0";
+by (fast_tac ZF_cs 1);
+val not_lt0 = result();
+
+(* i<0 ==> R *)
+val lt0E = standard (not_lt0 RS notE);
+
+goal Ord.thy "!!i j k. [| i<j;  j<k |] ==> i<k";
+by (fast_tac (ZF_cs addSIs [ltI] addSEs [ltE, Ord_trans]) 1);
+val lt_trans = result();
+
+goalw Ord.thy [lt_def] "!!i j. [| i<j;  j<i |] ==> P";
+by (REPEAT (eresolve_tac [asm_rl, conjE, mem_anti_sym] 1));
+val lt_anti_sym = result();
+
+val lt_anti_refl = prove_goal Ord.thy "i<i ==> P"
+ (fn [major]=> [ (rtac (major RS (major RS lt_anti_sym)) 1) ]);
+
+val lt_not_refl = prove_goal Ord.thy "~ i<i"
+ (fn _=> [ (rtac notI 1), (etac lt_anti_refl 1) ]);
+
+(** le is less than or equals;  recall  i le j  abbrevs  i<succ(j) !! **)
+
+goalw Ord.thy [lt_def] "i le j <-> i<j | (i=j & Ord(j))";
+by (fast_tac (ZF_cs addSIs [Ord_succ] addSDs [Ord_succD]) 1);
+val le_iff = result();
+
+goal Ord.thy "!!i j. i<j ==> i le j";
+by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1);
+val leI = result();
+
+goal Ord.thy "!!i. [| i=j;  Ord(j) |] ==> i le j";
+by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1);
+val le_eqI = result();
+
+val le_refl = refl RS le_eqI;
+
+val [prem] = goal Ord.thy "(~ (i=j & Ord(j)) ==> i<j) ==> i le j";
+by (rtac (disjCI RS (le_iff RS iffD2)) 1);
+by (etac prem 1);
+val leCI = result();
+
+val major::prems = goal Ord.thy
+    "[| i le j;  i<j ==> P;  [| i=j;  Ord(j) |] ==> P |] ==> P";
+by (rtac (major RS (le_iff RS iffD1 RS disjE)) 1);
+by (DEPTH_SOLVE (ares_tac prems 1 ORELSE etac conjE 1));
+val leE = result();
+
+goal Ord.thy "!!i j. [| i le j;  j le i |] ==> i=j";
+by (asm_full_simp_tac (ZF_ss addsimps [le_iff]) 1);
+by (fast_tac (ZF_cs addEs [lt_anti_sym]) 1);
+val le_asym = result();
+
+goal Ord.thy "i le 0 <-> i=0";
+by (fast_tac (ZF_cs addSIs [Ord_0 RS le_refl] addSEs [leE, lt0E]) 1);
+val le0_iff = result();
+
+val le0D = standard (le0_iff RS iffD1);
+
+val lt_cs = 
+    ZF_cs addSIs [le_refl, leCI]
+          addSDs [le0D]
+          addSEs [lt_anti_refl, lt0E, leE];
+
+
 (*** Natural Deduction rules for Memrel ***)
 
 goalw Ord.thy [Memrel_def] "<a,b> : Memrel(A) <-> a:b & a:A & b:A";
@@ -240,7 +329,7 @@
 (*Finds contradictions for the following proof*)
 val Ord_trans_tac = EVERY' [etac notE, etac Ord_trans, REPEAT o atac];
 
-(** Proving that "member" is a linear ordering on the ordinals **)
+(** Proving that < is a linear ordering on the ordinals **)
 
 val prems = goal Ord.thy
     "Ord(i) ==> (ALL j. Ord(j) --> i:j | i=j | j:i)";
@@ -254,124 +343,123 @@
      ORELSE Ord_trans_tac 1));
 val Ord_linear_lemma = result();
 
-val ordi::ordj::prems = goal Ord.thy
-    "[| Ord(i);  Ord(j);  i:j ==> P;  i=j ==> P;  j:i ==> P |] \
-\    ==> P";
-by (rtac (ordi RS Ord_linear_lemma RS spec RS impE) 1);
-by (rtac ordj 1);
-by (REPEAT (eresolve_tac (prems@[asm_rl,disjE]) 1)); 
-val Ord_linear = result();
+(*The trichotomy law for ordinals!*)
+val ordi::ordj::prems = goalw Ord.thy [lt_def]
+    "[| Ord(i);  Ord(j);  i<j ==> P;  i=j ==> P;  j<i ==> P |] ==> P";
+by (rtac ([ordi,ordj] MRS (Ord_linear_lemma RS spec RS impE)) 1);
+by (REPEAT (FIRSTGOAL (etac disjE)));
+by (DEPTH_SOLVE (ares_tac ([ordi,ordj,conjI] @ prems) 1));
+val Ord_linear_lt = result();
 
 val prems = goal Ord.thy
-    "[| Ord(i);  Ord(j);  i<=j ==> P;  j<=i ==> P |] \
-\    ==> P";
-by (res_inst_tac [("i","i"),("j","j")] Ord_linear 1);
-by (DEPTH_SOLVE (ares_tac (prems@[subset_refl]) 1
-          ORELSE eresolve_tac [asm_rl,OrdmemD,ssubst] 1));
-val Ord_subset = result();
+    "[| Ord(i);  Ord(j);  i le j ==> P;  j le i ==> P |]  ==> P";
+by (res_inst_tac [("i","i"),("j","j")] Ord_linear_lt 1);
+by (DEPTH_SOLVE (ares_tac ([leI,le_eqI] @ prems) 1));
+val Ord_linear_le = result();
+
+goal Ord.thy "!!i j. j le i ==> ~ i<j";
+by (fast_tac (lt_cs addEs [lt_anti_sym]) 1);
+val le_imp_not_lt = result();
 
-goal Ord.thy "!!i j. [| j<=i;  ~ i<=j;  Ord(i);  Ord(j) |] ==> j:i";
-by (etac Ord_linear 1);
-by (REPEAT (ares_tac [subset_refl] 1
-     ORELSE eresolve_tac [notE,OrdmemD,ssubst] 1));
-val Ord_member = result();
+goal Ord.thy "!!i j. [| ~ i<j;  Ord(i);  Ord(j) |] ==> j le i";
+by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
+by (REPEAT (SOMEGOAL assume_tac));
+by (fast_tac (lt_cs addEs [lt_anti_sym]) 1);
+val not_lt_imp_le = result();
 
-val [prem] = goal Ord.thy "Ord(i) ==> 0: succ(i)";
-by (rtac (empty_subsetI RS Ord_member) 1);
-by (fast_tac ZF_cs 1);
-by (rtac (prem RS Ord_succ) 1);
-by (rtac Ord_0 1);
-val Ord_0_in_succ = result();
+goal Ord.thy "!!i j. [| Ord(i);  Ord(j) |] ==> ~ i<j <-> j le i";
+by (REPEAT (ares_tac [iffI, le_imp_not_lt, not_lt_imp_le] 1));
+val not_lt_iff_le = result();
 
-goal Ord.thy "!!i j. [| Ord(i);  Ord(j) |] ==> j:i <-> j<=i & ~(i<=j)";
-by (rtac iffI 1);
-by (rtac conjI 1);
-by (etac OrdmemD 1);
-by (rtac (mem_anti_refl RS notI) 2);
-by (etac subsetD 2);
-by (REPEAT (eresolve_tac [asm_rl, conjE, Ord_member] 1));
-val Ord_member_iff = result();
+goal Ord.thy "!!i j. [| Ord(i);  Ord(j) |] ==> ~ i le j <-> j<i";
+by (asm_simp_tac (ZF_ss addsimps [not_lt_iff_le RS iff_sym]) 1);
+val not_le_iff_lt = result();
+
+goal Ord.thy "!!i. Ord(i) ==> 0 le i";
+by (etac (not_lt_iff_le RS iffD1) 1);
+by (REPEAT (resolve_tac [Ord_0, not_lt0] 1));
+val Ord_0_le = result();
 
-goal Ord.thy "!!i. Ord(i) ==> 0:i  <-> ~ i=0";
-by (etac (Ord_0 RSN (2,Ord_member_iff) RS iff_trans) 1);
-by (fast_tac eq_cs 1);
-val Ord_0_member_iff = result();
-
-(** For ordinals, i: succ(j) means 'less-than or equals' **)
+goal Ord.thy "!!i. [| Ord(i);  ~ i=0 |] ==> 0<i";
+by (etac (not_le_iff_lt RS iffD1) 1);
+by (rtac Ord_0 1);
+by (fast_tac lt_cs 1);
+val Ord_0_lt = result();
 
-goal Ord.thy "!!i j. [| j<=i;  Ord(i);  Ord(j) |] ==> j : succ(i)";
-by (rtac Ord_member 1);
-by (REPEAT (ares_tac [Ord_succ] 3));
-by (rtac (mem_anti_refl RS notI) 2);
-by (etac subsetD 2);
-by (ALLGOALS (fast_tac ZF_cs));
-val member_succI = result();
+(*** Results about less-than or equals ***)
+
+(** For ordinals, j<=i (subset) implies j le i (less-than or equals) **)
 
-(*Recall Ord_succ_subsetI, namely  [| i:j;  Ord(j) |] ==> succ(i) <= j *)
-goalw Ord.thy [Transset_def,Ord_def]
-    "!!i j. [| i : succ(j);  Ord(j) |] ==> i<=j";
-by (fast_tac ZF_cs 1);
-val member_succD = result();
-
-goal Ord.thy "!!i j. [| Ord(i);  Ord(j) |] ==> j:succ(i) <-> j<=i";
-by (fast_tac (subset_cs addSEs [member_succI, member_succD]) 1);
-val member_succ_iff = result();
+goal Ord.thy "!!i j. [| j<=i;  Ord(i);  Ord(j) |] ==> j le i";
+by (rtac (not_lt_iff_le RS iffD1) 1);
+by (assume_tac 1);
+by (assume_tac 1);
+by (fast_tac (ZF_cs addEs [ltE, mem_anti_refl]) 1);
+val subset_imp_le = result();
 
-goal Ord.thy
-    "!!i j. [| Ord(i);  Ord(j) |] ==> i<=succ(j) <-> i<=j | i=succ(j)";
-by (asm_simp_tac (ZF_ss addsimps [member_succ_iff RS iff_sym, Ord_succ]) 1);
-by (fast_tac ZF_cs 1);
-val subset_succ_iff = result();
+goal Ord.thy "!!i j. i le j ==> i<=j";
+by (etac leE 1);
+by (fast_tac ZF_cs 2);
+by (fast_tac (subset_cs addIs [OrdmemD] addEs [ltE]) 1);
+val le_imp_subset = result();
 
-goal Ord.thy "!!i j. [| i:succ(j);  j:k;  Ord(k) |] ==> i:k";
-by (fast_tac (ZF_cs addEs [Ord_trans]) 1);
-val Ord_trans1 = result();
+goal Ord.thy "j le i <-> j<=i & Ord(i) & Ord(j)";
+by (fast_tac (ZF_cs addSEs [subset_imp_le, le_imp_subset]
+	            addEs [ltE, make_elim Ord_succD]) 1);
+val le_subset_iff = result();
+
+goal Ord.thy "i le succ(j) <-> i le j | i=succ(j) & Ord(i)";
+by (simp_tac (ZF_ss addsimps [le_iff]) 1);
+by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1);
+val le_succ_iff = result();
 
-goal Ord.thy "!!i j. [| i:j;  j:succ(k);  Ord(k) |] ==> i:k";
-by (fast_tac (ZF_cs addEs [Ord_trans]) 1);
-val Ord_trans2 = result();
+goal Ord.thy "!!i j. [| i le j;  j<k |] ==> i<k";
+by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1);
+val lt_trans1 = result();
 
-goal Ord.thy "!!i jk. [| i:j;  j<=k;  Ord(k) |] ==> i:k";
-by (fast_tac (ZF_cs addEs [Ord_trans]) 1);
-val Ord_transsub2 = result();
+goal Ord.thy "!!i j. [| i<j;  j le k |] ==> i<k";
+by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1);
+val lt_trans2 = result();
+
+goal Ord.thy "!!i j. [| i le j;  j le k |] ==> i le k";
+by (REPEAT (ares_tac [lt_trans1] 1));
+val le_trans = result();
 
-goal Ord.thy "!!i j. [| i:j;  Ord(j) |] ==> succ(i) : succ(j)";
-by (rtac member_succI 1);
-by (REPEAT (ares_tac [subsetI,Ord_succ,Ord_in_Ord] 1   
-     ORELSE eresolve_tac [succE,Ord_trans,ssubst] 1));
-val succ_mem_succI = result();
+goal Ord.thy "!!i j. i<j ==> succ(i) le j";
+by (rtac (not_lt_iff_le RS iffD1) 1);
+by (fast_tac (lt_cs addEs [lt_anti_sym]) 3);
+by (ALLGOALS (fast_tac (ZF_cs addEs [ltE] addIs [Ord_succ])));
+val succ_leI = result();
 
-goal Ord.thy "!!i j. [| succ(i) : succ(j);  Ord(j) |] ==> i:j";
-by (REPEAT (eresolve_tac [asm_rl, make_elim member_succD, succ_subsetE] 1));
-val succ_mem_succE = result();
+goal Ord.thy "!!i j. succ(i) le j ==> i<j";
+by (rtac (not_le_iff_lt RS iffD1) 1);
+by (fast_tac (lt_cs addEs [lt_anti_sym]) 3);
+by (ALLGOALS (fast_tac (ZF_cs addEs [ltE, make_elim Ord_succD])));
+val succ_leE = result();
 
-goal Ord.thy "!!i j. Ord(j) ==> succ(i) : succ(j) <-> i:j";
-by (REPEAT (ares_tac [iffI,succ_mem_succI,succ_mem_succE] 1));
-val succ_mem_succ_iff = result();
-
-goal Ord.thy "!!i j. [| i<=j;  Ord(i);  Ord(j) |] ==> succ(i) <= succ(j)";
-by (rtac (member_succI RS succ_mem_succI RS member_succD) 1);
-by (REPEAT (ares_tac [Ord_succ] 1));
-val Ord_succ_mono = result();
+goal Ord.thy "succ(i) le j <-> i<j";
+by (REPEAT (ares_tac [iffI,succ_leI,succ_leE] 1));
+val succ_le_iff = result();
 
 (** Union and Intersection **)
 
-goal Ord.thy "!!i j k. [| i:k;  j:k;  Ord(k) |] ==> i Un j : k";
-by (res_inst_tac [("i","i"),("j","j")] Ord_subset 1);
-by (REPEAT (eresolve_tac [asm_rl, Ord_in_Ord] 1));
-by (asm_simp_tac (ZF_ss addsimps [subset_Un_iff RS iffD1]) 1);
-by (rtac (Un_commute RS ssubst) 1);
-by (asm_simp_tac (ZF_ss addsimps [subset_Un_iff RS iffD1]) 1);
-val Ord_member_UnI = result();
+(*Replacing k by succ(k') yields the similar rule for le!*)
+goal Ord.thy "!!i j k. [| i<k;  j<k |] ==> i Un j < k";
+by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
+by (rtac (Un_commute RS ssubst) 4);
+by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 4);
+by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 3);
+by (REPEAT (eresolve_tac [asm_rl, ltE] 1));
+val Un_least_lt = result();
 
-goal Ord.thy "!!i j k. [| i:k;  j:k;  Ord(k) |] ==> i Int j : k";
-by (res_inst_tac [("i","i"),("j","j")] Ord_subset 1);
-by (REPEAT (eresolve_tac [asm_rl, Ord_in_Ord] 1));
-by (asm_simp_tac (ZF_ss addsimps [subset_Int_iff RS iffD1]) 1);
-by (rtac (Int_commute RS ssubst) 1);
-by (asm_simp_tac (ZF_ss addsimps [subset_Int_iff RS iffD1]) 1);
-val Ord_member_IntI = result();
-
+(*Replacing k by succ(k') yields the similar rule for le!*)
+goal Ord.thy "!!i j k. [| i<k;  j<k |] ==> i Int j < k";
+by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
+by (rtac (Int_commute RS ssubst) 4);
+by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 4);
+by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 3);
+by (REPEAT (eresolve_tac [asm_rl, ltE] 1));
+val Int_greatest_lt = result();
 
 (*** Results about limits ***)
 
@@ -387,24 +475,29 @@
 by (eresolve_tac prems 1);
 val Ord_UN = result();
 
-(*The upper bound must be a successor ordinal --
-  consider that (UN i:nat.i)=nat although nat is an upper bound of each i*)
+(* No < version; consider (UN i:nat.i)=nat *)
 val [ordi,limit] = goal Ord.thy
-    "[| Ord(i);  !!y. y:A ==> f(y): succ(i) |] ==> (UN y:A. f(y)) : succ(i)";
-by (rtac (member_succD RS UN_least RS member_succI) 1);
-by (REPEAT (ares_tac [ordi, Ord_UN, ordi RS Ord_succ RS Ord_in_Ord,
-		      limit] 1));
-val sup_least = result();
+    "[| Ord(i);  !!x. x:A ==> b(x) le i |] ==> (UN x:A. b(x)) le i";
+by (rtac (le_imp_subset RS UN_least RS subset_imp_le) 1);
+by (REPEAT (ares_tac [ordi, Ord_UN, limit] 1 ORELSE etac (limit RS ltE) 1));
+val UN_least_le = result();
 
-val [jmemi,ordi,limit] = goal Ord.thy
-    "[| j: i;  Ord(i);  !!y. y:A ==> f(y): j |] ==> (UN y:A. succ(f(y))) : i";
-by (cut_facts_tac [jmemi RS (ordi RS Ord_in_Ord)] 1);
-by (rtac (sup_least RS Ord_trans2) 1);
-by (REPEAT (ares_tac [jmemi, ordi, succ_mem_succI, limit] 1));
-val sup_least2 = result();
+val [jlti,limit] = goal Ord.thy
+    "[| j<i;  !!x. x:A ==> b(x)<j |] ==> (UN x:A. succ(b(x))) < i";
+by (rtac (jlti RS ltE) 1);
+by (rtac (UN_least_le RS lt_trans2) 1);
+by (REPEAT (ares_tac [jlti, succ_leI, limit] 1));
+val UN_succ_least_lt = result();
+
+val prems = goal Ord.thy
+    "[| a: A;  i le b(a);  !!x. x:A ==> Ord(b(x)) |] ==> i le (UN x:A. b(x))";
+by (resolve_tac (prems RL [ltE]) 1);
+by (rtac (le_imp_subset RS subset_trans RS subset_imp_le) 1);
+by (REPEAT (ares_tac (prems @ [UN_upper, Ord_UN]) 1));
+val UN_upper_le = result();
 
 goal Ord.thy "!!i. Ord(i) ==> (UN y:i. succ(y)) = i";
-by (fast_tac (eq_cs addSEs [Ord_trans1]) 1);
+by (fast_tac (eq_cs addEs [Ord_trans]) 1);
 val Ord_equality = result();
 
 (*Holds for all transitive sets, not just ordinals*)