src/HOL/simpdata.ML
author nipkow
Thu, 11 Apr 1996 08:30:25 +0200
changeset 1655 5be64540f275
parent 1548 afe750876848
child 1660 8cb42cd97579
permissions -rw-r--r--
Added a number of lemmas
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
     1
(*  Title:      HOL/simpdata.ML
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
     3
    Author:     Tobias Nipkow
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
Instantiation of the generic simplifier
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     9
open Simplifier;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
local
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
fun prover s = prove_goal HOL.thy s (fn _ => [fast_tac HOL_cs 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
val P_imp_P_iff_True = prover "P --> (P = True)" RS mp;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
val P_imp_P_eq_True = P_imp_P_iff_True RS eq_reflection;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
val not_P_imp_P_iff_F = prover "~P --> (P = False)" RS mp;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
val not_P_imp_P_eq_False = not_P_imp_P_iff_F RS eq_reflection;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
fun atomize pairs =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
  let fun atoms th =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
        (case concl_of th of
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
           Const("Trueprop",_) $ p =>
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
             (case head_of p of
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
                Const(a,_) =>
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
                  (case assoc(pairs,a) of
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
                     Some(rls) => flat (map atoms ([th] RL rls))
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
                   | None => [th])
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
              | _ => [th])
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
         | _ => [th])
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
  in atoms end;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
fun mk_meta_eq r = case concl_of r of
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    35
        Const("==",_)$_$_ => r
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    36
    |   _$(Const("op =",_)$_$_) => r RS eq_reflection
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    37
    |   _$(Const("not",_)$_) => r RS not_P_imp_P_eq_False
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
    |   _ => r RS P_imp_P_eq_True;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
(* last 2 lines requires all formulae to be of the from Trueprop(.) *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    41
fun gen_all th = forall_elim_vars (#maxidx(rep_thm th)+1) th;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
val imp_cong = impI RSN
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    44
    (2, prove_goal HOL.thy "(P=P')--> (P'--> (Q=Q'))--> ((P-->Q) = (P'-->Q'))"
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    45
        (fn _=> [fast_tac HOL_cs 1]) RS mp RS mp);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    46
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
val o_apply = prove_goalw HOL.thy [o_def] "(f o g)(x) = f(g(x))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
 (fn _ => [rtac refl 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
val simp_thms = map prover
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
 [ "(x=x) = True",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
   "(~True) = False", "(~False) = True", "(~ ~ P) = P",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
   "(~P) ~= P", "P ~= (~P)", "(P ~= Q) = (P = (~Q))",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    54
   "(True=P) = P", "(P=True) = P",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
   "(True --> P) = P", "(False --> P) = True", 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
   "(P --> True) = True", "(P --> P) = True",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    57
   "(P --> False) = (~P)", "(P --> ~P) = (~P)",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
   "(P & True) = P", "(True & P) = P", 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
   "(P & False) = False", "(False & P) = False", "(P & P) = P",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
   "(P | True) = True", "(True | P) = True", 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
   "(P | False) = P", "(False | P) = P", "(P | P) = P",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
   "(!x.P) = P", "(? x.P) = P", "? x. x=t", "(? x. x=t & P(x)) = P(t)",
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
   "(P|Q --> R) = ((P-->R)&(Q-->R))" ];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
in
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
val meta_eq_to_obj_eq = prove_goal HOL.thy "x==y ==> x=y"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    68
  (fn [prem] => [rewtac prem, rtac refl 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
val eq_sym_conv = prover "(x=y) = (y=x)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
val conj_assoc = prover "((P&Q)&R) = (P&(Q&R))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
    74
val if_True = prove_goalw HOL.thy [if_def] "(if True then x else y) = x"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    75
 (fn _=>[fast_tac (HOL_cs addIs [select_equality]) 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    76
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
    77
val if_False = prove_goalw HOL.thy [if_def] "(if False then x else y) = y"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
 (fn _=>[fast_tac (HOL_cs addIs [select_equality]) 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
    80
val if_P = prove_goal HOL.thy "P ==> (if P then x else y) = x"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
 (fn [prem] => [ stac (prem RS eqTrueI) 1, rtac if_True 1 ]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    82
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
    83
val if_not_P = prove_goal HOL.thy "~P ==> (if P then x else y) = y"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
 (fn [prem] => [ stac (prem RS not_P_imp_P_iff_F) 1, rtac if_False 1 ]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
val expand_if = prove_goal HOL.thy
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
    87
    "P(if Q then x else y) = ((Q --> P(x)) & (~Q --> P(y)))"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
 (fn _=> [ (res_inst_tac [("Q","Q")] (excluded_middle RS disjE) 1),
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    89
         rtac (if_P RS ssubst) 2,
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    90
         rtac (if_not_P RS ssubst) 1,
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    91
         REPEAT(fast_tac HOL_cs 1) ]);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
    93
val if_bool_eq = prove_goal HOL.thy
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
    94
                   "(if P then Q else R) = ((P-->Q) & (~P-->R))"
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
    95
                   (fn _ => [rtac expand_if 1]);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
988
8317adb1c444 Defined addss to perform simplification in a claset.
lcp
parents: 965
diff changeset
    97
(*Add congruence rules for = (instead of ==) *)
8317adb1c444 Defined addss to perform simplification in a claset.
lcp
parents: 965
diff changeset
    98
infix 4 addcongs;
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    99
fun ss addcongs congs = ss addeqcongs (congs RL [eq_reflection]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   100
1264
3eb91524b938 added local simpsets; removed IOA from 'make test'
clasohm
parents: 988
diff changeset
   101
fun Addcongs congs = (simpset := !simpset addcongs congs);
3eb91524b938 added local simpsets; removed IOA from 'make test'
clasohm
parents: 988
diff changeset
   102
988
8317adb1c444 Defined addss to perform simplification in a claset.
lcp
parents: 965
diff changeset
   103
(*Add a simpset to a classical set!*)
8317adb1c444 Defined addss to perform simplification in a claset.
lcp
parents: 965
diff changeset
   104
infix 4 addss;
8317adb1c444 Defined addss to perform simplification in a claset.
lcp
parents: 965
diff changeset
   105
fun cs addss ss = cs addbefore asm_full_simp_tac ss 1;
8317adb1c444 Defined addss to perform simplification in a claset.
lcp
parents: 965
diff changeset
   106
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   107
val mksimps_pairs =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   108
  [("op -->", [mp]), ("op &", [conjunct1,conjunct2]),
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   109
   ("All", [spec]), ("True", []), ("False", []),
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
   110
   ("If", [if_bool_eq RS iffD1])];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   111
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   112
fun mksimps pairs = map mk_meta_eq o atomize pairs o gen_all;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   113
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   114
val HOL_ss = empty_ss
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   115
      setmksimps (mksimps mksimps_pairs)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   116
      setsolver (fn prems => resolve_tac (TrueI::refl::prems) ORELSE' atac
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   117
                             ORELSE' etac FalseE)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   118
      setsubgoaler asm_simp_tac
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   119
      addsimps ([if_True, if_False, o_apply, conj_assoc] @ simp_thms)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   120
      addcongs [imp_cong];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   121
941
f8a202891ac9 Enforced partial evaluation of mk_case_split_tac
nipkow
parents: 923
diff changeset
   122
local val mktac = mk_case_split_tac (meta_eq_to_obj_eq RS iffD2)
f8a202891ac9 Enforced partial evaluation of mk_case_split_tac
nipkow
parents: 923
diff changeset
   123
in
f8a202891ac9 Enforced partial evaluation of mk_case_split_tac
nipkow
parents: 923
diff changeset
   124
fun split_tac splits = mktac (map mk_meta_eq splits)
f8a202891ac9 Enforced partial evaluation of mk_case_split_tac
nipkow
parents: 923
diff changeset
   125
end;
f8a202891ac9 Enforced partial evaluation of mk_case_split_tac
nipkow
parents: 923
diff changeset
   126
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   127
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   128
(* eliminiation of existential quantifiers in assumptions *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   129
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   130
val ex_all_equiv =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   131
  let val lemma1 = prove_goal HOL.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   132
        "(? x. P(x) ==> PROP Q) ==> (!!x. P(x) ==> PROP Q)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
        (fn prems => [resolve_tac prems 1, etac exI 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   134
      val lemma2 = prove_goalw HOL.thy [Ex_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   135
        "(!!x. P(x) ==> PROP Q) ==> (? x. P(x) ==> PROP Q)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   136
        (fn prems => [REPEAT(resolve_tac prems 1)])
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   137
  in equal_intr lemma1 lemma2 end;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   138
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   139
(* '&' congruence rule: not included by default!
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   140
   May slow rewrite proofs down by as much as 50% *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   141
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   142
val conj_cong = impI RSN
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   143
    (2, prove_goal HOL.thy "(P=P')--> (P'--> (Q=Q'))--> ((P&Q) = (P'&Q'))"
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
   144
        (fn _=> [fast_tac HOL_cs 1]) RS mp RS mp);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   145
1548
afe750876848 Added 'section' commands
nipkow
parents: 1485
diff changeset
   146
val rev_conj_cong = impI RSN
afe750876848 Added 'section' commands
nipkow
parents: 1485
diff changeset
   147
    (2, prove_goal HOL.thy "(Q=Q')--> (Q'--> (P=P'))--> ((P&Q) = (P'&Q'))"
afe750876848 Added 'section' commands
nipkow
parents: 1485
diff changeset
   148
        (fn _=> [fast_tac HOL_cs 1]) RS mp RS mp);
afe750876848 Added 'section' commands
nipkow
parents: 1485
diff changeset
   149
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   150
(** 'if' congruence rules: neither included by default! *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   151
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   152
(*Simplifies x assuming c and y assuming ~c*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   153
val if_cong = prove_goal HOL.thy
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
   154
  "[| b=c; c ==> x=u; ~c ==> y=v |] ==>\
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
   155
\  (if b then x else y) = (if c then u else v)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   156
  (fn rew::prems =>
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   157
   [stac rew 1, stac expand_if 1, stac expand_if 1,
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   158
    fast_tac (HOL_cs addDs prems) 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   159
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   160
(*Prevents simplification of x and y: much faster*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   161
val if_weak_cong = prove_goal HOL.thy
965
24eef3860714 changed syntax of "if"
clasohm
parents: 941
diff changeset
   162
  "b=c ==> (if b then x else y) = (if c then x else y)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   163
  (fn [prem] => [rtac (prem RS arg_cong) 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   164
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   165
(*Prevents simplification of t: much faster*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   166
val let_weak_cong = prove_goal HOL.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   167
  "a = b ==> (let x=a in t(x)) = (let x=b in t(x))"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   168
  (fn [prem] => [rtac (prem RS arg_cong) 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   169
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   170
end;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   171
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   172
fun prove nm thm  = qed_goal nm HOL.thy thm (fn _ => [fast_tac HOL_cs 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   173
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   174
prove "conj_commute" "(P&Q) = (Q&P)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   175
prove "conj_left_commute" "(P&(Q&R)) = (Q&(P&R))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   176
val conj_comms = [conj_commute, conj_left_commute];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   177
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   178
prove "conj_disj_distribL" "(P&(Q|R)) = (P&Q | P&R)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   179
prove "conj_disj_distribR" "((P|Q)&R) = (P&R | Q&R)";
1485
240cc98b94a7 Added qed_spec_mp to avoid renaming of bound vars in 'th RS spec'
nipkow
parents: 1465
diff changeset
   180
240cc98b94a7 Added qed_spec_mp to avoid renaming of bound vars in 'th RS spec'
nipkow
parents: 1465
diff changeset
   181
prove "de_Morgan_disj" "(~(P | Q)) = (~P & ~Q)";
240cc98b94a7 Added qed_spec_mp to avoid renaming of bound vars in 'th RS spec'
nipkow
parents: 1465
diff changeset
   182
prove "de_Morgan_conj" "(~(P & Q)) = (~P | ~Q)";
240cc98b94a7 Added qed_spec_mp to avoid renaming of bound vars in 'th RS spec'
nipkow
parents: 1465
diff changeset
   183
1655
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   184
prove "ex_disj_distrib" "(? x. P(x) | Q(x)) = ((? x. P(x)) | (? x. Q(x)))";
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   185
prove "all_conj_distrib" "(!x. P(x) & Q(x)) = ((! x. P(x)) & (! x. Q(x)))";
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   186
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   187
qed_goal "if_cancel" HOL.thy "(if c then x else x) = x"
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   188
  (fn _ => [simp_tac (HOL_ss setloop (split_tac [expand_if])) 1]);
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   189
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   190
qed_goal "if_distrib" HOL.thy
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   191
  "f(if c then x else y) = (if c then f x else f y)" 
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   192
  (fn _ => [simp_tac (HOL_ss setloop (split_tac [expand_if])) 1]);
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   193
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   194
qed_goalw "o_assoc" HOL.thy [o_def] "(f o g) o h = (f o g o h)"
5be64540f275 Added a number of lemmas
nipkow
parents: 1548
diff changeset
   195
  (fn _=>[rtac ext 1, rtac refl 1]);