src/HOL/cladata.ML
author berghofe
Wed Aug 06 01:13:46 1997 +0200 (1997-08-06)
changeset 3615 e5322197cfea
parent 3004 8036aaf49f70
child 3842 b55686a7b22c
permissions -rw-r--r--
Moved some functions which used to be part of thy_data.ML
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
paulson@1985
     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@1985
    17
  fun dest_eq (Const("Trueprop",_) $ (Const("op =",_)  $ t $ u)) = (t,u);
paulson@1985
    18
  val eq_reflection = eq_reflection
paulson@1985
    19
  val imp_intr = impI
paulson@1985
    20
  val rev_mp = rev_mp
paulson@1985
    21
  val subst = subst
paulson@1985
    22
  val sym = sym
paulson@1985
    23
  end;
paulson@1985
    24
paulson@1985
    25
structure Hypsubst = HypsubstFun(Hypsubst_Data);
paulson@1985
    26
open Hypsubst;
paulson@1985
    27
paulson@1985
    28
(*** Applying ClassicalFun to create a classical prover ***)
paulson@1985
    29
structure Classical_Data = 
paulson@1985
    30
  struct
paulson@1985
    31
  val sizef     = size_of_thm
paulson@1985
    32
  val mp        = mp
paulson@1985
    33
  val not_elim  = notE
paulson@1985
    34
  val classical = classical
paulson@1985
    35
  val hyp_subst_tacs=[hyp_subst_tac]
paulson@1985
    36
  end;
paulson@1985
    37
paulson@1985
    38
structure Classical = ClassicalFun(Classical_Data);
paulson@1985
    39
open Classical;
paulson@1985
    40
paulson@1985
    41
(*Propositional rules*)
paulson@1985
    42
val prop_cs = empty_cs addSIs [refl,TrueI,conjI,disjCI,impI,notI,iffI]
paulson@1985
    43
                       addSEs [conjE,disjE,impCE,FalseE,iffE];
paulson@1985
    44
paulson@1985
    45
(*Quantifier rules*)
paulson@3004
    46
val HOL_cs = prop_cs addSIs [allI,ex_ex1I] addIs [exI] 
paulson@3004
    47
                     addSEs [exE] addEs [allE];
paulson@1985
    48
paulson@1985
    49
exception CS_DATA of claset;
paulson@1985
    50
paulson@1985
    51
let fun merge [] = CS_DATA empty_cs
paulson@1985
    52
      | merge cs = let val cs = map (fn CS_DATA x => x) cs;
paulson@1985
    53
                   in CS_DATA (foldl merge_cs (hd cs, tl cs)) end;
paulson@1985
    54
paulson@1985
    55
    fun put (CS_DATA cs) = claset := cs;
paulson@1985
    56
paulson@1985
    57
    fun get () = CS_DATA (!claset);
paulson@1985
    58
in add_thydata "HOL"
paulson@1985
    59
     ("claset", ThyMethods {merge = merge, put = put, get = get})
paulson@1985
    60
end;
paulson@1985
    61
berghofe@3615
    62
fun claset_of tname =
berghofe@3615
    63
  case get_thydata tname "claset" of
berghofe@3615
    64
      None => empty_cs
berghofe@3615
    65
    | Some (CS_DATA cs) => cs;
berghofe@3615
    66
paulson@1985
    67
claset := HOL_cs;
paulson@1985
    68
paulson@3004
    69
(*Better then ex1E for classical reasoner: needs no quantifier duplication!*)
paulson@3004
    70
qed_goal "alt_ex1E" thy
paulson@3004
    71
    "[| ?! x.P(x);                                              \
paulson@3004
    72
\       !!x. [| P(x);  ALL y y'. P(y) & P(y') --> y=y' |] ==> R  \
paulson@3004
    73
\    |] ==> R"
paulson@3004
    74
 (fn major::prems =>
paulson@3004
    75
  [ (rtac (major RS ex1E) 1),
paulson@3004
    76
    (REPEAT (ares_tac (allI::prems) 1)),
paulson@3004
    77
    (etac (dup_elim allE) 1),
paulson@3004
    78
    (Fast_tac 1)]);
paulson@3004
    79
paulson@3004
    80
AddSEs [alt_ex1E];
paulson@2860
    81
paulson@2860
    82
(*** Applying BlastFun to create Blast_tac ***)
paulson@2860
    83
structure Blast_Data = 
paulson@2860
    84
  struct
paulson@2860
    85
  type claset	= Classical.claset
paulson@2860
    86
  val notE	= notE
paulson@2860
    87
  val ccontr	= ccontr
paulson@2860
    88
  val contr_tac = Classical.contr_tac
paulson@2860
    89
  val dup_intr	= Classical.dup_intr
paulson@2860
    90
  val vars_gen_hyp_subst_tac = Hypsubst.vars_gen_hyp_subst_tac
paulson@2860
    91
  val claset	= Classical.claset
paulson@2860
    92
  val rep_claset = Classical.rep_claset
paulson@2860
    93
  end;
paulson@2860
    94
paulson@2860
    95
structure Blast = BlastFun(Blast_Data);
paulson@2882
    96
Blast.declConsts (["op ="], [iffI]);	(*overloading of equality as iff*)
paulson@2860
    97
paulson@2860
    98
val Blast_tac = Blast.Blast_tac
paulson@2860
    99
and blast_tac = Blast.blast_tac;