src/HOL/cladata.ML
author skalberg
Thu Mar 03 12:43:01 2005 +0100 (2005-03-03)
changeset 15570 8d8c70b41bab
parent 12355 c8d3c3d09080
child 17876 b9c92f384109
permissions -rw-r--r--
Move towards standard functions.
paulson@1985
     1
(*  Title:      HOL/cladata.ML
paulson@1985
     2
    ID:         $Id$
paulson@1985
     3
    Author:     Tobias Nipkow
paulson@1985
     4
    Copyright   1996  University of Cambridge
paulson@1985
     5
wenzelm@4085
     6
Setting up the classical reasoner.
paulson@1985
     7
*)
paulson@1985
     8
paulson@1985
     9
paulson@1985
    10
(** Applying HypsubstFun to generate hyp_subst_tac **)
paulson@1985
    11
section "Classical Reasoner";
paulson@1985
    12
paulson@1985
    13
structure Hypsubst_Data =
paulson@1985
    14
  struct
paulson@1985
    15
  structure Simplifier = Simplifier
paulson@1985
    16
  (*Take apart an equality judgement; otherwise raise Match!*)
paulson@4466
    17
  fun dest_eq (Const("op =",T)  $ t $ u) = (t, u, domain_type T)
paulson@4466
    18
  val dest_Trueprop = HOLogic.dest_Trueprop
paulson@4466
    19
  val dest_imp = HOLogic.dest_imp
paulson@1985
    20
  val eq_reflection = eq_reflection
wenzelm@9531
    21
  val rev_eq_reflection = def_imp_eq
paulson@1985
    22
  val imp_intr = impI
paulson@1985
    23
  val rev_mp = rev_mp
paulson@1985
    24
  val subst = subst
paulson@1985
    25
  val sym = sym
wenzelm@7357
    26
  val thin_refl = prove_goal (the_context ())
oheimb@4223
    27
		  "!!X. [|x=x; PROP W|] ==> PROP W" (K [atac 1]);
paulson@1985
    28
  end;
paulson@1985
    29
paulson@1985
    30
structure Hypsubst = HypsubstFun(Hypsubst_Data);
paulson@1985
    31
open Hypsubst;
paulson@1985
    32
wenzelm@12355
    33
(*prevent substitution on bool*)
wenzelm@12355
    34
fun hyp_subst_tac' i thm = if i <= Thm.nprems_of thm andalso
wenzelm@12355
    35
  Term.exists_Const (fn ("op =", Type (_, [T, _])) => T <> Type ("bool", []) | _ => false)
skalberg@15570
    36
    (List.nth (Thm.prems_of thm, i - 1)) then hyp_subst_tac i thm else no_tac thm;
wenzelm@12355
    37
wenzelm@12355
    38
paulson@9158
    39
paulson@9158
    40
(*** Applying Make_Elim_Fun to create a classical "make_elim" rule ***)
wenzelm@9846
    41
structure Make_Elim = Make_Elim_Fun (val classical = classical);
paulson@9158
    42
paulson@9158
    43
(*we don't redeclare the original make_elim (Tactic.make_elim) for 
paulson@9158
    44
  compatibliity with strange things done in many existing proofs *)
paulson@9158
    45
val cla_make_elim = Make_Elim.make_elim;
paulson@9158
    46
paulson@1985
    47
(*** Applying ClassicalFun to create a classical prover ***)
paulson@1985
    48
structure Classical_Data = 
paulson@1985
    49
  struct
paulson@9158
    50
  val make_elim = cla_make_elim
paulson@1985
    51
  val mp        = mp
paulson@1985
    52
  val not_elim  = notE
paulson@1985
    53
  val classical = classical
paulson@9158
    54
  val sizef     = size_of_thm
oheimb@4206
    55
  val hyp_subst_tacs=[hyp_subst_tac]
paulson@1985
    56
  end;
paulson@1985
    57
paulson@1985
    58
structure Classical = ClassicalFun(Classical_Data);
paulson@10197
    59
paulson@10197
    60
structure BasicClassical: BASIC_CLASSICAL = Classical; 
paulson@10197
    61
open BasicClassical;
paulson@10197
    62
paulson@10231
    63
bind_thm ("contrapos_np", inst "Pa" "?Q" swap);
paulson@10197
    64
paulson@1985
    65
(*Propositional rules*)
paulson@1985
    66
val prop_cs = empty_cs addSIs [refl,TrueI,conjI,disjCI,impI,notI,iffI]
paulson@4305
    67
                       addSEs [conjE,disjE,impCE,FalseE,iffCE];
paulson@1985
    68
paulson@1985
    69
(*Quantifier rules*)
paulson@11451
    70
val HOL_cs = prop_cs addSIs [allI,ex_ex1I] addIs [exI, the_equality] 
paulson@3004
    71
                     addSEs [exE] addEs [allE];
paulson@1985
    72
wenzelm@7357
    73
val clasetup = [fn thy => (claset_ref_of thy := HOL_cs; thy)];