src/ZF/simpdata.ML
author wenzelm
Wed Oct 03 22:33:17 2007 +0200 (2007-10-03)
changeset 24826 78e6a3cea367
parent 18735 f5fd06394f17
child 24893 b8ef7afe3a6b
permissions -rw-r--r--
avoid unnamed infixes;
clasohm@0
     1
(*  Title:      ZF/simpdata
clasohm@0
     2
    ID:         $Id$
clasohm@0
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1991  University of Cambridge
clasohm@0
     5
paulson@2469
     6
Rewriting for ZF set theory: specialized extraction of rewrites from theorems
clasohm@0
     7
*)
clasohm@0
     8
paulson@12199
     9
(*** New version of mk_rew_rules ***)
clasohm@0
    10
clasohm@0
    11
(*Should False yield False<->True, or should it solve goals some other way?*)
clasohm@0
    12
lcp@1036
    13
(*Analyse a theorem to atomic rewrite rules*)
wenzelm@13462
    14
fun atomize (conn_pairs, mem_pairs) th =
lcp@1036
    15
  let fun tryrules pairs t =
clasohm@1461
    16
          case head_of t of
wenzelm@13462
    17
              Const(a,_) =>
haftmann@17325
    18
                (case AList.lookup (op =) pairs a of
skalberg@15570
    19
                     SOME rls => List.concat (map (atomize (conn_pairs, mem_pairs))
clasohm@1461
    20
                                       ([th] RL rls))
skalberg@15531
    21
                   | NONE     => [th])
clasohm@1461
    22
            | _ => [th]
wenzelm@13462
    23
  in case concl_of th of
wenzelm@13462
    24
         Const("Trueprop",_) $ P =>
clasohm@1461
    25
            (case P of
wenzelm@24826
    26
                 Const(@{const_name mem},_) $ a $ b => tryrules mem_pairs b
clasohm@1461
    27
               | Const("True",_)         => []
clasohm@1461
    28
               | Const("False",_)        => []
clasohm@1461
    29
               | A => tryrules conn_pairs A)
lcp@1036
    30
       | _                       => [th]
lcp@1036
    31
  end;
lcp@1036
    32
clasohm@0
    33
(*Analyse a rigid formula*)
lcp@1036
    34
val ZF_conn_pairs =
wenzelm@13462
    35
  [("Ball",     [bspec]),
clasohm@1461
    36
   ("All",      [spec]),
clasohm@1461
    37
   ("op -->",   [mp]),
clasohm@1461
    38
   ("op &",     [conjunct1,conjunct2])];
clasohm@0
    39
clasohm@0
    40
(*Analyse a:b, where b is rigid*)
wenzelm@13462
    41
val ZF_mem_pairs =
clasohm@1461
    42
  [("Collect",  [CollectD1,CollectD2]),
wenzelm@24826
    43
   (@{const_name Diff},     [DiffD1,DiffD2]),
wenzelm@24826
    44
   (@{const_name Int},   [IntD1,IntD2])];
clasohm@0
    45
lcp@1036
    46
val ZF_atomize = atomize (ZF_conn_pairs, ZF_mem_pairs);
lcp@1036
    47
wenzelm@17876
    48
change_simpset (fn ss =>
wenzelm@17876
    49
  ss setmksimps (map mk_eq o ZF_atomize o gen_all)
wenzelm@18735
    50
  addcongs [if_weak_cong]);
wenzelm@12209
    51
wenzelm@13462
    52
local
paulson@11233
    53
wenzelm@18324
    54
val unfold_bex_tac = unfold_tac [Bex_def];
wenzelm@18324
    55
fun prove_bex_tac ss = unfold_bex_tac ss THEN Quantifier1.prove_one_point_ex_tac;
paulson@11233
    56
val rearrange_bex = Quantifier1.rearrange_bex prove_bex_tac;
paulson@11233
    57
wenzelm@18324
    58
val unfold_ball_tac = unfold_tac [Ball_def];
wenzelm@18324
    59
fun prove_ball_tac ss = unfold_ball_tac ss THEN Quantifier1.prove_one_point_all_tac;
paulson@11233
    60
val rearrange_ball = Quantifier1.rearrange_ball prove_ball_tac;
paulson@11233
    61
paulson@11233
    62
in
paulson@11233
    63
wenzelm@17002
    64
val defBEX_regroup = Simplifier.simproc (the_context ())
wenzelm@13462
    65
  "defined BEX" ["EX x:A. P(x) & Q(x)"] rearrange_bex;
wenzelm@13462
    66
wenzelm@17002
    67
val defBALL_regroup = Simplifier.simproc (the_context ())
wenzelm@13462
    68
  "defined BALL" ["ALL x:A. P(x) --> Q(x)"] rearrange_ball;
paulson@11233
    69
paulson@11233
    70
end;
paulson@11233
    71
wenzelm@13462
    72
Addsimprocs [defBALL_regroup, defBEX_regroup];
wenzelm@13462
    73
paulson@12199
    74
wenzelm@4091
    75
val ZF_ss = simpset();