author haftmann Mon Jan 30 08:20:56 2006 +0100 (2006-01-30) changeset 18851 9502ce541f01 parent 18708 4b3dadb4fe33 child 20223 89d2758ecddf permissions -rw-r--r--
```     1 (*  Title:      HOL/cladata.ML
```
```     2     ID:         \$Id\$
```
```     3     Author:     Tobias Nipkow
```
```     4     Copyright   1996  University of Cambridge
```
```     5
```
```     6 Setting up the classical reasoner.
```
```     7 *)
```
```     8
```
```     9
```
```    10 (** Applying HypsubstFun to generate hyp_subst_tac **)
```
```    11 section "Classical Reasoner";
```
```    12
```
```    13 structure Hypsubst_Data =
```
```    14   struct
```
```    15   structure Simplifier = Simplifier
```
```    16   (*Take apart an equality judgement; otherwise raise Match!*)
```
```    17   fun dest_eq (Const("op =",T)  \$ t \$ u) = (t, u, domain_type T)
```
```    18   val dest_Trueprop = HOLogic.dest_Trueprop
```
```    19   val dest_imp = HOLogic.dest_imp
```
```    20   val eq_reflection = eq_reflection
```
```    21   val rev_eq_reflection = def_imp_eq
```
```    22   val imp_intr = impI
```
```    23   val rev_mp = rev_mp
```
```    24   val subst = subst
```
```    25   val sym = sym
```
```    26   val thin_refl = prove_goal (the_context ())
```
```    27 		  "!!X. [|x=x; PROP W|] ==> PROP W" (K [atac 1]);
```
```    28   end;
```
```    29
```
```    30 structure Hypsubst = HypsubstFun(Hypsubst_Data);
```
```    31 open Hypsubst;
```
```    32
```
```    33 (*prevent substitution on bool*)
```
```    34 fun hyp_subst_tac' i thm = if i <= Thm.nprems_of thm andalso
```
```    35   Term.exists_Const (fn ("op =", Type (_, [T, _])) => T <> Type ("bool", []) | _ => false)
```
```    36     (List.nth (Thm.prems_of thm, i - 1)) then hyp_subst_tac i thm else no_tac thm;
```
```    37
```
```    38
```
```    39 (*** Applying ClassicalFun to create a classical prover ***)
```
```    40 structure Classical_Data =
```
```    41   struct
```
```    42   val mp        = mp
```
```    43   val not_elim  = notE
```
```    44   val classical = classical
```
```    45   val sizef     = size_of_thm
```
```    46   val hyp_subst_tacs=[hyp_subst_tac]
```
```    47   end;
```
```    48
```
```    49 structure Classical = ClassicalFun(Classical_Data);
```
```    50
```
```    51 structure BasicClassical: BASIC_CLASSICAL = Classical;
```
```    52
```
```    53 open BasicClassical;
```
```    54
```
```    55 val _ = bind_thm ("contrapos_np", inst "Pa" "?Q" Classical.swap);
```
```    56
```
```    57 (*Propositional rules*)
```
```    58 val prop_cs = empty_cs addSIs [refl,TrueI,conjI,disjCI,impI,notI,iffI]
```
```    59                        addSEs [conjE,disjE,impCE,FalseE,iffCE];
```
```    60
```
```    61 (*Quantifier rules*)
```
```    62 val HOL_cs = prop_cs addSIs [allI,ex_ex1I] addIs [exI, the_equality]
```
```    63                      addSEs [exE] addEs [allE];
```
```    64
```
```    65 val clasetup = (fn thy => (change_claset_of thy (fn _ => HOL_cs); thy));
```