140 "\<lbrakk>linear(A,r); B<=A\<rbrakk> \<Longrightarrow> linear(B,r)" |
140 "\<lbrakk>linear(A,r); B<=A\<rbrakk> \<Longrightarrow> linear(B,r)" |
141 by (unfold linear_def, blast) |
141 by (unfold linear_def, blast) |
142 |
142 |
143 lemma tot_ord_subset: |
143 lemma tot_ord_subset: |
144 "\<lbrakk>tot_ord(A,r); B<=A\<rbrakk> \<Longrightarrow> tot_ord(B,r)" |
144 "\<lbrakk>tot_ord(A,r); B<=A\<rbrakk> \<Longrightarrow> tot_ord(B,r)" |
145 apply (unfold tot_ord_def) |
145 unfolding tot_ord_def |
146 apply (fast elim!: part_ord_subset linear_subset) |
146 apply (fast elim!: part_ord_subset linear_subset) |
147 done |
147 done |
148 |
148 |
149 lemma well_ord_subset: |
149 lemma well_ord_subset: |
150 "\<lbrakk>well_ord(A,r); B<=A\<rbrakk> \<Longrightarrow> well_ord(B,r)" |
150 "\<lbrakk>well_ord(A,r); B<=A\<rbrakk> \<Longrightarrow> well_ord(B,r)" |
151 apply (unfold well_ord_def) |
151 unfolding well_ord_def |
152 apply (fast elim!: tot_ord_subset wf_on_subset_A) |
152 apply (fast elim!: tot_ord_subset wf_on_subset_A) |
153 done |
153 done |
154 |
154 |
155 |
155 |
156 (** Relations restricted to a smaller domain, by Krzysztof Grabczewski **) |
156 (** Relations restricted to a smaller domain, by Krzysztof Grabczewski **) |
160 |
160 |
161 lemma trans_on_Int_iff: "trans[A](r \<inter> A*A) \<longleftrightarrow> trans[A](r)" |
161 lemma trans_on_Int_iff: "trans[A](r \<inter> A*A) \<longleftrightarrow> trans[A](r)" |
162 by (unfold trans_on_def, blast) |
162 by (unfold trans_on_def, blast) |
163 |
163 |
164 lemma part_ord_Int_iff: "part_ord(A,r \<inter> A*A) \<longleftrightarrow> part_ord(A,r)" |
164 lemma part_ord_Int_iff: "part_ord(A,r \<inter> A*A) \<longleftrightarrow> part_ord(A,r)" |
165 apply (unfold part_ord_def) |
165 unfolding part_ord_def |
166 apply (simp add: irrefl_Int_iff trans_on_Int_iff) |
166 apply (simp add: irrefl_Int_iff trans_on_Int_iff) |
167 done |
167 done |
168 |
168 |
169 lemma linear_Int_iff: "linear(A,r \<inter> A*A) \<longleftrightarrow> linear(A,r)" |
169 lemma linear_Int_iff: "linear(A,r \<inter> A*A) \<longleftrightarrow> linear(A,r)" |
170 by (unfold linear_def, blast) |
170 by (unfold linear_def, blast) |
171 |
171 |
172 lemma tot_ord_Int_iff: "tot_ord(A,r \<inter> A*A) \<longleftrightarrow> tot_ord(A,r)" |
172 lemma tot_ord_Int_iff: "tot_ord(A,r \<inter> A*A) \<longleftrightarrow> tot_ord(A,r)" |
173 apply (unfold tot_ord_def) |
173 unfolding tot_ord_def |
174 apply (simp add: part_ord_Int_iff linear_Int_iff) |
174 apply (simp add: part_ord_Int_iff linear_Int_iff) |
175 done |
175 done |
176 |
176 |
177 lemma wf_on_Int_iff: "wf[A](r \<inter> A*A) \<longleftrightarrow> wf[A](r)" |
177 lemma wf_on_Int_iff: "wf[A](r \<inter> A*A) \<longleftrightarrow> wf[A](r)" |
178 apply (unfold wf_on_def wf_def, fast) (*10 times faster than blast!*) |
178 apply (unfold wf_on_def wf_def, fast) (*10 times faster than blast!*) |
179 done |
179 done |
180 |
180 |
181 lemma well_ord_Int_iff: "well_ord(A,r \<inter> A*A) \<longleftrightarrow> well_ord(A,r)" |
181 lemma well_ord_Int_iff: "well_ord(A,r \<inter> A*A) \<longleftrightarrow> well_ord(A,r)" |
182 apply (unfold well_ord_def) |
182 unfolding well_ord_def |
183 apply (simp add: tot_ord_Int_iff wf_on_Int_iff) |
183 apply (simp add: tot_ord_Int_iff wf_on_Int_iff) |
184 done |
184 done |
185 |
185 |
186 |
186 |
187 subsection\<open>Empty and Unit Domains\<close> |
187 subsection\<open>Empty and Unit Domains\<close> |
197 |
197 |
198 lemma trans_on_0: "trans[0](r)" |
198 lemma trans_on_0: "trans[0](r)" |
199 by (unfold trans_on_def, blast) |
199 by (unfold trans_on_def, blast) |
200 |
200 |
201 lemma part_ord_0: "part_ord(0,r)" |
201 lemma part_ord_0: "part_ord(0,r)" |
202 apply (unfold part_ord_def) |
202 unfolding part_ord_def |
203 apply (simp add: irrefl_0 trans_on_0) |
203 apply (simp add: irrefl_0 trans_on_0) |
204 done |
204 done |
205 |
205 |
206 lemma linear_0: "linear(0,r)" |
206 lemma linear_0: "linear(0,r)" |
207 by (unfold linear_def, blast) |
207 by (unfold linear_def, blast) |
208 |
208 |
209 lemma tot_ord_0: "tot_ord(0,r)" |
209 lemma tot_ord_0: "tot_ord(0,r)" |
210 apply (unfold tot_ord_def) |
210 unfolding tot_ord_def |
211 apply (simp add: part_ord_0 linear_0) |
211 apply (simp add: part_ord_0 linear_0) |
212 done |
212 done |
213 |
213 |
214 lemma wf_on_0: "wf[0](r)" |
214 lemma wf_on_0: "wf[0](r)" |
215 by (unfold wf_on_def wf_def, blast) |
215 by (unfold wf_on_def wf_def, blast) |
216 |
216 |
217 lemma well_ord_0: "well_ord(0,r)" |
217 lemma well_ord_0: "well_ord(0,r)" |
218 apply (unfold well_ord_def) |
218 unfolding well_ord_def |
219 apply (simp add: tot_ord_0 wf_on_0) |
219 apply (simp add: tot_ord_0 wf_on_0) |
220 done |
220 done |
221 |
221 |
222 |
222 |
223 subsubsection\<open>The Empty Relation Well-Orders the Unit Set\<close> |
223 subsubsection\<open>The Empty Relation Well-Orders the Unit Set\<close> |
226 |
226 |
227 lemma tot_ord_unit: "tot_ord({a},0)" |
227 lemma tot_ord_unit: "tot_ord({a},0)" |
228 by (simp add: irrefl_def trans_on_def part_ord_def linear_def tot_ord_def) |
228 by (simp add: irrefl_def trans_on_def part_ord_def linear_def tot_ord_def) |
229 |
229 |
230 lemma well_ord_unit: "well_ord({a},0)" |
230 lemma well_ord_unit: "well_ord({a},0)" |
231 apply (unfold well_ord_def) |
231 unfolding well_ord_def |
232 apply (simp add: tot_ord_unit wf_on_any_0) |
232 apply (simp add: tot_ord_unit wf_on_any_0) |
233 done |
233 done |
234 |
234 |
235 |
235 |
236 subsection\<open>Order-Isomorphisms\<close> |
236 subsection\<open>Order-Isomorphisms\<close> |
295 |
295 |
296 (*Transitivity of similarity*) |
296 (*Transitivity of similarity*) |
297 lemma mono_map_trans: |
297 lemma mono_map_trans: |
298 "\<lbrakk>g \<in> mono_map(A,r,B,s); f \<in> mono_map(B,s,C,t)\<rbrakk> |
298 "\<lbrakk>g \<in> mono_map(A,r,B,s); f \<in> mono_map(B,s,C,t)\<rbrakk> |
299 \<Longrightarrow> (f O g): mono_map(A,r,C,t)" |
299 \<Longrightarrow> (f O g): mono_map(A,r,C,t)" |
300 apply (unfold mono_map_def) |
300 unfolding mono_map_def |
301 apply (auto simp add: comp_fun) |
301 apply (auto simp add: comp_fun) |
302 done |
302 done |
303 |
303 |
304 (*Transitivity of similarity: the order-isomorphism relation*) |
304 (*Transitivity of similarity: the order-isomorphism relation*) |
305 lemma ord_iso_trans: |
305 lemma ord_iso_trans: |
492 lemma range_ord_iso_map: "range(ord_iso_map(A,r,B,s)) \<subseteq> B" |
492 lemma range_ord_iso_map: "range(ord_iso_map(A,r,B,s)) \<subseteq> B" |
493 by (unfold ord_iso_map_def, blast) |
493 by (unfold ord_iso_map_def, blast) |
494 |
494 |
495 lemma converse_ord_iso_map: |
495 lemma converse_ord_iso_map: |
496 "converse(ord_iso_map(A,r,B,s)) = ord_iso_map(B,s,A,r)" |
496 "converse(ord_iso_map(A,r,B,s)) = ord_iso_map(B,s,A,r)" |
497 apply (unfold ord_iso_map_def) |
497 unfolding ord_iso_map_def |
498 apply (blast intro: ord_iso_sym) |
498 apply (blast intro: ord_iso_sym) |
499 done |
499 done |
500 |
500 |
501 lemma function_ord_iso_map: |
501 lemma function_ord_iso_map: |
502 "well_ord(B,s) \<Longrightarrow> function(ord_iso_map(A,r,B,s))" |
502 "well_ord(B,s) \<Longrightarrow> function(ord_iso_map(A,r,B,s))" |
512 lemma ord_iso_map_mono_map: |
512 lemma ord_iso_map_mono_map: |
513 "\<lbrakk>well_ord(A,r); well_ord(B,s)\<rbrakk> |
513 "\<lbrakk>well_ord(A,r); well_ord(B,s)\<rbrakk> |
514 \<Longrightarrow> ord_iso_map(A,r,B,s) |
514 \<Longrightarrow> ord_iso_map(A,r,B,s) |
515 \<in> mono_map(domain(ord_iso_map(A,r,B,s)), r, |
515 \<in> mono_map(domain(ord_iso_map(A,r,B,s)), r, |
516 range(ord_iso_map(A,r,B,s)), s)" |
516 range(ord_iso_map(A,r,B,s)), s)" |
517 apply (unfold mono_map_def) |
517 unfolding mono_map_def |
518 apply (simp (no_asm_simp) add: ord_iso_map_fun) |
518 apply (simp (no_asm_simp) add: ord_iso_map_fun) |
519 apply safe |
519 apply safe |
520 apply (subgoal_tac "x \<in> A \<and> ya:A \<and> y \<in> B \<and> yb:B") |
520 apply (subgoal_tac "x \<in> A \<and> ya:A \<and> y \<in> B \<and> yb:B") |
521 apply (simp add: apply_equality [OF _ ord_iso_map_fun]) |
521 apply (simp add: apply_equality [OF _ ord_iso_map_fun]) |
522 apply (unfold ord_iso_map_def) |
522 unfolding ord_iso_map_def |
523 apply (blast intro: well_ord_iso_preserving, blast) |
523 apply (blast intro: well_ord_iso_preserving, blast) |
524 done |
524 done |
525 |
525 |
526 lemma ord_iso_map_ord_iso: |
526 lemma ord_iso_map_ord_iso: |
527 "\<lbrakk>well_ord(A,r); well_ord(B,s)\<rbrakk> \<Longrightarrow> ord_iso_map(A,r,B,s) |
527 "\<lbrakk>well_ord(A,r); well_ord(B,s)\<rbrakk> \<Longrightarrow> ord_iso_map(A,r,B,s) |
540 (*One way of saying that domain(ord_iso_map(A,r,B,s)) is downwards-closed*) |
540 (*One way of saying that domain(ord_iso_map(A,r,B,s)) is downwards-closed*) |
541 lemma domain_ord_iso_map_subset: |
541 lemma domain_ord_iso_map_subset: |
542 "\<lbrakk>well_ord(A,r); well_ord(B,s); |
542 "\<lbrakk>well_ord(A,r); well_ord(B,s); |
543 a \<in> A; a \<notin> domain(ord_iso_map(A,r,B,s))\<rbrakk> |
543 a \<in> A; a \<notin> domain(ord_iso_map(A,r,B,s))\<rbrakk> |
544 \<Longrightarrow> domain(ord_iso_map(A,r,B,s)) \<subseteq> pred(A, a, r)" |
544 \<Longrightarrow> domain(ord_iso_map(A,r,B,s)) \<subseteq> pred(A, a, r)" |
545 apply (unfold ord_iso_map_def) |
545 unfolding ord_iso_map_def |
546 apply (safe intro!: predI) |
546 apply (safe intro!: predI) |
547 (*Case analysis on xa vs a in r *) |
547 (*Case analysis on xa vs a in r *) |
548 apply (simp (no_asm_simp)) |
548 apply (simp (no_asm_simp)) |
549 apply (frule_tac A = A in well_ord_is_linear) |
549 apply (frule_tac A = A in well_ord_is_linear) |
550 apply (rename_tac b y f) |
550 apply (rename_tac b y f) |
619 |
619 |
620 lemma trans_on_converse: "trans[A](r) \<Longrightarrow> trans[A](converse(r))" |
620 lemma trans_on_converse: "trans[A](r) \<Longrightarrow> trans[A](converse(r))" |
621 by (unfold trans_on_def, blast) |
621 by (unfold trans_on_def, blast) |
622 |
622 |
623 lemma part_ord_converse: "part_ord(A,r) \<Longrightarrow> part_ord(A,converse(r))" |
623 lemma part_ord_converse: "part_ord(A,r) \<Longrightarrow> part_ord(A,converse(r))" |
624 apply (unfold part_ord_def) |
624 unfolding part_ord_def |
625 apply (blast intro!: irrefl_converse trans_on_converse) |
625 apply (blast intro!: irrefl_converse trans_on_converse) |
626 done |
626 done |
627 |
627 |
628 lemma linear_converse: "linear(A,r) \<Longrightarrow> linear(A,converse(r))" |
628 lemma linear_converse: "linear(A,r) \<Longrightarrow> linear(A,converse(r))" |
629 by (unfold linear_def, blast) |
629 by (unfold linear_def, blast) |
630 |
630 |
631 lemma tot_ord_converse: "tot_ord(A,r) \<Longrightarrow> tot_ord(A,converse(r))" |
631 lemma tot_ord_converse: "tot_ord(A,r) \<Longrightarrow> tot_ord(A,converse(r))" |
632 apply (unfold tot_ord_def) |
632 unfolding tot_ord_def |
633 apply (blast intro!: part_ord_converse linear_converse) |
633 apply (blast intro!: part_ord_converse linear_converse) |
634 done |
634 done |
635 |
635 |
636 |
636 |
637 (** By Krzysztof Grabczewski. |
637 (** By Krzysztof Grabczewski. |