author wenzelm Tue Dec 04 02:01:31 2001 +0100 (2001-12-04) changeset 12355 c8d3c3d09080 parent 11753 02b257ef0ee2 child 15570 8d8c70b41bab permissions -rw-r--r--
hyp_subst_tac';
```     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     (Library.nth_elem (i - 1, Thm.prems_of thm)) then hyp_subst_tac i thm else no_tac thm;
```
```    37
```
```    38
```
```    39
```
```    40 (*** Applying Make_Elim_Fun to create a classical "make_elim" rule ***)
```
```    41 structure Make_Elim = Make_Elim_Fun (val classical = classical);
```
```    42
```
```    43 (*we don't redeclare the original make_elim (Tactic.make_elim) for
```
```    44   compatibliity with strange things done in many existing proofs *)
```
```    45 val cla_make_elim = Make_Elim.make_elim;
```
```    46
```
```    47 (*** Applying ClassicalFun to create a classical prover ***)
```
```    48 structure Classical_Data =
```
```    49   struct
```
```    50   val make_elim = cla_make_elim
```
```    51   val mp        = mp
```
```    52   val not_elim  = notE
```
```    53   val classical = classical
```
```    54   val sizef     = size_of_thm
```
```    55   val hyp_subst_tacs=[hyp_subst_tac]
```
```    56   end;
```
```    57
```
```    58 structure Classical = ClassicalFun(Classical_Data);
```
```    59
```
```    60 structure BasicClassical: BASIC_CLASSICAL = Classical;
```
```    61 open BasicClassical;
```
```    62
```
```    63 bind_thm ("contrapos_np", inst "Pa" "?Q" swap);
```
```    64
```
```    65 (*Propositional rules*)
```
```    66 val prop_cs = empty_cs addSIs [refl,TrueI,conjI,disjCI,impI,notI,iffI]
```
```    67                        addSEs [conjE,disjE,impCE,FalseE,iffCE];
```
```    68
```
```    69 (*Quantifier rules*)
```
```    70 val HOL_cs = prop_cs addSIs [allI,ex_ex1I] addIs [exI, the_equality]
```
```    71                      addSEs [exE] addEs [allE];
```
```    72
```
```    73 val clasetup = [fn thy => (claset_ref_of thy := HOL_cs; thy)];
```