author | webertj |
Fri, 01 Jun 2007 23:21:40 +0200 | |
changeset 23193 | 1f2d94b6a8ef |
parent 22710 | f44439cdce77 |
child 24893 | b8ef7afe3a6b |
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 |
||
6 |
*) |
|
7 |
||
13356 | 8 |
header{*Combining Orderings: Foundations of Ordinal Arithmetic*} |
9 |
||
16417 | 10 |
theory OrderArith imports Order Sum Ordinal begin |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
11 |
constdefs |
437 | 12 |
|
13 |
(*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
|
14 |
radd :: "[i,i,i,i]=>i" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
15 |
"radd(A,r,B,s) == |
1155 | 16 |
{z: (A+B) * (A+B). |
1478 | 17 |
(EX x y. z = <Inl(x), Inr(y)>) | |
18 |
(EX x' x. z = <Inl(x'), Inl(x)> & <x',x>:r) | |
|
1155 | 19 |
(EX y' y. z = <Inr(y'), Inr(y)> & <y',y>:s)}" |
437 | 20 |
|
21 |
(*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
|
22 |
rmult :: "[i,i,i,i]=>i" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
23 |
"rmult(A,r,B,s) == |
1155 | 24 |
{z: (A*B) * (A*B). |
1478 | 25 |
EX x' y' x y. z = <<x',y'>, <x,y>> & |
1155 | 26 |
(<x',x>: r | (x'=x & <y',y>: s))}" |
437 | 27 |
|
28 |
(*inverse image of a relation*) |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
29 |
rvimage :: "[i,i,i]=>i" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
30 |
"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
|
31 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
32 |
measure :: "[i, i\<Rightarrow>i] \<Rightarrow> i" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
33 |
"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
|
34 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
35 |
|
13356 | 36 |
subsection{*Addition of Relations -- Disjoint Sum*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
37 |
|
13512 | 38 |
subsubsection{*Rewrite rules. Can be used to obtain introduction rules*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
39 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
40 |
lemma radd_Inl_Inr_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
41 |
"<Inl(a), Inr(b)> : radd(A,r,B,s) <-> a:A & b:B" |
13356 | 42 |
by (unfold radd_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
43 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
44 |
lemma radd_Inl_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
45 |
"<Inl(a'), Inl(a)> : radd(A,r,B,s) <-> a':A & a:A & <a',a>:r" |
13356 | 46 |
by (unfold radd_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
47 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
48 |
lemma radd_Inr_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
49 |
"<Inr(b'), Inr(b)> : radd(A,r,B,s) <-> b':B & b:B & <b',b>:s" |
13356 | 50 |
by (unfold radd_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
51 |
|
13823 | 52 |
lemma radd_Inr_Inl_iff [simp]: |
53 |
"<Inr(b), Inl(a)> : radd(A,r,B,s) <-> False" |
|
13356 | 54 |
by (unfold radd_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
55 |
|
13823 | 56 |
declare radd_Inr_Inl_iff [THEN iffD1, dest!] |
57 |
||
13512 | 58 |
subsubsection{*Elimination Rule*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
59 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
60 |
lemma raddE: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
61 |
"[| <p',p> : radd(A,r,B,s); |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
62 |
!!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
|
63 |
!!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
|
64 |
!!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
|
65 |
|] ==> Q" |
13356 | 66 |
by (unfold radd_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
67 |
|
13512 | 68 |
subsubsection{*Type checking*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
69 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
70 |
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
|
71 |
apply (unfold radd_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
72 |
apply (rule Collect_subset) |
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 |
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
|
76 |
|
13512 | 77 |
subsubsection{*Linearity*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
78 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
79 |
lemma linear_radd: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
80 |
"[| linear(A,r); linear(B,s) |] ==> linear(A+B,radd(A,r,B,s))" |
13356 | 81 |
by (unfold linear_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
82 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
83 |
|
13512 | 84 |
subsubsection{*Well-foundedness*} |
13140
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 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
|
87 |
apply (rule wf_onI2) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
88 |
apply (subgoal_tac "ALL x:A. Inl (x) : Ba") |
13512 | 89 |
--{*Proving the lemma, which is needed twice!*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
90 |
prefer 2 |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
91 |
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
|
92 |
apply (rule_tac ballI) |
13784 | 93 |
apply (erule_tac r = r and a = x in wf_on_induct, assumption) |
13269 | 94 |
apply blast |
13512 | 95 |
txt{*Returning to main part of proof*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
96 |
apply safe |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
97 |
apply blast |
13784 | 98 |
apply (erule_tac r = s and a = ya in wf_on_induct, assumption, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
99 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
100 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
101 |
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
|
102 |
apply (simp add: wf_iff_wf_on_field) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
103 |
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
|
104 |
apply (blast intro: wf_on_radd) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
105 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
106 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
107 |
lemma well_ord_radd: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
108 |
"[| 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
|
109 |
apply (rule well_ordI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
110 |
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
|
111 |
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
|
112 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
113 |
|
13512 | 114 |
subsubsection{*An @{term ord_iso} congruence law*} |
437 | 115 |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
116 |
lemma sum_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
117 |
"[| f: bij(A,C); g: bij(B,D) |] |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
118 |
==> (lam z:A+B. case(%x. Inl(f`x), %y. Inr(g`y), z)) : bij(A+B, C+D)" |
13356 | 119 |
apply (rule_tac d = "case (%x. Inl (converse(f)`x), %y. Inr(converse(g)`y))" |
120 |
in lam_bijective) |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
121 |
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
|
122 |
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
|
123 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
124 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
125 |
lemma sum_ord_iso_cong: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
126 |
"[| 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
|
127 |
(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
|
128 |
: 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
|
129 |
apply (unfold ord_iso_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
130 |
apply (safe intro!: sum_bij) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
131 |
(*Do the beta-reductions now*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
132 |
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
|
133 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
134 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
135 |
(*Could we prove an ord_iso result? Perhaps |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
136 |
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
|
137 |
lemma sum_disjoint_bij: "A Int B = 0 ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
138 |
(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
|
139 |
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
|
140 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
141 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
142 |
|
13512 | 143 |
subsubsection{*Associativity*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
144 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
145 |
lemma sum_assoc_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
146 |
"(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
|
147 |
: bij((A+B)+C, A+(B+C))" |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
148 |
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
|
149 |
in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
150 |
apply auto |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
151 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
152 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
153 |
lemma sum_assoc_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
154 |
"(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
|
155 |
: 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
|
156 |
A+(B+C), radd(A, r, B+C, radd(B,s,C,t)))" |
13356 | 157 |
by (rule sum_assoc_bij [THEN ord_isoI], auto) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
158 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
159 |
|
13356 | 160 |
subsection{*Multiplication of Relations -- Lexicographic Product*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
161 |
|
13512 | 162 |
subsubsection{*Rewrite rule. Can be used to obtain introduction rules*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
163 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
164 |
lemma rmult_iff [iff]: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
165 |
"<<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
|
166 |
(<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
|
167 |
(<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
|
168 |
|
13356 | 169 |
by (unfold rmult_def, blast) |
13140
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 |
lemma rmultE: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
172 |
"[| <<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
|
173 |
[| <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
|
174 |
[| <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
|
175 |
|] ==> Q" |
13356 | 176 |
by blast |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
177 |
|
13512 | 178 |
subsubsection{*Type checking*} |
13140
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 |
lemma rmult_type: "rmult(A,r,B,s) <= (A*B) * (A*B)" |
13356 | 181 |
by (unfold rmult_def, rule Collect_subset) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
182 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
183 |
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
|
184 |
|
13512 | 185 |
subsubsection{*Linearity*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
186 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
187 |
lemma linear_rmult: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
188 |
"[| linear(A,r); linear(B,s) |] ==> linear(A*B,rmult(A,r,B,s))" |
13356 | 189 |
by (simp add: linear_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
190 |
|
13512 | 191 |
subsubsection{*Well-foundedness*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
192 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
193 |
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
|
194 |
apply (rule wf_onI2) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
195 |
apply (erule SigmaE) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
196 |
apply (erule ssubst) |
13269 | 197 |
apply (subgoal_tac "ALL b:B. <x,b>: Ba", blast) |
13784 | 198 |
apply (erule_tac a = x in wf_on_induct, assumption) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
199 |
apply (rule ballI) |
13784 | 200 |
apply (erule_tac a = b in wf_on_induct, assumption) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
201 |
apply (best elim!: rmultE bspec [THEN mp]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
202 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
203 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
204 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
205 |
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
|
206 |
apply (simp add: wf_iff_wf_on_field) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
207 |
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
|
208 |
apply (blast intro: wf_on_rmult) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
209 |
done |
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 well_ord_rmult: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
212 |
"[| 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
|
213 |
apply (rule well_ordI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
214 |
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
|
215 |
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
|
216 |
done |
9883 | 217 |
|
218 |
||
13512 | 219 |
subsubsection{*An @{term ord_iso} congruence law*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
220 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
221 |
lemma prod_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
222 |
"[| f: bij(A,C); g: bij(B,D) |] |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
223 |
==> (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
|
224 |
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
|
225 |
in lam_bijective) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
226 |
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
|
227 |
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
|
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 prod_ord_iso_cong: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
231 |
"[| 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
|
232 |
==> (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
|
233 |
: 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
|
234 |
apply (unfold ord_iso_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
235 |
apply (safe intro!: prod_bij) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
236 |
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
|
237 |
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
|
238 |
done |
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 singleton_prod_bij: "(lam z:A. <x,z>) : bij(A, {x}*A)" |
13784 | 241 |
by (rule_tac d = snd in lam_bijective, auto) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
242 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
243 |
(*Used??*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
244 |
lemma singleton_prod_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
245 |
"well_ord({x},xr) ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
246 |
(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
|
247 |
apply (rule singleton_prod_bij [THEN ord_isoI]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
248 |
apply (simp (no_asm_simp)) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
249 |
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
|
250 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
251 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
252 |
(*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
|
253 |
case_cong, id_conv, comp_lam, case_case.*) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
254 |
lemma prod_sum_singleton_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
255 |
"a~:C ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
256 |
(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
|
257 |
: 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
|
258 |
apply (rule subst_elem) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
259 |
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
|
260 |
apply (rule singleton_prod_bij) |
13269 | 261 |
apply (rule sum_disjoint_bij, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
262 |
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
|
263 |
apply (rule comp_lam [THEN trans, symmetric]) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
264 |
apply (fast elim!: case_type) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
265 |
apply (simp (no_asm_simp) add: case_case) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
266 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
267 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
268 |
lemma prod_sum_singleton_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
269 |
"[| a:A; well_ord(A,r) |] ==> |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
270 |
(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
|
271 |
: 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
|
272 |
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
|
273 |
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
|
274 |
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
|
275 |
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
|
276 |
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
|
277 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
278 |
|
13512 | 279 |
subsubsection{*Distributive law*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
280 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
281 |
lemma sum_prod_distrib_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
282 |
"(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
|
283 |
: bij((A+B)*C, (A*C)+(B*C))" |
13356 | 284 |
by (rule_tac d = "case (%<x,y>.<Inl (x),y>, %<x,y>.<Inr (x),y>) " |
285 |
in lam_bijective, auto) |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
286 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
287 |
lemma sum_prod_distrib_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
288 |
"(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
|
289 |
: 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
|
290 |
(A*C)+(B*C), radd(A*C, rmult(A,r,C,t), B*C, rmult(B,s,C,t)))" |
13356 | 291 |
by (rule sum_prod_distrib_bij [THEN ord_isoI], auto) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
292 |
|
13512 | 293 |
subsubsection{*Associativity*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
294 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
295 |
lemma prod_assoc_bij: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
296 |
"(lam <<x,y>, z>:(A*B)*C. <x,<y,z>>) : bij((A*B)*C, A*(B*C))" |
13356 | 297 |
by (rule_tac d = "%<x, <y,z>>. <<x,y>, z>" in lam_bijective, auto) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
298 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
299 |
lemma prod_assoc_ord_iso: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
300 |
"(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
|
301 |
: 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
|
302 |
A*(B*C), rmult(A, r, B*C, rmult(B,s,C,t)))" |
13356 | 303 |
by (rule prod_assoc_bij [THEN ord_isoI], auto) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
304 |
|
13356 | 305 |
subsection{*Inverse Image of a Relation*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
306 |
|
13512 | 307 |
subsubsection{*Rewrite rule*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
308 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
309 |
lemma rvimage_iff: "<a,b> : rvimage(A,f,r) <-> <f`a,f`b>: r & a:A & b:A" |
13269 | 310 |
by (unfold rvimage_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
311 |
|
13512 | 312 |
subsubsection{*Type checking*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
313 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
314 |
lemma rvimage_type: "rvimage(A,f,r) <= A*A" |
13784 | 315 |
by (unfold rvimage_def, rule Collect_subset) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
316 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
317 |
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
|
318 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
319 |
lemma rvimage_converse: "rvimage(A,f, converse(r)) = converse(rvimage(A,f,r))" |
13269 | 320 |
by (unfold rvimage_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
321 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
322 |
|
13512 | 323 |
subsubsection{*Partial Ordering Properties*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
324 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
325 |
lemma irrefl_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
326 |
"[| 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
|
327 |
apply (unfold irrefl_def rvimage_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
328 |
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
|
329 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
330 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
331 |
lemma trans_on_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
332 |
"[| 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
|
333 |
apply (unfold trans_on_def rvimage_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
334 |
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
|
335 |
done |
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 |
lemma part_ord_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
338 |
"[| 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
|
339 |
apply (unfold part_ord_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
340 |
apply (blast intro!: irrefl_rvimage trans_on_rvimage) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
341 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
342 |
|
13512 | 343 |
subsubsection{*Linearity*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
344 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
345 |
lemma linear_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
346 |
"[| 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
|
347 |
apply (simp add: inj_def linear_def rvimage_iff) |
13269 | 348 |
apply (blast intro: apply_funtype) |
13140
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 |
lemma tot_ord_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
352 |
"[| 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
|
353 |
apply (unfold tot_ord_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
354 |
apply (blast intro!: part_ord_rvimage linear_rvimage) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
355 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
356 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
357 |
|
13512 | 358 |
subsubsection{*Well-foundedness*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
359 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
360 |
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
|
361 |
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
|
362 |
apply clarify |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
363 |
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
|
364 |
apply (erule allE) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
365 |
apply (erule impE) |
13269 | 366 |
apply assumption |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
367 |
apply blast |
13269 | 368 |
apply blast |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
369 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
370 |
|
13544 | 371 |
text{*But note that the combination of @{text wf_imp_wf_on} and |
22710 | 372 |
@{text wf_rvimage} gives @{prop "wf(r) ==> wf[C](rvimage(A,f,r))"}*} |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
373 |
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
|
374 |
apply (rule wf_onI2) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
375 |
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
|
376 |
apply blast |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
377 |
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
|
378 |
apply (blast intro!: apply_funtype) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
379 |
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
|
380 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
381 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
382 |
(*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
|
383 |
lemma well_ord_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
384 |
"[| 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
|
385 |
apply (rule well_ordI) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
386 |
apply (unfold well_ord_def tot_ord_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
387 |
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
|
388 |
apply (blast intro!: linear_rvimage) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
389 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
390 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
391 |
lemma ord_iso_rvimage: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
392 |
"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
|
393 |
apply (unfold ord_iso_def) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
394 |
apply (simp add: rvimage_iff) |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
395 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
396 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
397 |
lemma ord_iso_rvimage_eq: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
398 |
"f: ord_iso(A,r, B,s) ==> rvimage(A,f,s) = r Int A*A" |
13356 | 399 |
by (unfold ord_iso_def rvimage_def, blast) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
400 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
401 |
|
13634 | 402 |
subsection{*Every well-founded relation is a subset of some inverse image of |
403 |
an ordinal*} |
|
404 |
||
405 |
lemma wf_rvimage_Ord: "Ord(i) \<Longrightarrow> wf(rvimage(A, f, Memrel(i)))" |
|
406 |
by (blast intro: wf_rvimage wf_Memrel) |
|
407 |
||
408 |
||
409 |
constdefs |
|
410 |
wfrank :: "[i,i]=>i" |
|
411 |
"wfrank(r,a) == wfrec(r, a, %x f. \<Union>y \<in> r-``{x}. succ(f`y))" |
|
412 |
||
413 |
constdefs |
|
414 |
wftype :: "i=>i" |
|
415 |
"wftype(r) == \<Union>y \<in> range(r). succ(wfrank(r,y))" |
|
416 |
||
417 |
lemma wfrank: "wf(r) ==> wfrank(r,a) = (\<Union>y \<in> r-``{a}. succ(wfrank(r,y)))" |
|
418 |
by (subst wfrank_def [THEN def_wfrec], simp_all) |
|
419 |
||
420 |
lemma Ord_wfrank: "wf(r) ==> Ord(wfrank(r,a))" |
|
421 |
apply (rule_tac a=a in wf_induct, assumption) |
|
422 |
apply (subst wfrank, assumption) |
|
423 |
apply (rule Ord_succ [THEN Ord_UN], blast) |
|
424 |
done |
|
425 |
||
426 |
lemma wfrank_lt: "[|wf(r); <a,b> \<in> r|] ==> wfrank(r,a) < wfrank(r,b)" |
|
427 |
apply (rule_tac a1 = b in wfrank [THEN ssubst], assumption) |
|
428 |
apply (rule UN_I [THEN ltI]) |
|
429 |
apply (simp add: Ord_wfrank vimage_iff)+ |
|
430 |
done |
|
431 |
||
432 |
lemma Ord_wftype: "wf(r) ==> Ord(wftype(r))" |
|
433 |
by (simp add: wftype_def Ord_wfrank) |
|
434 |
||
435 |
lemma wftypeI: "\<lbrakk>wf(r); x \<in> field(r)\<rbrakk> \<Longrightarrow> wfrank(r,x) \<in> wftype(r)" |
|
436 |
apply (simp add: wftype_def) |
|
437 |
apply (blast intro: wfrank_lt [THEN ltD]) |
|
438 |
done |
|
439 |
||
440 |
||
441 |
lemma wf_imp_subset_rvimage: |
|
442 |
"[|wf(r); r \<subseteq> A*A|] ==> \<exists>i f. Ord(i) & r <= rvimage(A, f, Memrel(i))" |
|
443 |
apply (rule_tac x="wftype(r)" in exI) |
|
444 |
apply (rule_tac x="\<lambda>x\<in>A. wfrank(r,x)" in exI) |
|
445 |
apply (simp add: Ord_wftype, clarify) |
|
446 |
apply (frule subsetD, assumption, clarify) |
|
447 |
apply (simp add: rvimage_iff wfrank_lt [THEN ltD]) |
|
448 |
apply (blast intro: wftypeI) |
|
449 |
done |
|
450 |
||
451 |
theorem wf_iff_subset_rvimage: |
|
452 |
"relation(r) ==> wf(r) <-> (\<exists>i f A. Ord(i) & r <= rvimage(A, f, Memrel(i)))" |
|
453 |
by (blast dest!: relation_field_times_field wf_imp_subset_rvimage |
|
454 |
intro: wf_rvimage_Ord [THEN wf_subset]) |
|
455 |
||
456 |
||
13544 | 457 |
subsection{*Other Results*} |
458 |
||
459 |
lemma wf_times: "A Int B = 0 ==> wf(A*B)" |
|
460 |
by (simp add: wf_def, blast) |
|
461 |
||
462 |
text{*Could also be used to prove @{text wf_radd}*} |
|
463 |
lemma wf_Un: |
|
464 |
"[| range(r) Int domain(s) = 0; wf(r); wf(s) |] ==> wf(r Un s)" |
|
465 |
apply (simp add: wf_def, clarify) |
|
466 |
apply (rule equalityI) |
|
467 |
prefer 2 apply blast |
|
468 |
apply clarify |
|
469 |
apply (drule_tac x=Z in spec) |
|
470 |
apply (drule_tac x="Z Int domain(s)" in spec) |
|
471 |
apply simp |
|
472 |
apply (blast intro: elim: equalityE) |
|
473 |
done |
|
474 |
||
475 |
subsubsection{*The Empty Relation*} |
|
476 |
||
477 |
lemma wf0: "wf(0)" |
|
478 |
by (simp add: wf_def, blast) |
|
479 |
||
480 |
lemma linear0: "linear(0,0)" |
|
481 |
by (simp add: linear_def) |
|
482 |
||
483 |
lemma well_ord0: "well_ord(0,0)" |
|
484 |
by (blast intro: wf_imp_wf_on well_ordI wf0 linear0) |
|
13512 | 485 |
|
486 |
subsubsection{*The "measure" relation is useful with wfrec*} |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
487 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
488 |
lemma measure_eq_rvimage_Memrel: |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
489 |
"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
|
490 |
apply (simp (no_asm) add: measure_def rvimage_def Memrel_iff) |
13269 | 491 |
apply (rule equalityI, auto) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
492 |
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
|
493 |
done |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
494 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
495 |
lemma wf_measure [iff]: "wf(measure(A,f))" |
13356 | 496 |
by (simp (no_asm) add: measure_eq_rvimage_Memrel wf_Memrel wf_rvimage) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
497 |
|
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
498 |
lemma measure_iff [iff]: "<x,y> : measure(A,f) <-> x:A & y:A & f(x)<f(y)" |
13356 | 499 |
by (simp (no_asm) add: measure_def) |
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
500 |
|
13544 | 501 |
lemma linear_measure: |
502 |
assumes Ordf: "!!x. x \<in> A ==> Ord(f(x))" |
|
503 |
and inj: "!!x y. [|x \<in> A; y \<in> A; f(x) = f(y) |] ==> x=y" |
|
504 |
shows "linear(A, measure(A,f))" |
|
505 |
apply (auto simp add: linear_def) |
|
506 |
apply (rule_tac i="f(x)" and j="f(y)" in Ord_linear_lt) |
|
507 |
apply (simp_all add: Ordf) |
|
508 |
apply (blast intro: inj) |
|
509 |
done |
|
510 |
||
511 |
lemma wf_on_measure: "wf[B](measure(A,f))" |
|
512 |
by (rule wf_imp_wf_on [OF wf_measure]) |
|
513 |
||
514 |
lemma well_ord_measure: |
|
515 |
assumes Ordf: "!!x. x \<in> A ==> Ord(f(x))" |
|
516 |
and inj: "!!x y. [|x \<in> A; y \<in> A; f(x) = f(y) |] ==> x=y" |
|
517 |
shows "well_ord(A, measure(A,f))" |
|
518 |
apply (rule well_ordI) |
|
519 |
apply (rule wf_on_measure) |
|
520 |
apply (blast intro: linear_measure Ordf inj) |
|
521 |
done |
|
522 |
||
523 |
lemma measure_type: "measure(A,f) <= A*A" |
|
524 |
by (auto simp add: measure_def) |
|
525 |
||
13512 | 526 |
subsubsection{*Well-foundedness of Unions*} |
527 |
||
528 |
lemma wf_on_Union: |
|
529 |
assumes wfA: "wf[A](r)" |
|
530 |
and wfB: "!!a. a\<in>A ==> wf[B(a)](s)" |
|
531 |
and ok: "!!a u v. [|<u,v> \<in> s; v \<in> B(a); a \<in> A|] |
|
532 |
==> (\<exists>a'\<in>A. <a',a> \<in> r & u \<in> B(a')) | u \<in> B(a)" |
|
533 |
shows "wf[\<Union>a\<in>A. B(a)](s)" |
|
534 |
apply (rule wf_onI2) |
|
535 |
apply (erule UN_E) |
|
536 |
apply (subgoal_tac "\<forall>z \<in> B(a). z \<in> Ba", blast) |
|
537 |
apply (rule_tac a = a in wf_on_induct [OF wfA], assumption) |
|
538 |
apply (rule ballI) |
|
539 |
apply (rule_tac a = z in wf_on_induct [OF wfB], assumption, assumption) |
|
540 |
apply (rename_tac u) |
|
541 |
apply (drule_tac x=u in bspec, blast) |
|
542 |
apply (erule mp, clarify) |
|
13784 | 543 |
apply (frule ok, assumption+, blast) |
13512 | 544 |
done |
545 |
||
14120 | 546 |
subsubsection{*Bijections involving Powersets*} |
547 |
||
548 |
lemma Pow_sum_bij: |
|
549 |
"(\<lambda>Z \<in> Pow(A+B). <{x \<in> A. Inl(x) \<in> Z}, {y \<in> B. Inr(y) \<in> Z}>) |
|
550 |
\<in> bij(Pow(A+B), Pow(A)*Pow(B))" |
|
551 |
apply (rule_tac d = "%<X,Y>. {Inl (x). x \<in> X} Un {Inr (y). y \<in> Y}" |
|
552 |
in lam_bijective) |
|
553 |
apply force+ |
|
554 |
done |
|
555 |
||
556 |
text{*As a special case, we have @{term "bij(Pow(A*B), A -> Pow(B))"} *} |
|
557 |
lemma Pow_Sigma_bij: |
|
558 |
"(\<lambda>r \<in> Pow(Sigma(A,B)). \<lambda>x \<in> A. r``{x}) |
|
14171
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
14120
diff
changeset
|
559 |
\<in> bij(Pow(Sigma(A,B)), \<Pi> x \<in> A. Pow(B(x)))" |
14120 | 560 |
apply (rule_tac d = "%f. \<Union>x \<in> A. \<Union>y \<in> f`x. {<x,y>}" in lam_bijective) |
561 |
apply (blast intro: lam_type) |
|
562 |
apply (blast dest: apply_type, simp_all) |
|
563 |
apply fast (*strange, but blast can't do it*) |
|
564 |
apply (rule fun_extension, auto) |
|
565 |
by blast |
|
566 |
||
13512 | 567 |
|
13140
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
568 |
ML {* |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
569 |
val measure_def = thm "measure_def"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
570 |
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
|
571 |
val radd_Inl_iff = thm "radd_Inl_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
572 |
val radd_Inr_iff = thm "radd_Inr_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
573 |
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
|
574 |
val raddE = thm "raddE"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
575 |
val radd_type = thm "radd_type"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
576 |
val field_radd = thm "field_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
577 |
val linear_radd = thm "linear_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
578 |
val wf_on_radd = thm "wf_on_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
579 |
val wf_radd = thm "wf_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
580 |
val well_ord_radd = thm "well_ord_radd"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
581 |
val sum_bij = thm "sum_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
582 |
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
|
583 |
val sum_disjoint_bij = thm "sum_disjoint_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
584 |
val sum_assoc_bij = thm "sum_assoc_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
585 |
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
|
586 |
val rmult_iff = thm "rmult_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
587 |
val rmultE = thm "rmultE"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
588 |
val rmult_type = thm "rmult_type"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
589 |
val field_rmult = thm "field_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
590 |
val linear_rmult = thm "linear_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
591 |
val wf_on_rmult = thm "wf_on_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
592 |
val wf_rmult = thm "wf_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
593 |
val well_ord_rmult = thm "well_ord_rmult"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
594 |
val prod_bij = thm "prod_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
595 |
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
|
596 |
val singleton_prod_bij = thm "singleton_prod_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
597 |
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
|
598 |
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
|
599 |
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
|
600 |
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
|
601 |
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
|
602 |
val prod_assoc_bij = thm "prod_assoc_bij"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
603 |
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
|
604 |
val rvimage_iff = thm "rvimage_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
605 |
val rvimage_type = thm "rvimage_type"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
606 |
val field_rvimage = thm "field_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
607 |
val rvimage_converse = thm "rvimage_converse"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
608 |
val irrefl_rvimage = thm "irrefl_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
609 |
val trans_on_rvimage = thm "trans_on_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
610 |
val part_ord_rvimage = thm "part_ord_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
611 |
val linear_rvimage = thm "linear_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
612 |
val tot_ord_rvimage = thm "tot_ord_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
613 |
val wf_rvimage = thm "wf_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
614 |
val wf_on_rvimage = thm "wf_on_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
615 |
val well_ord_rvimage = thm "well_ord_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
616 |
val ord_iso_rvimage = thm "ord_iso_rvimage"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
617 |
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
|
618 |
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
|
619 |
val wf_measure = thm "wf_measure"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
620 |
val measure_iff = thm "measure_iff"; |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
621 |
*} |
6d97dbb189a9
converted Order.ML OrderType.ML OrderArith.ML to Isar format
paulson
parents:
9883
diff
changeset
|
622 |
|
437 | 623 |
end |