src/FOL/cladata.ML
author paulson
Wed, 02 Apr 1997 15:19:40 +0200
changeset 2867 0aa5a3cd4550
parent 2844 05d78159812d
child 3610 7e5300420b03
permissions -rw-r--r--
Now builds blast_tac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     1
(*  Title:      FOL/cladata.ML
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     2
    ID:         $Id$
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     3
    Author:     Tobias Nipkow
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     5
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     6
Setting up the classical reasoner 
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     7
*)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     8
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
     9
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    10
section "Classical Reasoner";
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    11
2844
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    12
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    13
(*** Applying ClassicalFun to create a classical prover ***)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    14
structure Classical_Data = 
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    15
  struct
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    16
  val sizef     = size_of_thm
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    17
  val mp        = mp
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    18
  val not_elim  = notE
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    19
  val classical = classical
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    20
  val hyp_subst_tacs=[hyp_subst_tac]
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    21
  end;
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    22
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    23
structure Cla = ClassicalFun(Classical_Data);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    24
open Cla;
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    25
2844
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    26
(*Better for fast_tac: needs no quantifier duplication!*)
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    27
qed_goal "alt_ex1E" IFOL.thy
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    28
    "[| EX! x.P(x);                                              \
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    29
\       !!x. [| P(x);  ALL y y'. P(y) & P(y') --> y=y' |] ==> R  \
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    30
\    |] ==> R"
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    31
 (fn major::prems =>
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    32
  [ (rtac (major RS ex1E) 1),
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    33
    (REPEAT (ares_tac (allI::prems) 1)),
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    34
    (etac (dup_elim allE) 1),
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    35
    (IntPr.fast_tac 1)]);
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    36
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    37
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    38
(*Propositional rules 
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    39
  -- iffCE might seem better, but in the examples in ex/cla
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    40
     run about 7% slower than with iffE*)
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    41
val prop_cs = empty_cs addSIs [refl,TrueI,conjI,disjCI,impI,notI,iffI] 
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    42
                       addSEs [conjE,disjE,impCE,FalseE,iffE];
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    43
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    44
(*Quantifier rules*)
2844
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    45
val FOL_cs = prop_cs addSIs [allI,ex_ex1I] addIs [exI] 
05d78159812d Now uses the alternative (safe!) rules for ex1
paulson
parents: 2469
diff changeset
    46
                     addSEs [exE,alt_ex1E] addEs [allE];
2469
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    47
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    48
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    49
exception CS_DATA of claset;
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    50
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    51
let fun merge [] = CS_DATA empty_cs
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    52
      | merge cs = let val cs = map (fn CS_DATA x => x) cs;
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    53
                   in CS_DATA (foldl merge_cs (hd cs, tl cs)) end;
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    54
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    55
    fun put (CS_DATA cs) = claset := cs;
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    56
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    57
    fun get () = CS_DATA (!claset);
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    58
in add_thydata "FOL"
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    59
     ("claset", ThyMethods {merge = merge, put = put, get = get})
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    60
end;
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    61
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    62
claset := FOL_cs;
b50b8c0eec01 Implicit simpsets and clasets for FOL and ZF
paulson
parents:
diff changeset
    63
2867
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    64
(*** Applying BlastFun to create Blast_tac ***)
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    65
structure Blast_Data = 
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    66
  struct
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    67
  type claset	= Cla.claset
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    68
  val notE	= notE
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    69
  val ccontr	= ccontr
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    70
  val contr_tac = Cla.contr_tac
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    71
  val dup_intr	= Cla.dup_intr
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    72
  val vars_gen_hyp_subst_tac = Hypsubst.vars_gen_hyp_subst_tac
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    73
  val claset	= Cla.claset
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    74
  val rep_claset = Cla.rep_claset
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    75
  end;
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    76
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    77
structure Blast = BlastFun(Blast_Data);
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    78
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    79
val Blast_tac = Blast.Blast_tac
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    80
and blast_tac = Blast.blast_tac;
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    81
0aa5a3cd4550 Now builds blast_tac
paulson
parents: 2844
diff changeset
    82