src/FOL/simpdata.ML
author paulson
Thu, 05 Sep 1996 18:28:01 +0200
changeset 1953 832ccc1dba95
parent 1914 86b095835de9
child 1961 d33a5d59a29a
permissions -rw-r--r--
Introduction of miniscoping for FOL
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
     1
(*  Title:      FOL/simpdata
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
     4
    Copyright   1994  University of Cambridge
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Simplification data for FOL
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
(*** Rewrite rules ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
fun int_prove_fun s = 
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    12
 (writeln s;  
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    13
  prove_goal IFOL.thy s
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    14
   (fn prems => [ (cut_facts_tac prems 1), 
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    15
                  (Int.fast_tac 1) ]));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
    17
val conj_simps = map int_prove_fun
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    18
 ["P & True <-> P",      "True & P <-> P",
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
  "P & False <-> False", "False & P <-> False",
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
  "P & P <-> P",
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    21
  "P & ~P <-> False",    "~P & P <-> False",
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
  "(P & Q) & R <-> P & (Q & R)"];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
    24
val disj_simps = map int_prove_fun
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    25
 ["P | True <-> True",  "True | P <-> True",
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    26
  "P | False <-> P",    "False | P <-> P",
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
  "P | P <-> P",
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
  "(P | Q) | R <-> P | (Q | R)"];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
    30
val not_simps = map int_prove_fun
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    31
 ["~(P|Q)  <-> ~P & ~Q",
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    32
  "~ False <-> True",   "~ True <-> False"];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
    34
val imp_simps = map int_prove_fun
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    35
 ["(P --> False) <-> ~P",       "(P --> True) <-> True",
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    36
  "(False --> P) <-> True",     "(True --> P) <-> P", 
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    37
  "(P --> P) <-> True",         "(P --> ~P) <-> ~P"];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
    39
val iff_simps = map int_prove_fun
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    40
 ["(True <-> P) <-> P",         "(P <-> True) <-> P",
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
  "(P <-> P) <-> True",
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    42
  "(False <-> P) <-> ~P",       "(P <-> False) <-> ~P"];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
    44
val quant_simps = map int_prove_fun
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    45
 ["(ALL x.P) <-> P",    "(EX x.P) <-> P"];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
(*These are NOT supplied by default!*)
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
    48
val distrib_simps  = map int_prove_fun
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    49
 ["P & (Q | R) <-> P&Q | P&R", 
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    50
  "(Q | R) & P <-> Q&P | R&P",
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
  "(P | Q --> R) <-> (P --> R) & (Q --> R)"];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    53
(** Conversion into rewrite rules **)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
53
f8f37a9a31dc Added gen_all to simpdata.ML.
nipkow
parents: 3
diff changeset
    55
fun gen_all th = forall_elim_vars (#maxidx(rep_thm th)+1) th;
f8f37a9a31dc Added gen_all to simpdata.ML.
nipkow
parents: 3
diff changeset
    56
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    57
(*Make atomic rewrite rules*)
429
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    58
fun atomize r =
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    59
  case concl_of r of
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    60
    Const("Trueprop",_) $ p =>
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    61
      (case p of
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    62
         Const("op -->",_)$_$_ => atomize(r RS mp)
429
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    63
       | Const("op &",_)$_$_   => atomize(r RS conjunct1) @
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    64
                                  atomize(r RS conjunct2)
429
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    65
       | Const("All",_)$_      => atomize(r RS spec)
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    66
       | Const("True",_)       => []    (*True is DELETED*)
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
    67
       | Const("False",_)      => []    (*should False do something?*)
429
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    68
       | _                     => [r])
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    69
  | _ => [r];
888bbb4119f8 atomize: borrowed HOL version, which checks for both Trueprop
lcp
parents: 394
diff changeset
    70
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    71
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    72
val P_iff_F = int_prove_fun "~P ==> (P <-> False)";
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    73
val iff_reflection_F = P_iff_F RS iff_reflection;
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    74
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    75
val P_iff_T = int_prove_fun "P ==> (P <-> True)";
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    76
val iff_reflection_T = P_iff_T RS iff_reflection;
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    77
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    78
(*Make meta-equalities.  The operator below is Trueprop*)
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    79
fun mk_meta_eq th = case concl_of th of
394
432bb9995893 Modified mk_meta_eq to leave meta-equlities on unchanged.
nipkow
parents: 371
diff changeset
    80
    Const("==",_)$_$_           => th
432bb9995893 Modified mk_meta_eq to leave meta-equlities on unchanged.
nipkow
parents: 371
diff changeset
    81
  | _ $ (Const("op =",_)$_$_)   => th RS eq_reflection
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    82
  | _ $ (Const("op <->",_)$_$_) => th RS iff_reflection
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    83
  | _ $ (Const("Not",_)$_)      => th RS iff_reflection_F
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    84
  | _                           => th RS iff_reflection_T;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    85
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    86
structure Induction = InductionFun(struct val spec=IFOL.spec end);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    88
open Simplifier Induction;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
981
864370666a24 Defined addss to perform simplification in a claset.
lcp
parents: 942
diff changeset
    90
(*Add congruence rules for = or <-> (instead of ==) *)
864370666a24 Defined addss to perform simplification in a claset.
lcp
parents: 942
diff changeset
    91
infix 4 addcongs;
3
5f77582e3a89 defined local addcongs
nipkow
parents: 0
diff changeset
    92
fun ss addcongs congs =
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    93
    ss addeqcongs (congs RL [eq_reflection,iff_reflection]);
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
    94
981
864370666a24 Defined addss to perform simplification in a claset.
lcp
parents: 942
diff changeset
    95
(*Add a simpset to a classical set!*)
864370666a24 Defined addss to perform simplification in a claset.
lcp
parents: 942
diff changeset
    96
infix 4 addss;
864370666a24 Defined addss to perform simplification in a claset.
lcp
parents: 942
diff changeset
    97
fun cs addss ss = cs addbefore asm_full_simp_tac ss 1;
864370666a24 Defined addss to perform simplification in a claset.
lcp
parents: 942
diff changeset
    98
864370666a24 Defined addss to perform simplification in a claset.
lcp
parents: 942
diff changeset
    99
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   100
val IFOL_simps =
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   101
   [refl RS P_iff_T] @ conj_simps @ disj_simps @ not_simps @ 
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   102
    imp_simps @ iff_simps @ quant_simps;
3
5f77582e3a89 defined local addcongs
nipkow
parents: 0
diff changeset
   103
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   104
val notFalseI = int_prove_fun "~False";
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   105
val triv_rls = [TrueI,refl,iff_refl,notFalseI];
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   106
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   107
val IFOL_ss = 
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   108
  empty_ss 
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   109
  setmksimps (map mk_meta_eq o atomize o gen_all)
371
3a853818f1d2 FOL/simpdata: added etac FalseE in setsolver call. Toby: "now that the
lcp
parents: 282
diff changeset
   110
  setsolver  (fn prems => resolve_tac (triv_rls@prems) 
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
   111
                          ORELSE' assume_tac
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
   112
                          ORELSE' etac FalseE)
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   113
  setsubgoaler asm_simp_tac
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   114
  addsimps IFOL_simps
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   115
  addcongs [imp_cong];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   116
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   117
(*Classical version...*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
fun prove_fun s = 
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   119
 (writeln s;  
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   120
  prove_goal FOL.thy s
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   121
   (fn prems => [ (cut_facts_tac prems 1), 
1459
d12da312eff4 expanded tabs
clasohm
parents: 1088
diff changeset
   122
                  (Cla.fast_tac FOL_cs 1) ]));
745
45a789407806 added blank line
lcp
parents: 429
diff changeset
   123
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   124
(*Avoids duplication of subgoals after expand_if, when the true and false 
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   125
  cases boil down to the same thing.*) 
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   126
val cases_simp = prove_fun "(P --> Q) & (~P --> Q) <-> Q";
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   127
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   128
val cla_simps = 
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   129
    cases_simp::
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   130
    map prove_fun
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   131
     ["~(P&Q)  <-> ~P | ~Q",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   132
      "P | ~P",             "~P | P",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   133
      "~ ~ P <-> P",        "(~P --> P) <-> P",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   134
      "(~P <-> ~Q) <-> (P<->Q)"];
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   135
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   136
(*At present, miniscoping is for classical logic only.  We do NOT include
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   137
  distribution of ALL over &, or dually that of EX over |.*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   138
1953
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   139
(*Miniscoping: pushing in existential quantifiers*)
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   140
val ex_simps = map prove_fun 
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   141
                ["(EX x. P) <-> P",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   142
                 "(EX x. P(x) & Q) <-> (EX x.P(x)) & Q",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   143
                 "(EX x. P & Q(x)) <-> P & (EX x.Q(x))",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   144
                 "(EX x. P(x) | Q) <-> (EX x.P(x)) | Q",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   145
                 "(EX x. P | Q(x)) <-> P | (EX x.Q(x))",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   146
                 "(EX x. P(x) --> Q) <-> (ALL x.P(x)) --> Q",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   147
                 "(EX x. P --> Q(x)) <-> P --> (EX x.Q(x))"];
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   148
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   149
(*Miniscoping: pushing in universal quantifiers*)
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   150
val all_simps = map prove_fun
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   151
                ["(ALL x. P) <-> P",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   152
                 "(ALL x. P(x) & Q) <-> (ALL x.P(x)) & Q",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   153
                 "(ALL x. P & Q(x)) <-> P & (ALL x.Q(x))",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   154
                 "(ALL x. P(x) | Q) <-> (ALL x.P(x)) | Q",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   155
                 "(ALL x. P | Q(x)) <-> P | (ALL x.Q(x))",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   156
                 "(ALL x. P(x) --> Q) <-> (EX x.P(x)) --> Q",
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   157
                 "(ALL x. P --> Q(x)) <-> P --> (ALL x.Q(x))"];
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   158
832ccc1dba95 Introduction of miniscoping for FOL
paulson
parents: 1914
diff changeset
   159
val FOL_ss = IFOL_ss addsimps (cla_simps @ ex_simps @ all_simps);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
1914
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   161
fun int_prove nm thm  = qed_goal nm IFOL.thy thm
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   162
    (fn prems => [ (cut_facts_tac prems 1), 
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   163
                   (Int.fast_tac 1) ]);
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   164
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   165
fun prove nm thm  = qed_goal nm FOL.thy thm (fn _ => [fast_tac FOL_cs 1]);
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   166
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   167
int_prove "conj_commute" "P&Q <-> Q&P";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   168
int_prove "conj_left_commute" "P&(Q&R) <-> Q&(P&R)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   169
val conj_comms = [conj_commute, conj_left_commute];
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   170
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   171
int_prove "disj_commute" "P|Q <-> Q|P";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   172
int_prove "disj_left_commute" "P|(Q|R) <-> Q|(P|R)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   173
val disj_comms = [disj_commute, disj_left_commute];
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   174
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   175
int_prove "conj_disj_distribL" "P&(Q|R) <-> (P&Q | P&R)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   176
int_prove "conj_disj_distribR" "(P|Q)&R <-> (P&R | Q&R)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   177
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   178
int_prove "disj_conj_distribL" "P|(Q&R) <-> (P|Q) & (P|R)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   179
int_prove "disj_conj_distribR" "(P&Q)|R <-> (P|R) & (Q|R)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   180
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   181
int_prove "imp_conj_distrib" "(P --> (Q&R)) <-> (P-->Q) & (P-->R)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   182
int_prove "imp_conj"         "((P&Q)-->R)   <-> (P --> (Q --> R))";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   183
int_prove "imp_disj"         "(P|Q --> R)   <-> (P-->R) & (Q-->R)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   184
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   185
int_prove "de_Morgan_disj" "(~(P | Q)) <-> (~P & ~Q)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   186
prove     "de_Morgan_conj" "(~(P & Q)) <-> (~P | ~Q)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   187
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   188
prove     "not_iff" "~(P <-> Q) <-> (P <-> ~Q)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   189
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   190
prove     "not_all" "(~ (ALL x.P(x))) <-> (EX x.~P(x))";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   191
prove     "imp_all" "((ALL x.P(x)) --> Q) <-> (EX x.P(x) --> Q)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   192
int_prove "not_ex"  "(~ (EX x.P(x))) <-> (ALL x.~P(x))";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   193
int_prove "imp_ex" "((EX x. P(x)) --> Q) <-> (ALL x. P(x) --> Q)";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   194
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   195
int_prove "ex_disj_distrib"
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   196
    "(EX x. P(x) | Q(x)) <-> ((EX x. P(x)) | (EX x. Q(x)))";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   197
int_prove "all_conj_distrib"
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   198
    "(ALL x. P(x) & Q(x)) <-> ((ALL x. P(x)) & (ALL x. Q(x)))";
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   199
86b095835de9 Added a lot of basic laws, from HOL/simpdata
paulson
parents: 1722
diff changeset
   200
1088
fc4fb6e8a636 Imported meta_eq_to_obj_eq from HOL for use with 'split'.
lcp
parents: 981
diff changeset
   201
(*Used in ZF, perhaps elsewhere?*)
fc4fb6e8a636 Imported meta_eq_to_obj_eq from HOL for use with 'split'.
lcp
parents: 981
diff changeset
   202
val meta_eq_to_obj_eq = prove_goal IFOL.thy "x==y ==> x=y"
fc4fb6e8a636 Imported meta_eq_to_obj_eq from HOL for use with 'split'.
lcp
parents: 981
diff changeset
   203
  (fn [prem] => [rewtac prem, rtac refl 1]);
fc4fb6e8a636 Imported meta_eq_to_obj_eq from HOL for use with 'split'.
lcp
parents: 981
diff changeset
   204
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   205
(*** case splitting ***)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   206
1088
fc4fb6e8a636 Imported meta_eq_to_obj_eq from HOL for use with 'split'.
lcp
parents: 981
diff changeset
   207
qed_goal "meta_iffD" IFOL.thy "[| P==Q; Q |] ==> P"
756
e0e5c1581e4c added qed_goal for meta_iffD
clasohm
parents: 745
diff changeset
   208
        (fn [prem1,prem2] => [rewtac prem1, rtac prem2 1]);
282
731b27c90d2f FOL/simpdata: tidied
lcp
parents: 215
diff changeset
   209
942
d9edeb96b51c Enforced partial evaluation of mk_case_split_tac.
nipkow
parents: 784
diff changeset
   210
local val mktac = mk_case_split_tac meta_iffD
d9edeb96b51c Enforced partial evaluation of mk_case_split_tac.
nipkow
parents: 784
diff changeset
   211
in
d9edeb96b51c Enforced partial evaluation of mk_case_split_tac.
nipkow
parents: 784
diff changeset
   212
fun split_tac splits = mktac (map mk_meta_eq splits)
d9edeb96b51c Enforced partial evaluation of mk_case_split_tac.
nipkow
parents: 784
diff changeset
   213
end;
1722
bb326972ede6 Added split_inside_tac.
berghofe
parents: 1459
diff changeset
   214
bb326972ede6 Added split_inside_tac.
berghofe
parents: 1459
diff changeset
   215
local val mktac = mk_case_split_inside_tac meta_iffD
bb326972ede6 Added split_inside_tac.
berghofe
parents: 1459
diff changeset
   216
in
bb326972ede6 Added split_inside_tac.
berghofe
parents: 1459
diff changeset
   217
fun split_inside_tac splits = mktac (map mk_meta_eq splits)
bb326972ede6 Added split_inside_tac.
berghofe
parents: 1459
diff changeset
   218
end;
bb326972ede6 Added split_inside_tac.
berghofe
parents: 1459
diff changeset
   219
bb326972ede6 Added split_inside_tac.
berghofe
parents: 1459
diff changeset
   220