src/ZF/OrdQuant.ML
author wenzelm
Thu, 15 Nov 2001 18:20:13 +0100
changeset 12207 4dff931b852f
parent 9907 473a6604da94
child 12620 4e6626725e21
permissions -rw-r--r--
added Induct/Binary_Trees.thy, Induct/Tree_Forest (converted from former ex/TF.ML ex/TF.thy ex/Term.ML ex/Term.thy);
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
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     8
(*** universal quantifier for ordinals ***)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     9
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    10
val prems = Goalw [oall_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    11
    "[| !!x. x<A ==> P(x) |] ==> ALL x<A. P(x)";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    12
by (REPEAT (ares_tac (prems @ [allI,impI]) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    13
qed "oallI";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    14
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    15
Goalw [oall_def] "[| ALL x<A. P(x);  x<A |] ==> P(x)";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    16
by (etac (spec RS mp) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    17
by (assume_tac 1) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    18
qed "ospec";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    19
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    20
val major::prems = Goalw [oall_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    21
    "[| ALL x<A. P(x);  P(x) ==> Q;  ~x<A ==> Q |] ==> Q";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    22
by (rtac (major RS allE) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    23
by (REPEAT (eresolve_tac (prems@[asm_rl,impCE]) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    24
qed "oallE";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    25
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    26
val major::prems = Goal
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    27
    "[| ALL x<A. P(x);  ~x<A ==> Q;  P(x) ==> Q |] ==> Q";
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    28
by (rtac (major RS oallE) 1);
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    29
by (REPEAT (eresolve_tac prems 1)) ;
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    30
qed "rev_oallE";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    31
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    32
(*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
    33
Goal "(ALL x<a. True) <-> True";
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    34
by (REPEAT (ares_tac [TrueI,oallI,iffI] 1)) ;
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    35
qed "oall_simp";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    36
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    37
(*Congruence rule for rewriting*)
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    38
val prems = Goalw [oall_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    39
    "[| 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
    40
by (simp_tac (simpset() addsimps prems) 1) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    41
qed "oall_cong";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    42
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    43
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    44
(*** existential quantifier for ordinals ***)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    45
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    46
val prems = Goalw [oex_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    47
    "[| P(x);  x<A |] ==> EX x<A. P(x)";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    48
by (REPEAT (ares_tac (prems @ [exI,conjI]) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    49
qed "oexI";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    50
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    51
(*Not of the general form for such rules; ~EX has become ALL~ *)
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    52
val prems = Goal
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    53
   "[| ALL x<A. ~P(x) ==> P(a);  a<A |] ==> EX x<A. P(x)";
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    54
by (rtac classical 1);
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    55
by (REPEAT (ares_tac (prems@[oexI,oallI,notI,notE]) 1)) ;
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    56
qed "oexCI";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    57
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    58
val major::prems = Goalw [oex_def] 
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    59
    "[| EX x<A. P(x);  !!x. [| x<A; P(x) |] ==> Q \
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    60
\    |] ==> Q";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    61
by (rtac (major RS exE) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    62
by (REPEAT (eresolve_tac (prems @ [asm_rl,conjE]) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    63
qed "oexE";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    64
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    65
val prems = Goalw [oex_def] 
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    66
    "[| a=a';  !!x. x<a' ==> P(x) <-> P'(x) \
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    67
\    |] ==> oex(a,P) <-> oex(a',P')";
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    68
by (simp_tac (simpset() addsimps prems addcongs [conj_cong]) 1) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    69
qed "oex_cong";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    70
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    71
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    72
(*** Rules for Ordinal-Indexed Unions ***)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    73
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    74
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
    75
by (blast_tac (claset() addSEs [ltE]) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    76
qed "OUN_I";
2469
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
val major::prems = Goalw [OUnion_def] 
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    79
    "[| 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
    80
by (rtac (major RS CollectE) 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    81
by (rtac UN_E 1);
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    82
by (REPEAT (ares_tac (ltI::prems) 1)) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    83
qed "OUN_E";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    84
9211
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    85
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
    86
by (fast_tac (claset() addIs [OUN_I] addSEs [OUN_E]) 1) ;
6236c5285bd8 removal of batch-style proofs
paulson
parents: 9180
diff changeset
    87
qed "OUN_iff";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    88
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    89
val prems = Goal
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    90
    "[| 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
    91
by (rtac equality_iffI 1);
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    92
by (simp_tac (simpset() addcongs [oex_cong] addsimps OUN_iff::prems) 1) ;
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
    93
qed "OUN_cong";
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    94
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    95
AddSIs [oallI];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    96
AddIs  [oexI, OUN_I];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    97
AddSEs [oexE, OUN_E];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    98
AddEs  [rev_oallE];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    99
9907
473a6604da94 tuned ML code (the_context, bind_thms(s));
wenzelm
parents: 9211
diff changeset
   100
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
   101
5553
ae42b36a50c2 renamed mk_meta_eq to mk_eq
oheimb
parents: 5529
diff changeset
   102
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
   103
                        addsimps [oall_simp, ltD RS beta]
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   104
                        addcongs [oall_cong, oex_cong, OUN_cong];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   105
9180
3bda56c0d70d tidying and unbatchifying
paulson
parents: 6112
diff changeset
   106
val major::prems = Goalw [lt_def, oall_def]
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   107
    "[| 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
   108
\    |]  ==>  P(i)";
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   109
by (rtac (major RS conjE) 1);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   110
by (etac Ord_induct 1 THEN assume_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3840
diff changeset
   111
by (fast_tac (claset() addIs prems) 1);
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
   112
qed "lt_induct";