src/ZF/OrdQuant.ML
author paulson
Wed, 13 Feb 2002 10:44:07 +0100
changeset 12883 3f86b73d592d
parent 12725 7ede865e1fe5
permissions -rw-r--r--
new lemmas for closure under Union
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9907
473a6604da94 tuned ML code (the_context, bind_thms(s));
wenzelm
parents: 9211
diff changeset
     1
(*  Title:      ZF/OrdQuant.ML
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     2
    ID:         $Id$
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     3
    Authors:    Krzysztof Grabczewski and L C Paulson
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     4
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     5
Quantifiers and union operator for ordinals. 
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     6
*)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     7
12620
4e6626725e21 Some new theorems for ordinals
paulson
parents: 9907
diff changeset
     8
val oall_def = thm "oall_def";
4e6626725e21 Some new theorems for ordinals
paulson
parents: 9907
diff changeset
     9
val oex_def = thm "oex_def"; 
4e6626725e21 Some new theorems for ordinals
paulson
parents: 9907
diff changeset
    10
val OUnion_def = thm "OUnion_def";
4e6626725e21 Some new theorems for ordinals
paulson
parents: 9907
diff changeset
    11
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    12
(*** universal quantifier for ordinals ***)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    13
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    14
val prems = Goalw [oall_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    15
    "[| !!x. x<A ==> P(x) |] ==> ALL x<A. P(x)";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    16
by (REPEAT (ares_tac (prems @ [allI,impI]) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    17
qed "oallI";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    18
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    19
Goalw [oall_def] "[| ALL x<A. P(x);  x<A |] ==> P(x)";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    20
by (etac (spec RS mp) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    21
by (assume_tac 1) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    22
qed "ospec";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    23
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    24
val major::prems = Goalw [oall_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    25
    "[| ALL x<A. P(x);  P(x) ==> Q;  ~x<A ==> Q |] ==> Q";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    26
by (rtac (major RS allE) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    27
by (REPEAT (eresolve_tac (prems@[asm_rl,impCE]) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    28
qed "oallE";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    29
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    30
val major::prems = Goal
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    31
    "[| ALL x<A. P(x);  ~x<A ==> Q;  P(x) ==> Q |] ==> Q";
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    32
by (rtac (major RS oallE) 1);
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    33
by (REPEAT (eresolve_tac prems 1)) ;
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    34
qed "rev_oallE";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    35
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    36
(*Trival rewrite rule;   (ALL x<a.P)<->P holds only if a is not 0!*)
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    37
Goal "(ALL x<a. True) <-> True";
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    38
by (REPEAT (ares_tac [TrueI,oallI,iffI] 1)) ;
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    39
qed "oall_simp";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    40
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    41
(*Congruence rule for rewriting*)
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    42
val prems = Goalw [oall_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    43
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) |] ==> oall(a,P) <-> oall(a',P')";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    44
by (simp_tac (simpset() addsimps prems) 1) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    45
qed "oall_cong";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    46
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    47
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    48
(*** existential quantifier for ordinals ***)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    49
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    50
val prems = Goalw [oex_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    51
    "[| P(x);  x<A |] ==> EX x<A. P(x)";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    52
by (REPEAT (ares_tac (prems @ [exI,conjI]) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    53
qed "oexI";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    54
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    55
(*Not of the general form for such rules; ~EX has become ALL~ *)
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    56
val prems = Goal
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    57
   "[| ALL x<A. ~P(x) ==> P(a);  a<A |] ==> EX x<A. P(x)";
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    58
by (rtac classical 1);
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    59
by (REPEAT (ares_tac (prems@[oexI,oallI,notI,notE]) 1)) ;
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    60
qed "oexCI";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    61
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    62
val major::prems = Goalw [oex_def] 
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    63
    "[| EX x<A. P(x);  !!x. [| x<A; P(x) |] ==> Q \
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    64
\    |] ==> Q";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    65
by (rtac (major RS exE) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    66
by (REPEAT (eresolve_tac (prems @ [asm_rl,conjE]) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    67
qed "oexE";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    68
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    69
val prems = Goalw [oex_def] 
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    70
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) \
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    71
\    |] ==> oex(a,P) <-> oex(a',P')";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    72
by (simp_tac (simpset() addsimps prems addcongs [conj_cong]) 1) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    73
qed "oex_cong";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    74
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    75
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    76
(*** Rules for Ordinal-Indexed Unions ***)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    77
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    78
Goalw [OUnion_def] "[| a<i;  b: B(a) |] ==> b: (UN z<i. B(z))";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    79
by (blast_tac (claset() addSEs [ltE]) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    80
qed "OUN_I";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    81
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    82
val major::prems = Goalw [OUnion_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    83
    "[| b : (UN z<i. B(z));  !!a.[| b: B(a);  a<i |] ==> R |] ==> R";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    84
by (rtac (major RS CollectE) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    85
by (rtac UN_E 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    86
by (REPEAT (ares_tac (ltI::prems) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    87
qed "OUN_E";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    88
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    89
Goalw [oex_def] "b : (UN x<i. B(x)) <-> (EX x<i. b : B(x))";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    90
by (fast_tac (claset() addIs [OUN_I] addSEs [OUN_E]) 1) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    91
qed "OUN_iff";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    92
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    93
val prems = Goal
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    94
    "[| i=j;  !!x. x<j ==> C(x)=D(x) |] ==> (UN x<i. C(x)) = (UN x<j. D(x))";
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    95
by (rtac equality_iffI 1);
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    96
by (simp_tac (simpset() addcongs [oex_cong] addsimps OUN_iff::prems) 1) ;
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    97
qed "OUN_cong";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    98
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    99
AddSIs [oallI];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   100
AddIs  [oexI, OUN_I];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   101
AddSEs [oexE, OUN_E];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   102
AddEs  [rev_oallE];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   103
9907
473a6604da94 tuned ML code (the_context, bind_thms(s));
wenzelm
parents: 9211
diff changeset
   104
val Ord_atomize = atomize (("OrdQuant.oall", [ospec])::ZF_conn_pairs, ZF_mem_pairs);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   105
12725
7ede865e1fe5 renamed forall_elim_vars_safe to gen_all;
wenzelm
parents: 12720
diff changeset
   106
simpset_ref() := simpset() setmksimps (map mk_eq o Ord_atomize o gen_all)
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   107
                        addsimps [oall_simp, ltD RS beta]
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   108
                        addcongs [oall_cong, oex_cong, OUN_cong];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   109
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
   110
val major::prems = Goalw [lt_def, oall_def]
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   111
    "[| i<k;  !!x.[| x<k;  ALL y<x. P(y) |] ==> P(x) \
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   112
\    |]  ==>  P(i)";
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   113
by (rtac (major RS conjE) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   114
by (etac Ord_induct 1 THEN assume_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
   115
by (fast_tac (claset() addIs prems) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   116
qed "lt_induct";