src/ZF/OrderArith.thy
 changeset 46820 c656222c4dc1 parent 35762 af3ff2ba4c54 child 46821 ff6b0c1087f2
```     1.1 --- a/src/ZF/OrderArith.thy	Sun Mar 04 23:20:43 2012 +0100
1.2 +++ b/src/ZF/OrderArith.thy	Tue Mar 06 15:15:49 2012 +0000
1.3 @@ -12,22 +12,22 @@
1.6                  {z: (A+B) * (A+B).
1.7 -                    (EX x y. z = <Inl(x), Inr(y)>)   |
1.8 -                    (EX x' x. z = <Inl(x'), Inl(x)> & <x',x>:r)   |
1.9 -                    (EX y' y. z = <Inr(y'), Inr(y)> & <y',y>:s)}"
1.10 +                    (\<exists>x y. z = <Inl(x), Inr(y)>)   |
1.11 +                    (\<exists>x' x. z = <Inl(x'), Inl(x)> & <x',x>:r)   |
1.12 +                    (\<exists>y' y. z = <Inr(y'), Inr(y)> & <y',y>:s)}"
1.13
1.14  definition
1.15    (*lexicographic product of two relations; underlies ordinal multiplication*)
1.16    rmult   :: "[i,i,i,i]=>i"  where
1.17      "rmult(A,r,B,s) ==
1.18                  {z: (A*B) * (A*B).
1.19 -                    EX x' y' x y. z = <<x',y'>, <x,y>> &
1.20 +                    \<exists>x' y' x y. z = <<x',y'>, <x,y>> &
1.21                         (<x',x>: r | (x'=x & <y',y>: s))}"
1.22
1.23  definition
1.24    (*inverse image of a relation*)
1.25    rvimage :: "[i,i,i]=>i"  where
1.26 -    "rvimage(A,f,r) == {z: A*A. EX x y. z = <x,y> & <f`x,f`y>: r}"
1.27 +    "rvimage(A,f,r) == {z: A*A. \<exists>x y. z = <x,y> & <f`x,f`y>: r}"
1.28
1.29  definition
1.30    measure :: "[i, i\<Rightarrow>i] \<Rightarrow> i"  where
1.31 @@ -39,19 +39,19 @@
1.32  subsubsection{*Rewrite rules.  Can be used to obtain introduction rules*}
1.33
1.35 -    "<Inl(a), Inr(b)> : radd(A,r,B,s)  <->  a:A & b:B"
1.36 +    "<Inl(a), Inr(b)> \<in> radd(A,r,B,s)  <->  a:A & b:B"
1.38
1.40 -    "<Inl(a'), Inl(a)> : radd(A,r,B,s)  <->  a':A & a:A & <a',a>:r"
1.41 +    "<Inl(a'), Inl(a)> \<in> radd(A,r,B,s)  <->  a':A & a:A & <a',a>:r"
1.43
1.45 -    "<Inr(b'), Inr(b)> : radd(A,r,B,s) <->  b':B & b:B & <b',b>:s"
1.46 +    "<Inr(b'), Inr(b)> \<in> radd(A,r,B,s) <->  b':B & b:B & <b',b>:s"
1.48
1.50 -    "<Inr(b), Inl(a)> : radd(A,r,B,s) <-> False"
1.51 +    "<Inr(b), Inl(a)> \<in> radd(A,r,B,s) <-> False"
1.53
1.54  declare radd_Inr_Inl_iff [THEN iffD1, dest!]
1.55 @@ -59,7 +59,7 @@
1.56  subsubsection{*Elimination Rule*}
1.57
1.59 -    "[| <p',p> : radd(A,r,B,s);
1.60 +    "[| <p',p> \<in> radd(A,r,B,s);
1.61          !!x y. [| p'=Inl(x); x:A; p=Inr(y); y:B |] ==> Q;
1.62          !!x' x. [| p'=Inl(x'); p=Inl(x); <x',x>: r; x':A; x:A |] ==> Q;
1.63          !!y' y. [| p'=Inr(y'); p=Inr(y); <y',y>: s; y':B; y:B |] ==> Q
1.64 @@ -68,7 +68,7 @@
1.65
1.66  subsubsection{*Type checking*}
1.67
1.71  apply (rule Collect_subset)
1.72  done
1.73 @@ -86,10 +86,10 @@
1.74
1.76  apply (rule wf_onI2)
1.77 -apply (subgoal_tac "ALL x:A. Inl (x) : Ba")
1.78 +apply (subgoal_tac "\<forall>x\<in>A. Inl (x) \<in> Ba")
1.79   --{*Proving the lemma, which is needed twice!*}
1.80   prefer 2
1.81 - apply (erule_tac V = "y : A + B" in thin_rl)
1.82 + apply (erule_tac V = "y \<in> A + B" in thin_rl)
1.83   apply (rule_tac ballI)
1.84   apply (erule_tac r = r and a = x in wf_on_induct, assumption)
1.85   apply blast
1.86 @@ -116,7 +116,7 @@
1.87
1.88  lemma sum_bij:
1.89       "[| f: bij(A,C);  g: bij(B,D) |]
1.90 -      ==> (lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z)) : bij(A+B, C+D)"
1.91 +      ==> (\<lambda>z\<in>A+B. case(%x. Inl(f`x), %y. Inr(g`y), z)) \<in> bij(A+B, C+D)"
1.92  apply (rule_tac d = "case (%x. Inl (converse(f)`x), %y. Inr(converse(g)`y))"
1.93         in lam_bijective)
1.94  apply (typecheck add: bij_is_inj inj_is_fun)
1.95 @@ -125,8 +125,8 @@
1.96
1.97  lemma sum_ord_iso_cong:
1.98      "[| f: ord_iso(A,r,A',r');  g: ord_iso(B,s,B',s') |] ==>
1.99 -            (lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z))
1.101 +            (\<lambda>z\<in>A+B. case(%x. Inl(f`x), %y. Inr(g`y), z))
1.103  apply (unfold ord_iso_def)
1.104  apply (safe intro!: sum_bij)
1.105  (*Do the beta-reductions now*)
1.106 @@ -134,9 +134,9 @@
1.107  done
1.108
1.109  (*Could we prove an ord_iso result?  Perhaps
1.110 -     ord_iso(A+B, radd(A,r,B,s), A Un B, r Un s) *)
1.111 -lemma sum_disjoint_bij: "A Int B = 0 ==>
1.112 -            (lam z:A+B. case(%x. x, %y. y, z)) : bij(A+B, A Un B)"
1.113 +     ord_iso(A+B, radd(A,r,B,s), A \<union> B, r \<union> s) *)
1.114 +lemma sum_disjoint_bij: "A \<inter> B = 0 ==>
1.115 +            (\<lambda>z\<in>A+B. case(%x. x, %y. y, z)) \<in> bij(A+B, A \<union> B)"
1.116  apply (rule_tac d = "%z. if z:A then Inl (z) else Inr (z) " in lam_bijective)
1.117  apply auto
1.118  done
1.119 @@ -144,16 +144,16 @@
1.120  subsubsection{*Associativity*}
1.121
1.122  lemma sum_assoc_bij:
1.123 -     "(lam z:(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z))
1.124 -      : bij((A+B)+C, A+(B+C))"
1.125 +     "(\<lambda>z\<in>(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z))
1.126 +      \<in> bij((A+B)+C, A+(B+C))"
1.127  apply (rule_tac d = "case (%x. Inl (Inl (x)), case (%x. Inl (Inr (x)), Inr))"
1.128         in lam_bijective)
1.129  apply auto
1.130  done
1.131
1.132  lemma sum_assoc_ord_iso:
1.133 -     "(lam z:(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z))
1.135 +     "(\<lambda>z\<in>(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z))
1.138  by (rule sum_assoc_bij [THEN ord_isoI], auto)
1.139
1.140 @@ -163,14 +163,14 @@
1.141  subsubsection{*Rewrite rule.  Can be used to obtain introduction rules*}
1.142
1.143  lemma  rmult_iff [iff]:
1.144 -    "<<a',b'>, <a,b>> : rmult(A,r,B,s) <->
1.145 +    "<<a',b'>, <a,b>> \<in> rmult(A,r,B,s) <->
1.146              (<a',a>: r  & a':A & a:A & b': B & b: B) |
1.147              (<b',b>: s  & a'=a & a:A & b': B & b: B)"
1.148
1.149  by (unfold rmult_def, blast)
1.150
1.151  lemma rmultE:
1.152 -    "[| <<a',b'>, <a,b>> : rmult(A,r,B,s);
1.153 +    "[| <<a',b'>, <a,b>> \<in> rmult(A,r,B,s);
1.154          [| <a',a>: r;  a':A;  a:A;  b':B;  b:B |] ==> Q;
1.155          [| <b',b>: s;  a:A;  a'=a;  b':B;  b:B |] ==> Q
1.156       |] ==> Q"
1.157 @@ -178,7 +178,7 @@
1.158
1.159  subsubsection{*Type checking*}
1.160
1.161 -lemma rmult_type: "rmult(A,r,B,s) <= (A*B) * (A*B)"
1.162 +lemma rmult_type: "rmult(A,r,B,s) \<subseteq> (A*B) * (A*B)"
1.163  by (unfold rmult_def, rule Collect_subset)
1.164
1.165  lemmas field_rmult = rmult_type [THEN field_rel_subset]
1.166 @@ -195,7 +195,7 @@
1.167  apply (rule wf_onI2)
1.168  apply (erule SigmaE)
1.169  apply (erule ssubst)
1.170 -apply (subgoal_tac "ALL b:B. <x,b>: Ba", blast)
1.171 +apply (subgoal_tac "\<forall>b\<in>B. <x,b>: Ba", blast)
1.172  apply (erule_tac a = x in wf_on_induct, assumption)
1.173  apply (rule ballI)
1.174  apply (erule_tac a = b in wf_on_induct, assumption)
1.175 @@ -221,7 +221,7 @@
1.176
1.177  lemma prod_bij:
1.178       "[| f: bij(A,C);  g: bij(B,D) |]
1.179 -      ==> (lam <x,y>:A*B. <f`x, g`y>) : bij(A*B, C*D)"
1.180 +      ==> (lam <x,y>:A*B. <f`x, g`y>) \<in> bij(A*B, C*D)"
1.181  apply (rule_tac d = "%<x,y>. <converse (f) `x, converse (g) `y>"
1.182         in lam_bijective)
1.183  apply (typecheck add: bij_is_inj inj_is_fun)
1.184 @@ -231,20 +231,20 @@
1.185  lemma prod_ord_iso_cong:
1.186      "[| f: ord_iso(A,r,A',r');  g: ord_iso(B,s,B',s') |]
1.187       ==> (lam <x,y>:A*B. <f`x, g`y>)
1.188 -         : ord_iso(A*B, rmult(A,r,B,s), A'*B', rmult(A',r',B',s'))"
1.189 +         \<in> ord_iso(A*B, rmult(A,r,B,s), A'*B', rmult(A',r',B',s'))"
1.190  apply (unfold ord_iso_def)
1.191  apply (safe intro!: prod_bij)
1.192  apply (simp_all add: bij_is_fun [THEN apply_type])
1.193  apply (blast intro: bij_is_inj [THEN inj_apply_equality])
1.194  done
1.195
1.196 -lemma singleton_prod_bij: "(lam z:A. <x,z>) : bij(A, {x}*A)"
1.197 +lemma singleton_prod_bij: "(\<lambda>z\<in>A. <x,z>) \<in> bij(A, {x}*A)"
1.198  by (rule_tac d = snd in lam_bijective, auto)
1.199
1.200  (*Used??*)
1.201  lemma singleton_prod_ord_iso:
1.202       "well_ord({x},xr) ==>
1.203 -          (lam z:A. <x,z>) : ord_iso(A, r, {x}*A, rmult({x}, xr, A, r))"
1.204 +          (\<lambda>z\<in>A. <x,z>) \<in> ord_iso(A, r, {x}*A, rmult({x}, xr, A, r))"
1.205  apply (rule singleton_prod_bij [THEN ord_isoI])
1.206  apply (simp (no_asm_simp))
1.207  apply (blast dest: well_ord_is_wf [THEN wf_on_not_refl])
1.208 @@ -253,9 +253,9 @@
1.209  (*Here we build a complicated function term, then simplify it using
1.210    case_cong, id_conv, comp_lam, case_case.*)
1.211  lemma prod_sum_singleton_bij:
1.212 -     "a~:C ==>
1.213 -       (lam x:C*B + D. case(%x. x, %y.<a,y>, x))
1.214 -       : bij(C*B + D, C*B Un {a}*D)"
1.215 +     "a\<notin>C ==>
1.216 +       (\<lambda>x\<in>C*B + D. case(%x. x, %y.<a,y>, x))
1.217 +       \<in> bij(C*B + D, C*B \<union> {a}*D)"
1.218  apply (rule subst_elem)
1.219  apply (rule id_bij [THEN sum_bij, THEN comp_bij])
1.220  apply (rule singleton_prod_bij)
1.221 @@ -268,10 +268,10 @@
1.222
1.223  lemma prod_sum_singleton_ord_iso:
1.224   "[| a:A;  well_ord(A,r) |] ==>
1.225 -    (lam x:pred(A,a,r)*B + pred(B,b,s). case(%x. x, %y.<a,y>, x))
1.226 -    : ord_iso(pred(A,a,r)*B + pred(B,b,s),
1.227 +    (\<lambda>x\<in>pred(A,a,r)*B + pred(B,b,s). case(%x. x, %y.<a,y>, x))
1.228 +    \<in> ord_iso(pred(A,a,r)*B + pred(B,b,s),
1.230 -              pred(A,a,r)*B Un {a}*pred(B,b,s), rmult(A,r,B,s))"
1.231 +              pred(A,a,r)*B \<union> {a}*pred(B,b,s), rmult(A,r,B,s))"
1.232  apply (rule prod_sum_singleton_bij [THEN ord_isoI])
1.233  apply (simp (no_asm_simp) add: pred_iff well_ord_is_wf [THEN wf_on_not_refl])
1.234  apply (auto elim!: well_ord_is_wf [THEN wf_on_asym] predE)
1.235 @@ -281,25 +281,25 @@
1.236
1.237  lemma sum_prod_distrib_bij:
1.238       "(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x))
1.239 -      : bij((A+B)*C, (A*C)+(B*C))"
1.240 +      \<in> bij((A+B)*C, (A*C)+(B*C))"
1.241  by (rule_tac d = "case (%<x,y>.<Inl (x),y>, %<x,y>.<Inr (x),y>) "
1.242      in lam_bijective, auto)
1.243
1.244  lemma sum_prod_distrib_ord_iso:
1.245   "(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x))
1.246 -  : ord_iso((A+B)*C, rmult(A+B, radd(A,r,B,s), C, t),
1.247 +  \<in> ord_iso((A+B)*C, rmult(A+B, radd(A,r,B,s), C, t),
1.248              (A*C)+(B*C), radd(A*C, rmult(A,r,C,t), B*C, rmult(B,s,C,t)))"
1.249  by (rule sum_prod_distrib_bij [THEN ord_isoI], auto)
1.250
1.251  subsubsection{*Associativity*}
1.252
1.253  lemma prod_assoc_bij:
1.254 -     "(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) : bij((A*B)*C, A*(B*C))"
1.255 +     "(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) \<in> bij((A*B)*C, A*(B*C))"
1.256  by (rule_tac d = "%<x, <y,z>>. <<x,y>, z>" in lam_bijective, auto)
1.257
1.258  lemma prod_assoc_ord_iso:
1.259   "(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>)
1.260 -  : ord_iso((A*B)*C, rmult(A*B, rmult(A,r,B,s), C, t),
1.261 +  \<in> ord_iso((A*B)*C, rmult(A*B, rmult(A,r,B,s), C, t),
1.262              A*(B*C), rmult(A, r, B*C, rmult(B,s,C,t)))"
1.263  by (rule prod_assoc_bij [THEN ord_isoI], auto)
1.264
1.265 @@ -307,12 +307,12 @@
1.266
1.267  subsubsection{*Rewrite rule*}
1.268
1.269 -lemma rvimage_iff: "<a,b> : rvimage(A,f,r)  <->  <f`a,f`b>: r & a:A & b:A"
1.270 +lemma rvimage_iff: "<a,b> \<in> rvimage(A,f,r)  <->  <f`a,f`b>: r & a:A & b:A"
1.271  by (unfold rvimage_def, blast)
1.272
1.273  subsubsection{*Type checking*}
1.274
1.275 -lemma rvimage_type: "rvimage(A,f,r) <= A*A"
1.276 +lemma rvimage_type: "rvimage(A,f,r) \<subseteq> A*A"
1.277  by (unfold rvimage_def, rule Collect_subset)
1.278
1.279  lemmas field_rvimage = rvimage_type [THEN field_rel_subset]
1.280 @@ -361,7 +361,7 @@
1.281  lemma wf_rvimage [intro!]: "wf(r) ==> wf(rvimage(A,f,r))"
1.282  apply (simp (no_asm_use) add: rvimage_def wf_eq_minimal)
1.283  apply clarify
1.284 -apply (subgoal_tac "EX w. w : {w: {f`x. x:Q}. EX x. x: Q & (f`x = w) }")
1.285 +apply (subgoal_tac "\<exists>w. w \<in> {w: {f`x. x:Q}. \<exists>x. x: Q & (f`x = w) }")
1.286   apply (erule allE)
1.287   apply (erule impE)
1.288   apply assumption
1.289 @@ -373,7 +373,7 @@
1.290   @{text wf_rvimage} gives @{prop "wf(r) ==> wf[C](rvimage(A,f,r))"}*}
1.291  lemma wf_on_rvimage: "[| f: A->B;  wf[B](r) |] ==> wf[A](rvimage(A,f,r))"
1.292  apply (rule wf_onI2)
1.293 -apply (subgoal_tac "ALL z:A. f`z=f`y --> z: Ba")
1.294 +apply (subgoal_tac "\<forall>z\<in>A. f`z=f`y \<longrightarrow> z: Ba")
1.295   apply blast
1.296  apply (erule_tac a = "f`y" in wf_on_induct)
1.297   apply (blast intro!: apply_funtype)
1.298 @@ -396,7 +396,7 @@
1.299  done
1.300
1.301  lemma ord_iso_rvimage_eq:
1.302 -    "f: ord_iso(A,r, B,s) ==> rvimage(A,f,s) = r Int A*A"
1.303 +    "f: ord_iso(A,r, B,s) ==> rvimage(A,f,s) = r \<inter> A*A"
1.304  by (unfold ord_iso_def rvimage_def, blast)
1.305
1.306
1.307 @@ -440,7 +440,7 @@
1.308
1.309
1.310  lemma wf_imp_subset_rvimage:
1.311 -     "[|wf(r); r \<subseteq> A*A|] ==> \<exists>i f. Ord(i) & r <= rvimage(A, f, Memrel(i))"
1.312 +     "[|wf(r); r \<subseteq> A*A|] ==> \<exists>i f. Ord(i) & r \<subseteq> rvimage(A, f, Memrel(i))"
1.313  apply (rule_tac x="wftype(r)" in exI)
1.314  apply (rule_tac x="\<lambda>x\<in>A. wfrank(r,x)" in exI)
1.315  apply (simp add: Ord_wftype, clarify)
1.316 @@ -450,25 +450,25 @@
1.317  done
1.318
1.319  theorem wf_iff_subset_rvimage:
1.320 -  "relation(r) ==> wf(r) <-> (\<exists>i f A. Ord(i) & r <= rvimage(A, f, Memrel(i)))"
1.321 +  "relation(r) ==> wf(r) <-> (\<exists>i f A. Ord(i) & r \<subseteq> rvimage(A, f, Memrel(i)))"
1.322  by (blast dest!: relation_field_times_field wf_imp_subset_rvimage
1.323            intro: wf_rvimage_Ord [THEN wf_subset])
1.324
1.325
1.326  subsection{*Other Results*}
1.327
1.328 -lemma wf_times: "A Int B = 0 ==> wf(A*B)"
1.329 +lemma wf_times: "A \<inter> B = 0 ==> wf(A*B)"
1.330  by (simp add: wf_def, blast)
1.331
1.332  text{*Could also be used to prove @{text wf_radd}*}
1.333  lemma wf_Un:
1.334 -     "[| range(r) Int domain(s) = 0; wf(r);  wf(s) |] ==> wf(r Un s)"
1.335 +     "[| range(r) \<inter> domain(s) = 0; wf(r);  wf(s) |] ==> wf(r \<union> s)"
1.336  apply (simp add: wf_def, clarify)
1.337  apply (rule equalityI)
1.338   prefer 2 apply blast
1.339  apply clarify
1.340  apply (drule_tac x=Z in spec)
1.341 -apply (drule_tac x="Z Int domain(s)" in spec)
1.342 +apply (drule_tac x="Z \<inter> domain(s)" in spec)
1.343  apply simp
1.344  apply (blast intro: elim: equalityE)
1.345  done
1.346 @@ -496,7 +496,7 @@
1.347  lemma wf_measure [iff]: "wf(measure(A,f))"
1.348  by (simp (no_asm) add: measure_eq_rvimage_Memrel wf_Memrel wf_rvimage)
1.349
1.350 -lemma measure_iff [iff]: "<x,y> : measure(A,f) <-> x:A & y:A & f(x)<f(y)"
1.351 +lemma measure_iff [iff]: "<x,y> \<in> measure(A,f) <-> x:A & y:A & f(x)<f(y)"
1.352  by (simp (no_asm) add: measure_def)
1.353
1.354  lemma linear_measure:
1.355 @@ -521,7 +521,7 @@
1.356  apply (blast intro: linear_measure Ordf inj)
1.357  done
1.358
1.359 -lemma measure_type: "measure(A,f) <= A*A"
1.360 +lemma measure_type: "measure(A,f) \<subseteq> A*A"
1.361  by (auto simp add: measure_def)
1.362
1.363  subsubsection{*Well-foundedness of Unions*}
1.364 @@ -549,7 +549,7 @@
1.365  lemma Pow_sum_bij:
1.366      "(\<lambda>Z \<in> Pow(A+B). <{x \<in> A. Inl(x) \<in> Z}, {y \<in> B. Inr(y) \<in> Z}>)
1.367       \<in> bij(Pow(A+B), Pow(A)*Pow(B))"
1.368 -apply (rule_tac d = "%<X,Y>. {Inl (x). x \<in> X} Un {Inr (y). y \<in> Y}"
1.369 +apply (rule_tac d = "%<X,Y>. {Inl (x). x \<in> X} \<union> {Inr (y). y \<in> Y}"
1.370         in lam_bijective)
1.371  apply force+
1.372  done
```