src/ZF/AC/WO6_WO1.ML
author paulson
Wed, 02 Apr 1997 15:29:48 +0200
changeset 2873 5f0599e15448
parent 2493 bdeb5024353a
child 3731 71366483323b
permissions -rw-r--r--
Converted back from upair.thy to ZF.thy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
     1
(*  Title:      ZF/AC/WO6_WO1.ML
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
     3
    Author:     Krzysztof Grabczewski
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
     4
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
     5
The proof of "WO6 ==> WO1".  Simplified by L C Paulson.
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
     6
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
     7
From the book "Equivalents of the Axiom of Choice" by Rubin & Rubin,
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
     8
pages 2-5
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
     9
*)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    10
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    11
open WO6_WO1;
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    12
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    13
goal OrderType.thy 
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    14
      "!!i j k. [| k < i++j;  Ord(i);  Ord(j) |] ==>  \
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    15
\                  k < i  |  (~ k<i & k = i ++ (k--i) & (k--i)<j)";
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    16
by (res_inst_tac [("i","k"),("j","i")] Ord_linear2 1);
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    17
by (dtac odiff_lt_mono2 4 THEN assume_tac 4);
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    18
by (asm_full_simp_tac
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    19
    (!simpset addsimps [oadd_odiff_inverse, odiff_oadd_inverse]) 4);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    20
by (safe_tac (!claset addSEs [lt_Ord]));
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    21
val lt_oadd_odiff_disj = result();
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    22
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    23
(*The corresponding elimination rule*)
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    24
val lt_oadd_odiff_cases = rule_by_tactic (safe_tac (!claset))
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    25
                                         (lt_oadd_odiff_disj RS disjE);
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    26
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    27
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    28
(* The most complicated part of the proof - lemma ii - p. 2-4             *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    29
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    30
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    31
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    32
(* some properties of relation uu(beta, gamma, delta) - p. 2              *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    33
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    34
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    35
goalw thy [uu_def] "domain(uu(f,b,g,d)) <= f`b";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    36
by (Fast_tac 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    37
val domain_uu_subset = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    38
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    39
goal thy "!! a. ALL b<a. f`b lepoll m ==> \
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    40
\               ALL b<a. ALL g<a. ALL d<a. domain(uu(f,b,g,d)) lepoll m";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    41
by (fast_tac (!claset addSEs
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    42
        [domain_uu_subset RS subset_imp_lepoll RS lepoll_trans]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    43
val quant_domain_uu_lepoll_m = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    44
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    45
goalw thy [uu_def] "uu(f,b,g,d) <= f`b * f`g";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    46
by (Fast_tac 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    47
val uu_subset1 = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    48
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    49
goalw thy [uu_def] "uu(f,b,g,d) <= f`d";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    50
by (Fast_tac 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    51
val uu_subset2 = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    52
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    53
goal thy "!! a. [| ALL b<a. f`b lepoll m;  d<a |] ==> uu(f,b,g,d) lepoll m";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    54
by (fast_tac (!claset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    55
        addSEs [uu_subset2 RS subset_imp_lepoll RS lepoll_trans]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    56
val uu_lepoll_m = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    57
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    58
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    59
(* Two cases for lemma ii                                                 *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    60
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    61
goalw thy [lesspoll_def] 
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    62
  "!! a f u. ALL b<a. ALL g<a. ALL d<a. u(f,b,g,d) lepoll m ==>  \
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    63
\            (ALL b<a. f`b ~= 0 --> (EX g<a. EX d<a. u(f,b,g,d) ~= 0 &  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    64
\                                       u(f,b,g,d) lesspoll m)) |  \
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    65
\            (EX b<a. f`b ~= 0 & (ALL g<a. ALL d<a. u(f,b,g,d) ~= 0 -->  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    66
\                                       u(f,b,g,d) eqpoll m))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    67
by (Asm_simp_tac 1);
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2469
diff changeset
    68
by (fast_tac (!claset delrules [equalityI]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    69
val cases = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    70
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    71
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    72
(* Lemmas used in both cases                                              *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    73
(* ********************************************************************** *)
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    74
goal thy "!!a C. Ord(a) ==> (UN b<a++a. C(b)) = (UN b<a. C(b) Un C(a++b))";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    75
by (fast_tac (!claset addSIs [equalityI] addIs [ltI] 
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    76
                    addSDs [lt_oadd_disj]
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    77
                    addSEs [lt_oadd1, oadd_lt_mono2]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    78
val UN_oadd = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    79
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    80
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    81
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    82
(* Case 1 : lemmas                                                        *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    83
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    84
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    85
goalw thy [vv1_def] "vv1(f,m,b) <= f`b";
1450
19a256c8086d Renamed letI to LetI (for consistency)
paulson
parents: 1208
diff changeset
    86
by (rtac (LetI RS LetI) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    87
by (split_tac [expand_if] 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    88
by (simp_tac (!simpset addsimps [domain_uu_subset]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    89
val vv1_subset = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    90
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    91
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    92
(* Case 1 : Union of images is the whole "y"                              *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
    93
(* ********************************************************************** *)
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    94
goalw thy [gg1_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    95
  "!! a f y. [| Ord(a);  m:nat |] ==>   \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    96
\            (UN b<a++a. gg1(f,a,m)`b) = (UN b<a. f`b)";
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
    97
by (asm_simp_tac
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
    98
    (!simpset addsimps [UN_oadd, lt_oadd1,
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
    99
                           oadd_le_self RS le_imp_not_lt, lt_Ord,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   100
                           odiff_oadd_inverse, ltD,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   101
                           vv1_subset RS Diff_partition, ww1_def]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   102
val UN_gg1_eq = result();
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   103
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   104
goal thy "domain(gg1(f,a,m)) = a++a";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   105
by (simp_tac (!simpset addsimps [lam_funtype RS domain_of_fun, gg1_def]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   106
val domain_gg1 = result();
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   107
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   108
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   109
(* every value of defined function is less than or equipollent to m       *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   110
(* ********************************************************************** *)
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   111
goal thy "!!a b. [| P(a, b);  Ord(a);  Ord(b);  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   112
\               Least_a = (LEAST a. EX x. Ord(x) & P(a, x)) |]  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   113
\               ==> P(Least_a, LEAST b. P(Least_a, b))";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   114
by (etac ssubst 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   115
by (res_inst_tac [("Q","%z. P(z, LEAST b. P(z, b))")] LeastI2 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   116
by (REPEAT (fast_tac (!claset addSEs [LeastI]) 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   117
val nested_LeastI = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   118
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   119
val nested_Least_instance = 
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   120
   standard
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   121
     (read_instantiate 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   122
        [("P","%g d. domain(uu(f,b,g,d)) ~= 0 &  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   123
\               domain(uu(f,b,g,d)) lepoll m")] nested_LeastI);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   124
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   125
goalw thy [gg1_def]
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   126
    "!!a. [| Ord(a);  m:nat;  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   127
\            ALL b<a. f`b ~=0 -->                                       \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   128
\            (EX g<a. EX d<a. domain(uu(f,b,g,d)) ~= 0  &               \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   129
\                             domain(uu(f,b,g,d)) lepoll m);            \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   130
\            ALL b<a. f`b lepoll succ(m);  b<a++a                       \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   131
\         |] ==> gg1(f,a,m)`b lepoll m";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   132
by (Asm_simp_tac 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   133
by (safe_tac (!claset addSEs [lt_oadd_odiff_cases]));
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   134
(*Case b<a   : show vv1(f,m,b) lepoll m *)
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   135
by (asm_simp_tac (!simpset addsimps [vv1_def, Let_def] 
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   136
                        setloop split_tac [expand_if]) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   137
by (fast_tac (!claset addIs [nested_Least_instance RS conjunct2]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   138
                addSEs [lt_Ord]
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   139
                addSIs [empty_lepollI]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   140
(*Case a le b: show ww1(f,m,b--a) lepoll m *)
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   141
by (asm_simp_tac (!simpset addsimps [ww1_def]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   142
by (excluded_middle_tac "f`(b--a) = 0" 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   143
by (asm_simp_tac (!simpset addsimps [empty_lepollI]) 2);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   144
by (rtac Diff_lepoll 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   145
by (Fast_tac 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   146
by (rtac vv1_subset 1);
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   147
by (dtac (ospec RS mp) 1);
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   148
by (REPEAT (eresolve_tac [asm_rl, oexE] 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   149
by (asm_simp_tac (!simpset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   150
        addsimps [vv1_def, Let_def, lt_Ord, 
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   151
                  nested_Least_instance RS conjunct1]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   152
val gg1_lepoll_m = result();
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   153
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   154
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   155
(* Case 2 : lemmas                                                        *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   156
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   157
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   158
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   159
(* Case 2 : vv2_subset                                                    *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   160
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   161
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   162
goalw thy [uu_def] "!!f. [| b<a;  g<a;  f`b~=0;  f`g~=0;        \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   163
\                           y*y <= y;  (UN b<a. f`b)=y          \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   164
\                        |] ==> EX d<a. uu(f,b,g,d) ~= 0";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   165
by (fast_tac (!claset addSIs [not_emptyI] 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   166
                    addSDs [SigmaI RSN (2, subsetD)]
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   167
                    addSEs [not_emptyE]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   168
val ex_d_uu_not_empty = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   169
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   170
goal thy "!!f. [| b<a; g<a; f`b~=0; f`g~=0;  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   171
\                       y*y<=y; (UN b<a. f`b)=y |]  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   172
\               ==> uu(f,b,g,LEAST d. (uu(f,b,g,d) ~= 0)) ~= 0";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   173
by (dtac ex_d_uu_not_empty 1 THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   174
by (fast_tac (!claset addSEs [LeastI, lt_Ord]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   175
val uu_not_empty = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   176
2873
5f0599e15448 Converted back from upair.thy to ZF.thy
paulson
parents: 2493
diff changeset
   177
goal ZF.thy "!!r. [| r<=A*B; r~=0 |] ==> domain(r)~=0";
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   178
by (REPEAT (eresolve_tac [asm_rl, not_emptyE, subsetD RS SigmaE, 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   179
                sym RSN (2, subst_elem) RS domainI RS not_emptyI] 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   180
val not_empty_rel_imp_domain = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   181
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   182
goal thy "!!f. [| b<a; g<a; f`b~=0; f`g~=0;  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   183
\                       y*y <= y; (UN b<a. f`b)=y |]  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   184
\               ==> (LEAST d. uu(f,b,g,d) ~= 0) < a";
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   185
by (eresolve_tac [ex_d_uu_not_empty RS oexE] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   186
        THEN REPEAT (assume_tac 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   187
by (resolve_tac [Least_le RS lt_trans1] 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   188
        THEN (REPEAT (ares_tac [lt_Ord] 1)));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   189
val Least_uu_not_empty_lt_a = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   190
2873
5f0599e15448 Converted back from upair.thy to ZF.thy
paulson
parents: 2493
diff changeset
   191
goal ZF.thy "!!B. [| B<=A; a~:B |] ==> B <= A-{a}";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   192
by (Fast_tac 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   193
val subset_Diff_sing = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   194
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   195
(*Could this be proved more directly?*)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   196
goal thy "!!A B. [| A lepoll m; m lepoll B; B <= A; m:nat |] ==> A=B";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   197
by (etac natE 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   198
by (fast_tac (!claset addSDs [lepoll_0_is_0] addSIs [equalityI]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   199
by (hyp_subst_tac 1);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   200
by (rtac equalityI 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   201
by (assume_tac 2);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   202
by (rtac subsetI 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   203
by (excluded_middle_tac "?P" 1 THEN (assume_tac 2));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   204
by (eresolve_tac [subset_Diff_sing RS subset_imp_lepoll RSN (2, 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   205
                Diff_sing_lepoll RSN (3, lepoll_trans RS lepoll_trans)) RS 
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   206
                succ_lepoll_natE] 1
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   207
        THEN REPEAT (assume_tac 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   208
val supset_lepoll_imp_eq = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   209
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   210
goal thy
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   211
 "!!a. [| ALL g<a. ALL d<a. domain(uu(f, b, g, d))~=0 -->               \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   212
\         domain(uu(f, b, g, d)) eqpoll succ(m);                        \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   213
\         ALL b<a. f`b lepoll succ(m);  y*y <= y;                       \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   214
\         (UN b<a. f`b)=y;  b<a;  g<a;  d<a;                            \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   215
\         f`b~=0;  f`g~=0;  m:nat;  s:f`b                               \
1071
96dfc9977bf5 Simple updates for compatibility with KG
lcp
parents: 1057
diff changeset
   216
\      |] ==> uu(f, b, g, LEAST d. uu(f,b,g,d)~=0) : f`b -> f`g";
96dfc9977bf5 Simple updates for compatibility with KG
lcp
parents: 1057
diff changeset
   217
by (dres_inst_tac [("x2","g")] (ospec RS ospec RS mp) 1);
96dfc9977bf5 Simple updates for compatibility with KG
lcp
parents: 1057
diff changeset
   218
by (rtac ([uu_subset1, uu_not_empty] MRS not_empty_rel_imp_domain) 3);
96dfc9977bf5 Simple updates for compatibility with KG
lcp
parents: 1057
diff changeset
   219
by (rtac Least_uu_not_empty_lt_a 2 THEN TRYALL assume_tac);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   220
by (resolve_tac [eqpoll_sym RS eqpoll_imp_lepoll RS 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   221
        (Least_uu_not_empty_lt_a RSN (2, uu_lepoll_m) RSN (2, 
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   222
        uu_subset1 RSN (4, rel_is_fun)))] 1
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   223
        THEN TRYALL assume_tac);
1071
96dfc9977bf5 Simple updates for compatibility with KG
lcp
parents: 1057
diff changeset
   224
by (rtac (eqpoll_sym RS eqpoll_imp_lepoll RSN (2, supset_lepoll_imp_eq)) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   225
by (REPEAT (fast_tac (!claset addSIs [domain_uu_subset, nat_succI]) 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   226
val uu_Least_is_fun = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   227
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   228
goalw thy [vv2_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   229
    "!!a. [| ALL g<a. ALL d<a. domain(uu(f, b, g, d))~=0 -->            \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   230
\            domain(uu(f, b, g, d)) eqpoll succ(m);                     \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   231
\            ALL b<a. f`b lepoll succ(m); y*y <= y;                     \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   232
\            (UN b<a. f`b)=y;  b<a;  g<a;  m:nat;  s:f`b                \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   233
\          |] ==> vv2(f,b,g,s) <= f`g";
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   234
by (split_tac [expand_if] 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   235
by (Step_tac 1);
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2469
diff changeset
   236
by (etac (uu_Least_is_fun RS apply_type) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   237
by (REPEAT_SOME (fast_tac (!claset addSIs [not_emptyI, singleton_subsetI])));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   238
val vv2_subset = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   239
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   240
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   241
(* Case 2 : Union of images is the whole "y"                              *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   242
(* ********************************************************************** *)
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   243
goalw thy [gg2_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   244
    "!!a. [| ALL g<a. ALL d<a. domain(uu(f,b,g,d)) ~= 0 -->             \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   245
\            domain(uu(f,b,g,d)) eqpoll succ(m);                        \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   246
\            ALL b<a. f`b lepoll succ(m); y*y<=y;                       \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   247
\            (UN b<a.f`b)=y;  Ord(a);  m:nat;  s:f`b;  b<a              \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   248
\         |] ==> (UN g<a++a. gg2(f,a,b,s) ` g) = y";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   249
by (dtac sym 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   250
by (asm_simp_tac
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   251
    (!simpset addsimps [UN_oadd, lt_oadd1,
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   252
                           oadd_le_self RS le_imp_not_lt, lt_Ord,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   253
                           odiff_oadd_inverse, ww2_def,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   254
                           vv2_subset RS Diff_partition]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   255
val UN_gg2_eq = result();
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   256
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   257
goal thy "domain(gg2(f,a,b,s)) = a++a";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   258
by (simp_tac (!simpset addsimps [lam_funtype RS domain_of_fun, gg2_def]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   259
val domain_gg2 = result();
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   260
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   261
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   262
(* every value of defined function is less than or equipollent to m       *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   263
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   264
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   265
goalw thy [vv2_def]
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   266
    "!!m. [| m:nat; m~=0 |] ==> vv2(f,b,g,s) lepoll m";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   267
by (asm_simp_tac (!simpset addsimps [empty_lepollI]
1057
5097aa914449 Renamed diff_sing_lepoll to Diff_sing_lepoll.
lcp
parents: 1041
diff changeset
   268
                              setloop split_tac [expand_if]) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   269
by (fast_tac (!claset
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   270
        addSDs [le_imp_subset RS subset_imp_lepoll RS lepoll_0_is_0]
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   271
        addSIs [singleton_eqpoll_1 RS eqpoll_imp_lepoll RS lepoll_trans,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   272
                not_lt_imp_le RS le_imp_subset RS subset_imp_lepoll,
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   273
                nat_into_Ord, nat_1I]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   274
val vv2_lepoll = result();
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   275
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   276
goalw thy [ww2_def]
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   277
    "!!m. [| ALL b<a. f`b lepoll succ(m);  g<a;  m:nat;  vv2(f,b,g,d) <= f`g  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   278
\         |] ==> ww2(f,b,g,d) lepoll m";
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   279
by (excluded_middle_tac "f`g = 0" 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   280
by (asm_simp_tac (!simpset addsimps [empty_lepollI]) 2);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   281
by (dtac ospec 1 THEN (assume_tac 1));
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   282
by (rtac Diff_lepoll 1
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   283
        THEN (TRYALL assume_tac));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   284
by (asm_simp_tac (!simpset addsimps [vv2_def, expand_if, not_emptyI]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   285
val ww2_lepoll = result();
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   286
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   287
goalw thy [gg2_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   288
    "!!a. [| ALL g<a. ALL d<a. domain(uu(f,b,g,d)) ~= 0 -->             \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   289
\            domain(uu(f,b,g,d)) eqpoll succ(m);                        \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   290
\            ALL b<a. f`b lepoll succ(m);  y*y <= y;                    \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   291
\            (UN b<a. f`b)=y;  b<a;  s:f`b;  m:nat;  m~= 0;  g<a++a     \
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   292
\         |] ==> gg2(f,a,b,s) ` g lepoll m";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   293
by (Asm_simp_tac 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   294
by (safe_tac (!claset addSEs [lt_oadd_odiff_cases, lt_Ord2]));
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   295
by (asm_simp_tac (!simpset addsimps [vv2_lepoll]) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   296
by (asm_simp_tac (!simpset addsimps [ww2_lepoll, vv2_subset]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   297
val gg2_lepoll_m = result();
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   298
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   299
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   300
(* lemma ii                                                               *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   301
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   302
goalw thy [NN_def]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   303
        "!!y. [| succ(m) : NN(y); y*y <= y; m:nat; m~=0 |] ==> m : NN(y)";
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   304
by (REPEAT (eresolve_tac [CollectE, exE, conjE] 1));
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   305
by (resolve_tac [quant_domain_uu_lepoll_m RS cases RS disjE] 1
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   306
    THEN (assume_tac 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   307
(* case 1 *)
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   308
by (asm_full_simp_tac (!simpset addsimps [lesspoll_succ_iff]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   309
by (res_inst_tac [("x","a++a")] exI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   310
by (fast_tac (!claset addSIs [Ord_oadd, domain_gg1, UN_gg1_eq, 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   311
                                  gg1_lepoll_m]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   312
(* case 2 *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   313
by (REPEAT (eresolve_tac [oexE, conjE] 1));
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   314
by (res_inst_tac [("A","f`?B")] not_emptyE 1 THEN (assume_tac 1));
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   315
by (rtac CollectI 1);
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   316
by (etac succ_natD 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   317
by (res_inst_tac [("x","a++a")] exI 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   318
by (res_inst_tac [("x","gg2(f,a,b,x)")] exI 1);
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   319
(*Calling fast_tac might get rid of the res_inst_tac calls, but it
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   320
  is just too slow.*)
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   321
by (asm_simp_tac (!simpset addsimps 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   322
                  [Ord_oadd, domain_gg2, UN_gg2_eq, gg2_lepoll_m]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   323
val lemma_ii = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   324
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   325
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   326
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   327
(* lemma iv - p. 4 :                                                      *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   328
(* For every set x there is a set y such that   x Un (y * y) <= y         *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   329
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   330
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   331
(* the quantifier ALL looks inelegant but makes the proofs shorter  *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   332
(* (used only in the following two lemmas)                          *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   333
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   334
goal thy "ALL n:nat. rec(n, x, %k r. r Un r*r) <=  \
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   335
\                    rec(succ(n), x, %k r. r Un r*r)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   336
by (fast_tac (!claset addIs [rec_succ RS ssubst]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   337
val z_n_subset_z_succ_n = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   338
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   339
goal thy "!!n. [| ALL n:nat. f(n)<=f(succ(n)); n le m; n : nat; m: nat |]  \
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   340
\              ==> f(n)<=f(m)";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   341
by (eres_inst_tac [("P","n le m")] rev_mp 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   342
by (res_inst_tac [("P","%z. n le z --> f(n) <= f(z)")] nat_induct 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   343
by (REPEAT (fast_tac le_cs 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   344
val le_subsets = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   345
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   346
goal thy "!!n m. [| n le m; m:nat |] ==>  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   347
\       rec(n, x, %k r. r Un r*r) <= rec(m, x, %k r. r Un r*r)";
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   348
by (resolve_tac [z_n_subset_z_succ_n RS le_subsets] 1 
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   349
    THEN (TRYALL assume_tac));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   350
by (eresolve_tac [Ord_nat RSN (2, ltI) RSN (2, lt_trans1) RS ltD] 1
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   351
    THEN (assume_tac 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   352
val le_imp_rec_subset = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   353
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   354
goal thy "EX y. x Un y*y <= y";
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   355
by (res_inst_tac [("x","UN n:nat. rec(n, x, %k r. r Un r*r)")] exI 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   356
by (safe_tac (!claset));
2493
bdeb5024353a Removal of sum_cs and eq_cs
paulson
parents: 2469
diff changeset
   357
by (rtac (nat_0I RS UN_I) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   358
by (Asm_simp_tac 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   359
by (res_inst_tac [("a","succ(n Un na)")] UN_I 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   360
by (eresolve_tac [Un_nat_type RS nat_succI] 1 THEN (assume_tac 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   361
by (fast_tac (ZF_cs addIs [le_imp_rec_subset RS subsetD]
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   362
                addSIs [Un_upper1_le, Un_upper2_le, Un_nat_type]
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   363
                addSEs [nat_into_Ord] addss (!simpset)) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   364
val lemma_iv = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   365
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   366
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   367
(* Rubin & Rubin wrote :                                                  *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   368
(* "It follows from (ii) and mathematical induction that if y*y <= y then *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   369
(* y can be well-ordered"                                                 *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   370
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   371
(* In fact we have to prove :                                             *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   372
(*      * WO6 ==> NN(y) ~= 0                                              *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   373
(*      * reverse induction which lets us infer that 1 : NN(y)            *)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   374
(*      * 1 : NN(y) ==> y can be well-ordered                             *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   375
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   376
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   377
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   378
(*      WO6 ==> NN(y) ~= 0                                                *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   379
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   380
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   381
goalw thy [WO6_def, NN_def] "!!y. WO6 ==> NN(y) ~= 0";
1071
96dfc9977bf5 Simple updates for compatibility with KG
lcp
parents: 1057
diff changeset
   382
by (fast_tac (ZF_cs addEs [equals0D]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   383
val WO6_imp_NN_not_empty = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   384
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   385
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   386
(*      1 : NN(y) ==> y can be well-ordered                               *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   387
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   388
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   389
goal thy "!!f. [| (UN b<a. f`b)=y; x:y; ALL b<a. f`b lepoll 1; Ord(a) |]  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   390
\               ==> EX c<a. f`c = {x}";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   391
by (fast_tac (!claset addSEs [lepoll_1_is_sing]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   392
val lemma1 = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   393
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   394
goal thy "!!f. [| (UN b<a. f`b)=y; x:y; ALL b<a. f`b lepoll 1; Ord(a) |]  \
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   395
\               ==> f` (LEAST i. f`i = {x}) = {x}";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   396
by (dtac lemma1 1 THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   397
by (fast_tac (!claset addSEs [lt_Ord] addIs [LeastI]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   398
val lemma2 = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   399
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   400
goalw thy [NN_def] "!!y. 1 : NN(y) ==> EX a f. Ord(a) & f:inj(y, a)";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   401
by (etac CollectE 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   402
by (REPEAT (eresolve_tac [exE, conjE] 1));
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   403
by (res_inst_tac [("x","a")] exI 1);
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   404
by (res_inst_tac [("x","lam x:y. LEAST i. f`i = {x}")] exI 1);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   405
by (rtac conjI 1 THEN (assume_tac 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   406
by (res_inst_tac [("d","%i. THE x. x:f`i")] lam_injective 1);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   407
by (dtac lemma1 1 THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   408
by (fast_tac (!claset addSEs [Least_le RS lt_trans1 RS ltD, lt_Ord]) 1);
1041
6664d0b54d0f Deleted subset_imp_Un_Diff_eq, as it is identical to
lcp
parents: 992
diff changeset
   409
by (resolve_tac [lemma2 RS ssubst] 1 THEN REPEAT (assume_tac 1));
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   410
by (fast_tac (!claset addSIs [the_equality]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   411
val NN_imp_ex_inj = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   412
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   413
goal thy "!!y. [| y*y <= y; 1 : NN(y) |] ==> EX r. well_ord(y, r)";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   414
by (dtac NN_imp_ex_inj 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   415
by (fast_tac (!claset addSEs [well_ord_Memrel RSN (2,  well_ord_rvimage)]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   416
val y_well_ord = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   417
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   418
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   419
(*      reverse induction which lets us infer that 1 : NN(y)              *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   420
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   421
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   422
val [prem1, prem2] = goal thy
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   423
        "[| n:nat; !!m. [| m:nat; m~=0; P(succ(m)) |] ==> P(m) |]  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   424
\       ==> n~=0 --> P(n) --> P(1)";
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   425
by (res_inst_tac [("n","n")] nat_induct 1);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   426
by (rtac prem1 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   427
by (Fast_tac 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   428
by (excluded_middle_tac "x=0" 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   429
by (Fast_tac 2);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   430
by (fast_tac (!claset addSIs [prem2]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   431
val rev_induct_lemma = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   432
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   433
val prems = goal thy
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   434
        "[| P(n); n:nat; n~=0;  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   435
\       !!m. [| m:nat; m~=0; P(succ(m)) |] ==> P(m) |]  \
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   436
\       ==> P(1)";
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   437
by (resolve_tac [rev_induct_lemma RS impE] 1);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   438
by (etac impE 4 THEN (assume_tac 5));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   439
by (REPEAT (ares_tac prems 1));
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   440
val rev_induct = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   441
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   442
goalw thy [NN_def] "!!n. n:NN(y) ==> n:nat";
1057
5097aa914449 Renamed diff_sing_lepoll to Diff_sing_lepoll.
lcp
parents: 1041
diff changeset
   443
by (etac CollectD1 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   444
val NN_into_nat = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   445
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   446
goal thy "!!n. [| n:NN(y); y*y <= y; n~=0 |] ==> 1:NN(y)";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   447
by (rtac rev_induct 1 THEN REPEAT (ares_tac [NN_into_nat] 1));
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   448
by (rtac lemma_ii 1 THEN REPEAT (assume_tac 1));
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   449
val lemma3 = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   450
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   451
(* ********************************************************************** *)
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1450
diff changeset
   452
(* Main theorem "WO6 ==> WO1"                                             *)
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   453
(* ********************************************************************** *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   454
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   455
(* another helpful lemma *)
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   456
goalw thy [NN_def] "!!y. 0:NN(y) ==> y=0";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   457
by (fast_tac (!claset addSIs [equalityI] 
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   458
                    addSDs [lepoll_0_is_0] addEs [subst]) 1);
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   459
val NN_y_0 = result();
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   460
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   461
goalw thy [WO1_def] "!!Z. WO6 ==> WO1";
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   462
by (rtac allI 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   463
by (excluded_middle_tac "A=0" 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   464
by (fast_tac (!claset addSIs [well_ord_Memrel, nat_0I RS nat_into_Ord]) 2);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   465
by (res_inst_tac [("x1","A")] (lemma_iv RS revcut_rl) 1);
1208
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   466
by (etac exE 1);
bc3093616ba4 Ran expandshort and corrected spelling of Grabczewski
paulson
parents: 1071
diff changeset
   467
by (dtac WO6_imp_NN_not_empty 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   468
by (eresolve_tac [Un_subset_iff RS iffD1 RS conjE] 1);
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   469
by (eres_inst_tac [("A","NN(y)")] not_emptyE 1);
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   470
by (forward_tac [y_well_ord] 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   471
by (fast_tac (!claset addEs [well_ord_subset]) 2);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents: 1461
diff changeset
   472
by (fast_tac (!claset addSIs [lemma3] addSDs [NN_y_0] addSEs [not_emptyE]) 1);
992
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   473
qed "WO6_imp_WO1";
4ef4f7ff2aeb New example of AC Equivalences by Krzysztof Grabczewski
lcp
parents:
diff changeset
   474