# HG changeset patch # User paulson # Date 1331745570 0 # Node ID 571ce2bc0b64994555273eee440e939e5479a253 # Parent 89cc3dfb383bcb9750091cd48421b1812c0e97f6# Parent 38ecb2dc3636ca9c4198c4db133e89803ae31ad8 merged diff -r 89cc3dfb383b -r 571ce2bc0b64 src/ZF/Cardinal.thy --- a/src/ZF/Cardinal.thy Wed Mar 14 17:40:00 2012 +0100 +++ b/src/ZF/Cardinal.thy Wed Mar 14 17:19:30 2012 +0000 @@ -540,15 +540,21 @@ done -lemma nat_lepoll_imp_le [rule_format]: - "m \ nat ==> \n\nat. m \ n \ m \ n" -apply (induct_tac m) -apply (blast intro!: nat_0_le) -apply (rule ballI) -apply (erule_tac n = n in natE) -apply (simp (no_asm_simp) add: lepoll_def inj_def) -apply (blast intro!: succ_leI dest!: succ_lepoll_succD) -done +lemma nat_lepoll_imp_le: + "m \ nat ==> n \ nat \ m \ n \ m \ n" +proof (induct m arbitrary: n rule: nat_induct) + case 0 thus ?case by (blast intro!: nat_0_le) +next + case (succ m) + show ?case using `n \ nat` + proof (cases rule: natE) + case 0 thus ?thesis using succ + by (simp add: lepoll_def inj_def) + next + case (succ n') thus ?thesis using succ.hyps ` succ(m) \ n` + by (blast intro!: succ_leI dest!: succ_lepoll_succD) + qed +qed lemma nat_eqpoll_iff: "[| m \ nat; n: nat |] ==> m \ n \ m = n" apply (rule iffI) diff -r 89cc3dfb383b -r 571ce2bc0b64 src/ZF/CardinalArith.thy --- a/src/ZF/CardinalArith.thy Wed Mar 14 17:40:00 2012 +0100 +++ b/src/ZF/CardinalArith.thy Wed Mar 14 17:19:30 2012 +0000 @@ -628,28 +628,25 @@ assumes IK: "InfCard(K)" shows "InfCard(K) ==> K \ K = K" proof - have OK: "Ord(K)" using IK by (simp add: Card_is_Ord InfCard_is_Card) - have "InfCard(K) \ K \ K = K" - proof (rule trans_induct [OF OK], rule impI) - fix i - assume i: "Ord(i)" "InfCard(i)" - and ih: " \y\i. InfCard(y) \ y \ y = y" - show "i \ i = i" - proof (rule le_anti_sym) - have "|i \ i| = |ordertype(i \ i, csquare_rel(i))|" - by (rule cardinal_cong, - simp add: i well_ord_csquare [THEN ordermap_bij, THEN bij_imp_eqpoll]) - hence "i \ i \ ordertype(i \ i, csquare_rel(i))" using i - by (simp add: cmult_def Ord_cardinal_le well_ord_csquare [THEN Ord_ordertype]) - moreover - have "ordertype(i \ i, csquare_rel(i)) \ i" using ih i - by (simp add: ordertype_csquare_le) - ultimately show "i \ i \ i" by (rule le_trans) - next - show "i \ i \ i" using i - by (blast intro: cmult_square_le InfCard_is_Card) - qed + show "InfCard(K) ==> K \ K = K" using OK + proof (induct rule: trans_induct) + case (step i) + show "i \ i = i" + proof (rule le_anti_sym) + have "|i \ i| = |ordertype(i \ i, csquare_rel(i))|" + by (rule cardinal_cong, + simp add: step.hyps well_ord_csquare [THEN ordermap_bij, THEN bij_imp_eqpoll]) + hence "i \ i \ ordertype(i \ i, csquare_rel(i))" + by (simp add: step.hyps cmult_def Ord_cardinal_le well_ord_csquare [THEN Ord_ordertype]) + moreover + have "ordertype(i \ i, csquare_rel(i)) \ i" using step + by (simp add: ordertype_csquare_le) + ultimately show "i \ i \ i" by (rule le_trans) + next + show "i \ i \ i" using step + by (blast intro: cmult_square_le InfCard_is_Card) qed - thus ?thesis using IK .. + qed qed (*Corollary for arbitrary well-ordered sets (all sets, assuming AC)*) @@ -910,10 +907,15 @@ finally show ?thesis . qed -lemma Ord_subset_natD [rule_format]: "Ord(i) ==> i \ nat \ i \ nat | i=nat" -apply (erule trans_induct3, auto) -apply (blast dest!: nat_le_Limit [THEN le_imp_subset]) -done +lemma Ord_subset_natD [rule_format]: "Ord(i) ==> i \ nat \ i \ nat | i=nat" +proof (induct i rule: trans_induct3) + case 0 thus ?case by auto +next + case (succ i) thus ?case by auto +next + case (limit l) thus ?case + by (blast dest: nat_le_Limit le_imp_subset) +qed lemma Ord_nat_subset_into_Card: "[| Ord(i); i \ nat |] ==> Card(i)" by (blast dest: Ord_subset_natD intro: Card_nat nat_into_Card) diff -r 89cc3dfb383b -r 571ce2bc0b64 src/ZF/Nat_ZF.thy --- a/src/ZF/Nat_ZF.thy Wed Mar 14 17:40:00 2012 +0100 +++ b/src/ZF/Nat_ZF.thy Wed Mar 14 17:19:30 2012 +0000 @@ -87,14 +87,16 @@ (*Mathematical induction*) lemma nat_induct [case_names 0 succ, induct set: nat]: - "[| n: nat; P(0); !!x. [| x: nat; P(x) |] ==> P(succ(x)) |] ==> P(n)" + "[| n \ nat; P(0); !!x. [| x: nat; P(x) |] ==> P(succ(x)) |] ==> P(n)" by (erule def_induct [OF nat_def nat_bnd_mono], blast) lemma natE: - "[| n: nat; n=0 ==> P; !!x. [| x: nat; n=succ(x) |] ==> P |] ==> P" -by (erule nat_unfold [THEN equalityD1, THEN subsetD, THEN UnE], auto) + assumes "n \ nat" + obtains (0) "n=0" | (succ) x where "x \ nat" "n=succ(x)" +using assms +by (rule nat_unfold [THEN equalityD1, THEN subsetD, THEN UnE]) auto -lemma nat_into_Ord [simp]: "n: nat ==> Ord(n)" +lemma nat_into_Ord [simp]: "n \ nat ==> Ord(n)" by (erule nat_induct, auto) (* @{term"i: nat ==> 0 \ i"}; same thing as @{term"0 i: nat" by (rule Ord_trans [OF succI1], auto) -lemma nat_succ_iff [iff]: "succ(n): nat \ n: nat" +lemma nat_succ_iff [iff]: "succ(n): nat \ n \ nat" by (blast dest!: succ_natD) lemma nat_le_Limit: "Limit(i) ==> nat \ i" @@ -138,7 +140,7 @@ (* [| succ(i): k; k: nat |] ==> i: k *) lemmas succ_in_naturalD = Ord_trans [OF succI1 _ nat_into_Ord] -lemma lt_nat_in_nat: "[| m m: nat" +lemma lt_nat_in_nat: "[| m nat |] ==> m: nat" apply (erule ltE) apply (erule Ord_trans, assumption, simp) done @@ -158,7 +160,7 @@ lemma nat_induct_from_lemma [rule_format]: - "[| n: nat; m: nat; + "[| n \ nat; m: nat; !!x. [| x: nat; m \ x; P(x) |] ==> P(succ(x)) |] ==> m \ n \ P(m) \ P(n)" apply (erule nat_induct) @@ -167,7 +169,7 @@ (*Induction starting from m rather than 0*) lemma nat_induct_from: - "[| m \ n; m: nat; n: nat; + "[| m \ n; m: nat; n \ nat; P(m); !!x. [| x: nat; m \ x; P(x) |] ==> P(succ(x)) |] ==> P(n)" @@ -176,7 +178,7 @@ (*Induction suitable for subtraction and less-than*) lemma diff_induct [case_names 0 0_succ succ_succ, consumes 2]: - "[| m: nat; n: nat; + "[| m: nat; n \ nat; !!x. x: nat ==> P(x,0); !!y. y: nat ==> P(0,succ(y)); !!x y. [| x: nat; y: nat; P(x,y) |] ==> P(succ(x),succ(y)) |] @@ -201,7 +203,7 @@ done lemma succ_lt_induct: - "[| m nat; P(m,succ(m)); !!x. [| x: nat; P(m,x) |] ==> P(m,succ(x)) |] ==> P(m,n)" @@ -241,7 +243,7 @@ by (simp add: nat_case_def) lemma nat_case_type [TC]: - "[| n: nat; a: C(0); !!m. m: nat ==> b(m): C(succ(m)) |] + "[| n \ nat; a: C(0); !!m. m: nat ==> b(m): C(succ(m)) |] ==> nat_case(a,b,n) \ C(n)"; by (erule nat_induct, auto) diff -r 89cc3dfb383b -r 571ce2bc0b64 src/ZF/Ordinal.thy --- a/src/ZF/Ordinal.thy Wed Mar 14 17:40:00 2012 +0100 +++ b/src/ZF/Ordinal.thy Wed Mar 14 17:19:30 2012 +0000 @@ -236,7 +236,7 @@ done -(** Recall that @{term"i \ j"} abbreviates @{term"i j"} abbreviates @{term"i j <-> iy\x. P(y) |] ==> P(x) |] ==> P(i)" @@ -348,10 +347,8 @@ apply (blast intro: Ord_succ [THEN Ord_in_Ord]) done -lemmas trans_induct_rule = trans_induct [rule_format, consumes 1] - -(*** Fundamental properties of the epsilon ordering (< on ordinals) ***) +section{*Fundamental properties of the epsilon ordering (< on ordinals)*} subsubsection{*Proving That < is a Linear Ordering on the Ordinals*} @@ -364,23 +361,27 @@ apply (blast dest: Ord_trans) done -(*The trichotomy law for ordinals!*) +text{*The trichotomy law for ordinals*} lemma Ord_linear_lt: - "[| Ord(i); Ord(j); i P; i=j ==> P; j P |] ==> P" + assumes o: "Ord(i)" "Ord(j)" + obtains (lt) "i P; j \ i ==> P |] ==> P" + assumes o: "Ord(i)" "Ord(j)" + obtains (lt) "i i" apply (rule_tac i = i and j = j in Ord_linear_lt) -apply (blast intro: leI le_eqI sym ) + +apply (blast intro: leI le_eqI sym o) + done lemma Ord_linear_le: - "[| Ord(i); Ord(j); i \ j ==> P; j \ i ==> P |] ==> P" + assumes o: "Ord(i)" "Ord(j)" + obtains (le) "i \ j" | (ge) "j \ i" apply (rule_tac i = i and j = j in Ord_linear_lt) -apply (blast intro: leI le_eqI ) + +apply (blast intro: leI le_eqI o) + done lemma le_imp_not_lt: "j \ i ==> ~ i P; - !!j. [| Ord(j); i=succ(j) |] ==> P; - Limit(i) ==> P - |] ==> P" -by (drule Ord_cases_disj, blast) + assumes i: "Ord(i)" + obtains (0) "i=0" | (succ) j where "Ord(j)" "i=succ(j)" | (limit) "Limit(i)" +by (insert Ord_cases_disj [OF i], auto) lemma trans_induct3_raw: "[| Ord(i); diff -r 89cc3dfb383b -r 571ce2bc0b64 src/ZF/ex/LList.thy --- a/src/ZF/ex/LList.thy Wed Mar 14 17:40:00 2012 +0100 +++ b/src/ZF/ex/LList.thy Wed Mar 14 17:19:30 2012 +0000 @@ -106,15 +106,22 @@ declare qunivD [dest!] declare Ord_in_Ord [elim!] -lemma llist_quniv_lemma [rule_format]: - "Ord(i) ==> \l \ llist(quniv(A)). l \ Vset(i) \ univ(eclose(A))" -apply (erule trans_induct) -apply (rule ballI) -apply (erule llist.cases) -apply (simp_all add: QInl_def QInr_def llist.con_defs) -(*LCons case: I simply can't get rid of the deepen_tac*) -apply (deepen 2 intro: Ord_trans Int_lower1 [THEN subset_trans]) -done +lemma llist_quniv_lemma: + "Ord(i) ==> l \ llist(quniv(A)) \ l \ Vset(i) \ univ(eclose(A))" +proof (induct i arbitrary: l rule: trans_induct) + case (step i l) + show ?case using `l \ llist(quniv(A))` + proof (cases l rule: llist.cases) + case LNil thus ?thesis + by (simp add: QInl_def QInr_def llist.con_defs) + next + case (LCons a l) thus ?thesis using step.hyps + proof (simp add: QInl_def QInr_def llist.con_defs) + show "<1; > \ Vset(i) \ univ(eclose(A))" using LCons `Ord(i)` + by (fast intro: step Ord_trans Int_lower1 [THEN subset_trans]) + qed + qed +qed lemma llist_quniv: "llist(quniv(A)) \ quniv(A)" apply (rule qunivI [THEN subsetI]) @@ -134,14 +141,19 @@ declare Ord_in_Ord [elim!] (*Lemma for proving finality. Unfold the lazy list; use induction hypothesis*) -lemma lleq_Int_Vset_subset [rule_format]: - "Ord(i) ==> \l l'. \ lleq(A) \ l \ Vset(i) \ l'" -apply (erule trans_induct) -apply (intro allI impI) -apply (erule lleq.cases) -apply (unfold QInr_def llist.con_defs, safe) -apply (fast elim!: Ord_trans bspec [elim_format]) -done +lemma lleq_Int_Vset_subset: + "Ord(i) ==> \ lleq(A) \ l \ Vset(i) \ l'" +proof (induct i arbitrary: l l' rule: trans_induct) + case (step i l l') + show ?case using `\l, l'\ \ lleq(A)` + proof (cases rule: lleq.cases) + case LNil thus ?thesis + by (auto simp add: QInr_def llist.con_defs) + next + case (LCons a l l') thus ?thesis using step.hyps + by (auto simp add: QInr_def llist.con_defs intro: Ord_trans) + qed +qed (*lleq(A) is a symmetric relation because qconverse(lleq(A)) is a fixedpoint*) lemma lleq_symmetric: " \ lleq(A) ==> \ lleq(A)" @@ -208,15 +220,22 @@ (*Reasoning borrowed from lleq.ML; a similar proof works for all "productive" functions -- cf Coquand's "Infinite Objects in Type Theory".*) -lemma flip_llist_quniv_lemma [rule_format]: - "Ord(i) ==> \l \ llist(bool). flip(l) \ Vset(i) \ univ(eclose(bool))" -apply (erule trans_induct) -apply (rule ballI) -apply (erule llist.cases, simp_all) -apply (simp_all add: QInl_def QInr_def llist.con_defs) -(*LCons case: I simply can't get rid of the deepen_tac*) -apply (deepen 2 intro: Ord_trans Int_lower1 [THEN subset_trans]) -done +lemma flip_llist_quniv_lemma: + "Ord(i) ==> l \ llist(bool) \ flip(l) \ Vset(i) \ univ(eclose(bool))" +proof (induct i arbitrary: l rule: trans_induct) + case (step i l) + show ?case using `l \ llist(bool)` + proof (cases l rule: llist.cases) + case LNil thus ?thesis + by (simp, simp add: QInl_def QInr_def llist.con_defs) + next + case (LCons a l) thus ?thesis using step.hyps + proof (simp, simp add: QInl_def QInr_def llist.con_defs) + show "<1; > \ Vset(i) \ univ(eclose(bool))" using LCons step.hyps + by (auto intro: Ord_trans) + qed + qed +qed lemma flip_in_quniv: "l \ llist(bool) ==> flip(l) \ quniv(bool)" by (rule flip_llist_quniv_lemma [THEN Int_Vset_subset, THEN qunivI], assumption+)