author | paulson |
Mon, 13 May 2002 09:02:13 +0200 | |
changeset 13140 | 6d97dbb189a9 |
parent 9883 | c1c8647af477 |
child 13269 | 3ba9be497c33 |
permissions | -rw-r--r-- |
1478 | 1 |
(* Title: ZF/OrderArith.thy |
437 | 2 |
ID: $Id$ |
1478 | 3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
437 | 4 |
Copyright 1994 University of Cambridge |
5 |
||
9883 | 6 |
Towards ordinal arithmetic. Also useful with wfrec. |
437 | 7 |
*) |
8 |
||
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
9 |
theory OrderArith = Order + Sum + Ordinal: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
10 |
constdefs |
437 | 11 |
|
12 |
(*disjoint sum of two relations; underlies ordinal addition*) |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
13 |
radd :: "[i,i,i,i]=>i" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
14 |
"radd(A,r,B,s) == |
1155 | 15 |
{z: (A+B) * (A+B). |
1478 | 16 |
(EX x y. z = <Inl(x), Inr(y)>) | |
17 |
(EX x' x. z = <Inl(x'), Inl(x)> & <x',x>:r) | |
|
1155 | 18 |
(EX y' y. z = <Inr(y'), Inr(y)> & <y',y>:s)}" |
437 | 19 |
|
20 |
(*lexicographic product of two relations; underlies ordinal multiplication*) |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
21 |
rmult :: "[i,i,i,i]=>i" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
22 |
"rmult(A,r,B,s) == |
1155 | 23 |
{z: (A*B) * (A*B). |
1478 | 24 |
EX x' y' x y. z = <<x',y'>, <x,y>> & |
1155 | 25 |
(<x',x>: r | (x'=x & <y',y>: s))}" |
437 | 26 |
|
27 |
(*inverse image of a relation*) |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
28 |
rvimage :: "[i,i,i]=>i" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
29 |
"rvimage(A,f,r) == {z: A*A. EX x y. z = <x,y> & <f`x,f`y>: r}" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
30 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
31 |
measure :: "[i, i\<Rightarrow>i] \<Rightarrow> i" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
32 |
"measure(A,f) == {<x,y>: A*A. f(x) < f(y)}" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
33 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
34 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
35 |
(**** Addition of relations -- disjoint sum ****) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
36 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
37 |
(** Rewrite rules. Can be used to obtain introduction rules **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
38 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
39 |
lemma radd_Inl_Inr_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
40 |
"<Inl(a), Inr(b)> : radd(A,r,B,s) <-> a:A & b:B" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
41 |
apply (unfold radd_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
42 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
43 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
44 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
45 |
lemma radd_Inl_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
46 |
"<Inl(a'), Inl(a)> : radd(A,r,B,s) <-> a':A & a:A & <a',a>:r" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
47 |
apply (unfold radd_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
48 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
49 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
50 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
51 |
lemma radd_Inr_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
52 |
"<Inr(b'), Inr(b)> : radd(A,r,B,s) <-> b':B & b:B & <b',b>:s" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
53 |
apply (unfold radd_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
54 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
55 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
56 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
57 |
lemma radd_Inr_Inl_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
58 |
"<Inr(b), Inl(a)> : radd(A,r,B,s) <-> False" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
59 |
apply (unfold radd_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
60 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
61 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
62 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
63 |
(** Elimination Rule **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
64 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
65 |
lemma raddE: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
66 |
"[| <p',p> : radd(A,r,B,s); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
67 |
!!x y. [| p'=Inl(x); x:A; p=Inr(y); y:B |] ==> Q; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
68 |
!!x' x. [| p'=Inl(x'); p=Inl(x); <x',x>: r; x':A; x:A |] ==> Q; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
69 |
!!y' y. [| p'=Inr(y'); p=Inr(y); <y',y>: s; y':B; y:B |] ==> Q |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
70 |
|] ==> Q" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
71 |
apply (unfold radd_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
72 |
apply (blast intro: elim:); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
73 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
74 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
75 |
(** Type checking **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
76 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
77 |
lemma radd_type: "radd(A,r,B,s) <= (A+B) * (A+B)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
78 |
apply (unfold radd_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
79 |
apply (rule Collect_subset) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
80 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
81 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
82 |
lemmas field_radd = radd_type [THEN field_rel_subset] |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
83 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
84 |
(** Linearity **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
85 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
86 |
lemma linear_radd: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
87 |
"[| linear(A,r); linear(B,s) |] ==> linear(A+B,radd(A,r,B,s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
88 |
apply (unfold linear_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
89 |
apply (blast intro: elim:); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
90 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
91 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
92 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
93 |
(** Well-foundedness **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
94 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
95 |
lemma wf_on_radd: "[| wf[A](r); wf[B](s) |] ==> wf[A+B](radd(A,r,B,s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
96 |
apply (rule wf_onI2) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
97 |
apply (subgoal_tac "ALL x:A. Inl (x) : Ba") |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
98 |
(*Proving the lemma, which is needed twice!*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
99 |
prefer 2 |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
100 |
apply (erule_tac V = "y : A + B" in thin_rl) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
101 |
apply (rule_tac ballI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
102 |
apply (erule_tac r = "r" and a = "x" in wf_on_induct, assumption) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
103 |
apply (blast intro: elim:); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
104 |
(*Returning to main part of proof*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
105 |
apply safe |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
106 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
107 |
apply (erule_tac r = "s" and a = "ya" in wf_on_induct , assumption) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
108 |
apply (blast intro: elim:); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
109 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
110 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
111 |
lemma wf_radd: "[| wf(r); wf(s) |] ==> wf(radd(field(r),r,field(s),s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
112 |
apply (simp add: wf_iff_wf_on_field) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
113 |
apply (rule wf_on_subset_A [OF _ field_radd]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
114 |
apply (blast intro: wf_on_radd) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
115 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
116 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
117 |
lemma well_ord_radd: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
118 |
"[| well_ord(A,r); well_ord(B,s) |] ==> well_ord(A+B, radd(A,r,B,s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
119 |
apply (rule well_ordI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
120 |
apply (simp add: well_ord_def wf_on_radd) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
121 |
apply (simp add: well_ord_def tot_ord_def linear_radd) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
122 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
123 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
124 |
(** An ord_iso congruence law **) |
437 | 125 |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
126 |
lemma sum_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
127 |
"[| f: bij(A,C); g: bij(B,D) |] |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
128 |
==> (lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z)) : bij(A+B, C+D)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
129 |
apply (rule_tac d = "case (%x. Inl (converse (f) `x) , %y. Inr (converse (g) `y))" in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
130 |
apply (typecheck add: bij_is_inj inj_is_fun) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
131 |
apply (auto simp add: left_inverse_bij right_inverse_bij) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
132 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
133 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
134 |
lemma sum_ord_iso_cong: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
135 |
"[| f: ord_iso(A,r,A',r'); g: ord_iso(B,s,B',s') |] ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
136 |
(lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
137 |
: ord_iso(A+B, radd(A,r,B,s), A'+B', radd(A',r',B',s'))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
138 |
apply (unfold ord_iso_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
139 |
apply (safe intro!: sum_bij) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
140 |
(*Do the beta-reductions now*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
141 |
apply (auto cong add: conj_cong simp add: bij_is_fun [THEN apply_type]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
142 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
143 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
144 |
(*Could we prove an ord_iso result? Perhaps |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
145 |
ord_iso(A+B, radd(A,r,B,s), A Un B, r Un s) *) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
146 |
lemma sum_disjoint_bij: "A Int B = 0 ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
147 |
(lam z:A+B. case(%x. x, %y. y, z)) : bij(A+B, A Un B)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
148 |
apply (rule_tac d = "%z. if z:A then Inl (z) else Inr (z) " in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
149 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
150 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
151 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
152 |
(** Associativity **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
153 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
154 |
lemma sum_assoc_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
155 |
"(lam z:(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
156 |
: bij((A+B)+C, A+(B+C))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
157 |
apply (rule_tac d = "case (%x. Inl (Inl (x)), case (%x. Inl (Inr (x)), Inr))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
158 |
in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
159 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
160 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
161 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
162 |
lemma sum_assoc_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
163 |
"(lam z:(A+B)+C. case(case(Inl, %y. Inr(Inl(y))), %y. Inr(Inr(y)), z)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
164 |
: ord_iso((A+B)+C, radd(A+B, radd(A,r,B,s), C, t), |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
165 |
A+(B+C), radd(A, r, B+C, radd(B,s,C,t)))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
166 |
apply (rule sum_assoc_bij [THEN ord_isoI]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
167 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
168 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
169 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
170 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
171 |
(**** Multiplication of relations -- lexicographic product ****) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
172 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
173 |
(** Rewrite rule. Can be used to obtain introduction rules **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
174 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
175 |
lemma rmult_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
176 |
"<<a',b'>, <a,b>> : rmult(A,r,B,s) <-> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
177 |
(<a',a>: r & a':A & a:A & b': B & b: B) | |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
178 |
(<b',b>: s & a'=a & a:A & b': B & b: B)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
179 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
180 |
apply (unfold rmult_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
181 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
182 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
183 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
184 |
lemma rmultE: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
185 |
"[| <<a',b'>, <a,b>> : rmult(A,r,B,s); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
186 |
[| <a',a>: r; a':A; a:A; b':B; b:B |] ==> Q; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
187 |
[| <b',b>: s; a:A; a'=a; b':B; b:B |] ==> Q |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
188 |
|] ==> Q" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
189 |
apply (blast intro: elim:); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
190 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
191 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
192 |
(** Type checking **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
193 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
194 |
lemma rmult_type: "rmult(A,r,B,s) <= (A*B) * (A*B)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
195 |
apply (unfold rmult_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
196 |
apply (rule Collect_subset) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
197 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
198 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
199 |
lemmas field_rmult = rmult_type [THEN field_rel_subset] |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
200 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
201 |
(** Linearity **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
202 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
203 |
lemma linear_rmult: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
204 |
"[| linear(A,r); linear(B,s) |] ==> linear(A*B,rmult(A,r,B,s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
205 |
apply (simp add: linear_def); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
206 |
apply (blast intro: elim:); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
207 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
208 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
209 |
(** Well-foundedness **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
210 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
211 |
lemma wf_on_rmult: "[| wf[A](r); wf[B](s) |] ==> wf[A*B](rmult(A,r,B,s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
212 |
apply (rule wf_onI2) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
213 |
apply (erule SigmaE) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
214 |
apply (erule ssubst) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
215 |
apply (subgoal_tac "ALL b:B. <x,b>: Ba") |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
216 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
217 |
apply (erule_tac a = "x" in wf_on_induct , assumption) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
218 |
apply (rule ballI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
219 |
apply (erule_tac a = "b" in wf_on_induct , assumption) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
220 |
apply (best elim!: rmultE bspec [THEN mp]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
221 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
222 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
223 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
224 |
lemma wf_rmult: "[| wf(r); wf(s) |] ==> wf(rmult(field(r),r,field(s),s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
225 |
apply (simp add: wf_iff_wf_on_field) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
226 |
apply (rule wf_on_subset_A [OF _ field_rmult]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
227 |
apply (blast intro: wf_on_rmult) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
228 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
229 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
230 |
lemma well_ord_rmult: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
231 |
"[| well_ord(A,r); well_ord(B,s) |] ==> well_ord(A*B, rmult(A,r,B,s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
232 |
apply (rule well_ordI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
233 |
apply (simp add: well_ord_def wf_on_rmult) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
234 |
apply (simp add: well_ord_def tot_ord_def linear_rmult) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
235 |
done |
9883 | 236 |
|
237 |
||
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
238 |
(** An ord_iso congruence law **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
239 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
240 |
lemma prod_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
241 |
"[| f: bij(A,C); g: bij(B,D) |] |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
242 |
==> (lam <x,y>:A*B. <f`x, g`y>) : bij(A*B, C*D)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
243 |
apply (rule_tac d = "%<x,y>. <converse (f) `x, converse (g) `y>" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
244 |
in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
245 |
apply (typecheck add: bij_is_inj inj_is_fun) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
246 |
apply (auto simp add: left_inverse_bij right_inverse_bij) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
247 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
248 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
249 |
lemma prod_ord_iso_cong: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
250 |
"[| f: ord_iso(A,r,A',r'); g: ord_iso(B,s,B',s') |] |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
251 |
==> (lam <x,y>:A*B. <f`x, g`y>) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
252 |
: ord_iso(A*B, rmult(A,r,B,s), A'*B', rmult(A',r',B',s'))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
253 |
apply (unfold ord_iso_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
254 |
apply (safe intro!: prod_bij) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
255 |
apply (simp_all add: bij_is_fun [THEN apply_type]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
256 |
apply (blast intro: bij_is_inj [THEN inj_apply_equality]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
257 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
258 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
259 |
lemma singleton_prod_bij: "(lam z:A. <x,z>) : bij(A, {x}*A)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
260 |
apply (rule_tac d = "snd" in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
261 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
262 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
263 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
264 |
(*Used??*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
265 |
lemma singleton_prod_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
266 |
"well_ord({x},xr) ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
267 |
(lam z:A. <x,z>) : ord_iso(A, r, {x}*A, rmult({x}, xr, A, r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
268 |
apply (rule singleton_prod_bij [THEN ord_isoI]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
269 |
apply (simp (no_asm_simp)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
270 |
apply (blast dest: well_ord_is_wf [THEN wf_on_not_refl]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
271 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
272 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
273 |
(*Here we build a complicated function term, then simplify it using |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
274 |
case_cong, id_conv, comp_lam, case_case.*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
275 |
lemma prod_sum_singleton_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
276 |
"a~:C ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
277 |
(lam x:C*B + D. case(%x. x, %y.<a,y>, x)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
278 |
: bij(C*B + D, C*B Un {a}*D)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
279 |
apply (rule subst_elem) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
280 |
apply (rule id_bij [THEN sum_bij, THEN comp_bij]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
281 |
apply (rule singleton_prod_bij) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
282 |
apply (rule sum_disjoint_bij) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
283 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
284 |
apply (simp (no_asm_simp) cong add: case_cong) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
285 |
apply (rule comp_lam [THEN trans, symmetric]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
286 |
apply (fast elim!: case_type) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
287 |
apply (simp (no_asm_simp) add: case_case) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
288 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
289 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
290 |
lemma prod_sum_singleton_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
291 |
"[| a:A; well_ord(A,r) |] ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
292 |
(lam x:pred(A,a,r)*B + pred(B,b,s). case(%x. x, %y.<a,y>, x)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
293 |
: ord_iso(pred(A,a,r)*B + pred(B,b,s), |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
294 |
radd(A*B, rmult(A,r,B,s), B, s), |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
295 |
pred(A,a,r)*B Un {a}*pred(B,b,s), rmult(A,r,B,s))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
296 |
apply (rule prod_sum_singleton_bij [THEN ord_isoI]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
297 |
apply (simp (no_asm_simp) add: pred_iff well_ord_is_wf [THEN wf_on_not_refl]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
298 |
apply (auto elim!: well_ord_is_wf [THEN wf_on_asym] predE) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
299 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
300 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
301 |
(** Distributive law **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
302 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
303 |
lemma sum_prod_distrib_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
304 |
"(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
305 |
: bij((A+B)*C, (A*C)+(B*C))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
306 |
apply (rule_tac d = "case (%<x,y>.<Inl (x) ,y>, %<x,y>.<Inr (x) ,y>) " |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
307 |
in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
308 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
309 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
310 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
311 |
lemma sum_prod_distrib_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
312 |
"(lam <x,z>:(A+B)*C. case(%y. Inl(<y,z>), %y. Inr(<y,z>), x)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
313 |
: ord_iso((A+B)*C, rmult(A+B, radd(A,r,B,s), C, t), |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
314 |
(A*C)+(B*C), radd(A*C, rmult(A,r,C,t), B*C, rmult(B,s,C,t)))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
315 |
apply (rule sum_prod_distrib_bij [THEN ord_isoI]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
316 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
317 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
318 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
319 |
(** Associativity **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
320 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
321 |
lemma prod_assoc_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
322 |
"(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) : bij((A*B)*C, A*(B*C))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
323 |
apply (rule_tac d = "%<x, <y,z>>. <<x,y>, z>" in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
324 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
325 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
326 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
327 |
lemma prod_assoc_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
328 |
"(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
329 |
: ord_iso((A*B)*C, rmult(A*B, rmult(A,r,B,s), C, t), |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
330 |
A*(B*C), rmult(A, r, B*C, rmult(B,s,C,t)))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
331 |
apply (rule prod_assoc_bij [THEN ord_isoI]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
332 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
333 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
334 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
335 |
(**** Inverse image of a relation ****) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
336 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
337 |
(** Rewrite rule **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
338 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
339 |
lemma rvimage_iff: "<a,b> : rvimage(A,f,r) <-> <f`a,f`b>: r & a:A & b:A" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
340 |
apply (unfold rvimage_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
341 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
342 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
343 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
344 |
(** Type checking **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
345 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
346 |
lemma rvimage_type: "rvimage(A,f,r) <= A*A" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
347 |
apply (unfold rvimage_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
348 |
apply (rule Collect_subset) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
349 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
350 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
351 |
lemmas field_rvimage = rvimage_type [THEN field_rel_subset] |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
352 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
353 |
lemma rvimage_converse: "rvimage(A,f, converse(r)) = converse(rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
354 |
apply (unfold rvimage_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
355 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
356 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
357 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
358 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
359 |
(** Partial Ordering Properties **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
360 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
361 |
lemma irrefl_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
362 |
"[| f: inj(A,B); irrefl(B,r) |] ==> irrefl(A, rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
363 |
apply (unfold irrefl_def rvimage_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
364 |
apply (blast intro: inj_is_fun [THEN apply_type]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
365 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
366 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
367 |
lemma trans_on_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
368 |
"[| f: inj(A,B); trans[B](r) |] ==> trans[A](rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
369 |
apply (unfold trans_on_def rvimage_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
370 |
apply (blast intro: inj_is_fun [THEN apply_type]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
371 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
372 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
373 |
lemma part_ord_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
374 |
"[| f: inj(A,B); part_ord(B,r) |] ==> part_ord(A, rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
375 |
apply (unfold part_ord_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
376 |
apply (blast intro!: irrefl_rvimage trans_on_rvimage) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
377 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
378 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
379 |
(** Linearity **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
380 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
381 |
lemma linear_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
382 |
"[| f: inj(A,B); linear(B,r) |] ==> linear(A,rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
383 |
apply (simp add: inj_def linear_def rvimage_iff) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
384 |
apply (blast intro: apply_funtype); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
385 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
386 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
387 |
lemma tot_ord_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
388 |
"[| f: inj(A,B); tot_ord(B,r) |] ==> tot_ord(A, rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
389 |
apply (unfold tot_ord_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
390 |
apply (blast intro!: part_ord_rvimage linear_rvimage) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
391 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
392 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
393 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
394 |
(** Well-foundedness **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
395 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
396 |
(*Not sure if wf_on_rvimage could be proved from this!*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
397 |
lemma wf_rvimage [intro!]: "wf(r) ==> wf(rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
398 |
apply (simp (no_asm_use) add: rvimage_def wf_eq_minimal) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
399 |
apply clarify |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
400 |
apply (subgoal_tac "EX w. w : {w: {f`x. x:Q}. EX x. x: Q & (f`x = w) }") |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
401 |
apply (erule allE) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
402 |
apply (erule impE) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
403 |
apply assumption; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
404 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
405 |
apply (blast intro: elim:); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
406 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
407 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
408 |
lemma wf_on_rvimage: "[| f: A->B; wf[B](r) |] ==> wf[A](rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
409 |
apply (rule wf_onI2) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
410 |
apply (subgoal_tac "ALL z:A. f`z=f`y --> z: Ba") |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
411 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
412 |
apply (erule_tac a = "f`y" in wf_on_induct) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
413 |
apply (blast intro!: apply_funtype) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
414 |
apply (blast intro!: apply_funtype dest!: rvimage_iff [THEN iffD1]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
415 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
416 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
417 |
(*Note that we need only wf[A](...) and linear(A,...) to get the result!*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
418 |
lemma well_ord_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
419 |
"[| f: inj(A,B); well_ord(B,r) |] ==> well_ord(A, rvimage(A,f,r))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
420 |
apply (rule well_ordI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
421 |
apply (unfold well_ord_def tot_ord_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
422 |
apply (blast intro!: wf_on_rvimage inj_is_fun) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
423 |
apply (blast intro!: linear_rvimage) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
424 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
425 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
426 |
lemma ord_iso_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
427 |
"f: bij(A,B) ==> f: ord_iso(A, rvimage(A,f,s), B, s)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
428 |
apply (unfold ord_iso_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
429 |
apply (simp add: rvimage_iff) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
430 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
431 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
432 |
lemma ord_iso_rvimage_eq: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
433 |
"f: ord_iso(A,r, B,s) ==> rvimage(A,f,s) = r Int A*A" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
434 |
apply (unfold ord_iso_def rvimage_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
435 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
436 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
437 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
438 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
439 |
(** The "measure" relation is useful with wfrec **) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
440 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
441 |
lemma measure_eq_rvimage_Memrel: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
442 |
"measure(A,f) = rvimage(A,Lambda(A,f),Memrel(Collect(RepFun(A,f),Ord)))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
443 |
apply (simp (no_asm) add: measure_def rvimage_def Memrel_iff) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
444 |
apply (rule equalityI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
445 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
446 |
apply (auto intro: Ord_in_Ord simp add: lt_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
447 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
448 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
449 |
lemma wf_measure [iff]: "wf(measure(A,f))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
450 |
apply (simp (no_asm) add: measure_eq_rvimage_Memrel wf_Memrel wf_rvimage) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
451 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
452 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
453 |
lemma measure_iff [iff]: "<x,y> : measure(A,f) <-> x:A & y:A & f(x)<f(y)" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
454 |
apply (simp (no_asm) add: measure_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
455 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
456 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
457 |
ML {* |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
458 |
val measure_def = thm "measure_def"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
459 |
val radd_Inl_Inr_iff = thm "radd_Inl_Inr_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
460 |
val radd_Inl_iff = thm "radd_Inl_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
461 |
val radd_Inr_iff = thm "radd_Inr_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
462 |
val radd_Inr_Inl_iff = thm "radd_Inr_Inl_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
463 |
val raddE = thm "raddE"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
464 |
val radd_type = thm "radd_type"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
465 |
val field_radd = thm "field_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
466 |
val linear_radd = thm "linear_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
467 |
val wf_on_radd = thm "wf_on_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
468 |
val wf_radd = thm "wf_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
469 |
val well_ord_radd = thm "well_ord_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
470 |
val sum_bij = thm "sum_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
471 |
val sum_ord_iso_cong = thm "sum_ord_iso_cong"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
472 |
val sum_disjoint_bij = thm "sum_disjoint_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
473 |
val sum_assoc_bij = thm "sum_assoc_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
474 |
val sum_assoc_ord_iso = thm "sum_assoc_ord_iso"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
475 |
val rmult_iff = thm "rmult_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
476 |
val rmultE = thm "rmultE"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
477 |
val rmult_type = thm "rmult_type"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
478 |
val field_rmult = thm "field_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
479 |
val linear_rmult = thm "linear_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
480 |
val wf_on_rmult = thm "wf_on_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
481 |
val wf_rmult = thm "wf_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
482 |
val well_ord_rmult = thm "well_ord_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
483 |
val prod_bij = thm "prod_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
484 |
val prod_ord_iso_cong = thm "prod_ord_iso_cong"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
485 |
val singleton_prod_bij = thm "singleton_prod_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
486 |
val singleton_prod_ord_iso = thm "singleton_prod_ord_iso"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
487 |
val prod_sum_singleton_bij = thm "prod_sum_singleton_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
488 |
val prod_sum_singleton_ord_iso = thm "prod_sum_singleton_ord_iso"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
489 |
val sum_prod_distrib_bij = thm "sum_prod_distrib_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
490 |
val sum_prod_distrib_ord_iso = thm "sum_prod_distrib_ord_iso"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
491 |
val prod_assoc_bij = thm "prod_assoc_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
492 |
val prod_assoc_ord_iso = thm "prod_assoc_ord_iso"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
493 |
val rvimage_iff = thm "rvimage_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
494 |
val rvimage_type = thm "rvimage_type"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
495 |
val field_rvimage = thm "field_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
496 |
val rvimage_converse = thm "rvimage_converse"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
497 |
val irrefl_rvimage = thm "irrefl_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
498 |
val trans_on_rvimage = thm "trans_on_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
499 |
val part_ord_rvimage = thm "part_ord_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
500 |
val linear_rvimage = thm "linear_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
501 |
val tot_ord_rvimage = thm "tot_ord_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
502 |
val wf_rvimage = thm "wf_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
503 |
val wf_on_rvimage = thm "wf_on_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
504 |
val well_ord_rvimage = thm "well_ord_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
505 |
val ord_iso_rvimage = thm "ord_iso_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
506 |
val ord_iso_rvimage_eq = thm "ord_iso_rvimage_eq"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
507 |
val measure_eq_rvimage_Memrel = thm "measure_eq_rvimage_Memrel"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
508 |
val wf_measure = thm "wf_measure"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
509 |
val measure_iff = thm "measure_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
510 |
*} |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
511 |
|
437 | 512 |
end |