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