435
|
1 |
(* Title: ZF/OrderType.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1994 University of Cambridge
|
|
5 |
|
|
6 |
For OrderType.thy. Order types in Zermelo-Fraenkel Set Theory
|
|
7 |
*)
|
|
8 |
|
|
9 |
|
|
10 |
(*Requires Ordinal.thy as parent; otherwise could be in Order.ML*)
|
|
11 |
goal OrderType.thy "!!i. Ord(i) ==> well_ord(i, Memrel(i))";
|
437
|
12 |
by (rtac well_ordI 1);
|
|
13 |
by (rtac (wf_Memrel RS wf_imp_wf_on) 1);
|
435
|
14 |
by (asm_simp_tac (ZF_ss addsimps [linear_def, Memrel_iff]) 1);
|
|
15 |
by (REPEAT (resolve_tac [ballI, Ord_linear] 1));;
|
|
16 |
by (REPEAT (eresolve_tac [asm_rl, Ord_in_Ord] 1));;
|
|
17 |
val well_ord_Memrel = result();
|
|
18 |
|
|
19 |
open OrderType;
|
|
20 |
|
437
|
21 |
goalw OrderType.thy [ordermap_def,ordertype_def]
|
|
22 |
"ordermap(A,r) : A -> ordertype(A,r)";
|
|
23 |
by (rtac lam_type 1);
|
|
24 |
by (rtac (lamI RS imageI) 1);
|
|
25 |
by (REPEAT (assume_tac 1));
|
|
26 |
val ordermap_type = result();
|
|
27 |
|
435
|
28 |
(** Unfolding of ordermap **)
|
|
29 |
|
437
|
30 |
(*Useful for cardinality reasoning; see CardinalArith.ML*)
|
435
|
31 |
goalw OrderType.thy [ordermap_def, pred_def]
|
|
32 |
"!!r. [| wf[A](r); x:A |] ==> \
|
437
|
33 |
\ ordermap(A,r) ` x = ordermap(A,r) `` pred(A,x,r)";
|
|
34 |
by (asm_simp_tac ZF_ss 1);
|
|
35 |
by (etac (wfrec_on RS trans) 1);
|
|
36 |
by (assume_tac 1);
|
|
37 |
by (asm_simp_tac (ZF_ss addsimps [subset_iff, image_lam,
|
|
38 |
vimage_singleton_iff]) 1);
|
|
39 |
val ordermap_eq_image = result();
|
|
40 |
|
|
41 |
goal OrderType.thy
|
|
42 |
"!!r. [| wf[A](r); x:A |] ==> \
|
435
|
43 |
\ ordermap(A,r) ` x = {ordermap(A,r)`y . y : pred(A,x,r)}";
|
437
|
44 |
by (asm_simp_tac (ZF_ss addsimps [ordermap_eq_image, pred_subset,
|
|
45 |
ordermap_type RS image_fun]) 1);
|
435
|
46 |
val ordermap_pred_unfold = result();
|
|
47 |
|
|
48 |
(*pred-unfolded version. NOT suitable for rewriting -- loops!*)
|
|
49 |
val ordermap_unfold = rewrite_rule [pred_def] ordermap_pred_unfold;
|
|
50 |
|
|
51 |
(** Showing that ordermap, ordertype yield ordinals **)
|
|
52 |
|
|
53 |
fun ordermap_elim_tac i =
|
|
54 |
EVERY [etac (ordermap_unfold RS equalityD1 RS subsetD RS RepFunE) i,
|
|
55 |
assume_tac (i+1),
|
|
56 |
assume_tac i];
|
|
57 |
|
|
58 |
goalw OrderType.thy [well_ord_def, tot_ord_def, part_ord_def]
|
|
59 |
"!!r. [| well_ord(A,r); x:A |] ==> Ord(ordermap(A,r) ` x)";
|
|
60 |
by (safe_tac ZF_cs);
|
|
61 |
by (wf_on_ind_tac "x" [] 1);
|
|
62 |
by (asm_simp_tac (ZF_ss addsimps [ordermap_pred_unfold]) 1);
|
|
63 |
by (rtac (Ord_is_Transset RSN (2,OrdI)) 1);
|
437
|
64 |
by (rewrite_goals_tac [pred_def,Transset_def]);
|
435
|
65 |
by (fast_tac ZF_cs 2);
|
|
66 |
by (safe_tac ZF_cs);
|
|
67 |
by (ordermap_elim_tac 1);
|
|
68 |
by (fast_tac (ZF_cs addSEs [trans_onD]) 1);
|
|
69 |
val Ord_ordermap = result();
|
|
70 |
|
|
71 |
goalw OrderType.thy [ordertype_def]
|
|
72 |
"!!r. well_ord(A,r) ==> Ord(ordertype(A,r))";
|
|
73 |
by (rtac ([ordermap_type, subset_refl] MRS image_fun RS ssubst) 1);
|
|
74 |
by (rtac (Ord_is_Transset RSN (2,OrdI)) 1);
|
|
75 |
by (fast_tac (ZF_cs addIs [Ord_ordermap]) 2);
|
437
|
76 |
by (rewrite_goals_tac [Transset_def,well_ord_def]);
|
435
|
77 |
by (safe_tac ZF_cs);
|
|
78 |
by (ordermap_elim_tac 1);
|
|
79 |
by (fast_tac ZF_cs 1);
|
|
80 |
val Ord_ordertype = result();
|
|
81 |
|
|
82 |
(** ordermap preserves the orderings in both directions **)
|
|
83 |
|
|
84 |
goal OrderType.thy
|
|
85 |
"!!r. [| <w,x>: r; wf[A](r); w: A; x: A |] ==> \
|
|
86 |
\ ordermap(A,r)`w : ordermap(A,r)`x";
|
|
87 |
by (eres_inst_tac [("x1", "x")] (ordermap_unfold RS ssubst) 1);
|
437
|
88 |
by (assume_tac 1);
|
435
|
89 |
by (fast_tac ZF_cs 1);
|
|
90 |
val less_imp_ordermap_in = result();
|
|
91 |
|
|
92 |
(*linearity of r is crucial here*)
|
|
93 |
goalw OrderType.thy [well_ord_def, tot_ord_def]
|
|
94 |
"!!r. [| ordermap(A,r)`w : ordermap(A,r)`x; well_ord(A,r); \
|
|
95 |
\ w: A; x: A |] ==> <w,x>: r";
|
|
96 |
by (safe_tac ZF_cs);
|
|
97 |
by (linear_case_tac 1);
|
|
98 |
by (fast_tac (ZF_cs addSEs [mem_not_refl RS notE]) 1);
|
437
|
99 |
by (dtac less_imp_ordermap_in 1);
|
435
|
100 |
by (REPEAT_SOME assume_tac);
|
437
|
101 |
by (etac mem_asym 1);
|
|
102 |
by (assume_tac 1);
|
435
|
103 |
val ordermap_in_imp_less = result();
|
|
104 |
|
|
105 |
val ordermap_surj =
|
|
106 |
(ordermap_type RS surj_image) |>
|
|
107 |
rewrite_rule [symmetric ordertype_def] |>
|
|
108 |
standard;
|
|
109 |
|
|
110 |
goalw OrderType.thy [well_ord_def, tot_ord_def, bij_def, inj_def]
|
|
111 |
"!!r. well_ord(A,r) ==> ordermap(A,r) : bij(A, ordertype(A,r))";
|
|
112 |
by (safe_tac ZF_cs);
|
437
|
113 |
by (rtac ordermap_type 1);
|
|
114 |
by (rtac ordermap_surj 2);
|
435
|
115 |
by (linear_case_tac 1);
|
|
116 |
(*The two cases yield similar contradictions*)
|
|
117 |
by (ALLGOALS (dtac less_imp_ordermap_in));
|
|
118 |
by (REPEAT_SOME assume_tac);
|
|
119 |
by (ALLGOALS (asm_full_simp_tac (ZF_ss addsimps [mem_not_refl])));
|
|
120 |
val ordertype_bij = result();
|
|
121 |
|
|
122 |
goalw OrderType.thy [ord_iso_def]
|
|
123 |
"!!r. well_ord(A,r) ==> \
|
|
124 |
\ ordermap(A,r) : ord_iso(A,r, ordertype(A,r), Memrel(ordertype(A,r)))";
|
|
125 |
by (safe_tac ZF_cs);
|
437
|
126 |
by (rtac ordertype_bij 1);
|
|
127 |
by (assume_tac 1);
|
435
|
128 |
by (fast_tac (ZF_cs addSEs [MemrelE, ordermap_in_imp_less]) 2);
|
437
|
129 |
by (rewtac well_ord_def);
|
435
|
130 |
by (fast_tac (ZF_cs addSIs [MemrelI, less_imp_ordermap_in,
|
|
131 |
ordermap_type RS apply_type]) 1);
|
|
132 |
val ordertype_ord_iso = result();
|
|
133 |
|
|
134 |
|
|
135 |
(** Unfolding of ordertype **)
|
|
136 |
|
|
137 |
goalw OrderType.thy [ordertype_def]
|
|
138 |
"ordertype(A,r) = {ordermap(A,r)`y . y : A}";
|
|
139 |
by (rtac ([ordermap_type, subset_refl] MRS image_fun) 1);
|
|
140 |
val ordertype_unfold = result();
|