src/HOL/cladata.ML
author wenzelm
Fri, 10 Oct 1997 19:02:28 +0200
changeset 3842 b55686a7b22c
parent 3615 e5322197cfea
child 4059 59c1422c9da5
permissions -rw-r--r--
fixed dots;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     1
(*  Title:      HOL/cladata.ML
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     2
    ID:         $Id$
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     3
    Author:     Tobias Nipkow
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     5
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     6
Setting up the classical reasoner 
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     7
*)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     8
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     9
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    10
(** Applying HypsubstFun to generate hyp_subst_tac **)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    11
section "Classical Reasoner";
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    12
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    13
structure Hypsubst_Data =
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    14
  struct
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    15
  structure Simplifier = Simplifier
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    16
  (*Take apart an equality judgement; otherwise raise Match!*)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    17
  fun dest_eq (Const("Trueprop",_) $ (Const("op =",_)  $ t $ u)) = (t,u);
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    18
  val eq_reflection = eq_reflection
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    19
  val imp_intr = impI
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    20
  val rev_mp = rev_mp
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    21
  val subst = subst
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    22
  val sym = sym
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    23
  end;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    24
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    25
structure Hypsubst = HypsubstFun(Hypsubst_Data);
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    26
open Hypsubst;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    27
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    28
(*** Applying ClassicalFun to create a classical prover ***)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    29
structure Classical_Data = 
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    30
  struct
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    31
  val sizef     = size_of_thm
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    32
  val mp        = mp
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    33
  val not_elim  = notE
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    34
  val classical = classical
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    35
  val hyp_subst_tacs=[hyp_subst_tac]
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    36
  end;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    37
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    38
structure Classical = ClassicalFun(Classical_Data);
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    39
open Classical;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    40
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    41
(*Propositional rules*)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    42
val prop_cs = empty_cs addSIs [refl,TrueI,conjI,disjCI,impI,notI,iffI]
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    43
                       addSEs [conjE,disjE,impCE,FalseE,iffE];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    44
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    45
(*Quantifier rules*)
3004
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    46
val HOL_cs = prop_cs addSIs [allI,ex_ex1I] addIs [exI] 
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    47
                     addSEs [exE] addEs [allE];
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    48
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    49
exception CS_DATA of claset;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    50
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    51
let fun merge [] = CS_DATA empty_cs
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    52
      | merge cs = let val cs = map (fn CS_DATA x => x) cs;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    53
                   in CS_DATA (foldl merge_cs (hd cs, tl cs)) end;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    54
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    55
    fun put (CS_DATA cs) = claset := cs;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    56
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    57
    fun get () = CS_DATA (!claset);
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    58
in add_thydata "HOL"
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    59
     ("claset", ThyMethods {merge = merge, put = put, get = get})
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    60
end;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    61
3615
e5322197cfea Moved some functions which used to be part of thy_data.ML
berghofe
parents: 3004
diff changeset
    62
fun claset_of tname =
e5322197cfea Moved some functions which used to be part of thy_data.ML
berghofe
parents: 3004
diff changeset
    63
  case get_thydata tname "claset" of
e5322197cfea Moved some functions which used to be part of thy_data.ML
berghofe
parents: 3004
diff changeset
    64
      None => empty_cs
e5322197cfea Moved some functions which used to be part of thy_data.ML
berghofe
parents: 3004
diff changeset
    65
    | Some (CS_DATA cs) => cs;
e5322197cfea Moved some functions which used to be part of thy_data.ML
berghofe
parents: 3004
diff changeset
    66
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    67
claset := HOL_cs;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    68
3004
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    69
(*Better then ex1E for classical reasoner: needs no quantifier duplication!*)
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    70
qed_goal "alt_ex1E" thy
3842
b55686a7b22c fixed dots;
wenzelm
parents: 3615
diff changeset
    71
    "[| ?! x. P(x);                                              \
3004
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    72
\       !!x. [| P(x);  ALL y y'. P(y) & P(y') --> y=y' |] ==> R  \
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    73
\    |] ==> R"
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    74
 (fn major::prems =>
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    75
  [ (rtac (major RS ex1E) 1),
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    76
    (REPEAT (ares_tac (allI::prems) 1)),
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    77
    (etac (dup_elim allE) 1),
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    78
    (Fast_tac 1)]);
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    79
8036aaf49f70 New elimination rule for "unique existence"
paulson
parents: 2882
diff changeset
    80
AddSEs [alt_ex1E];
2860
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    81
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    82
(*** Applying BlastFun to create Blast_tac ***)
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    83
structure Blast_Data = 
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    84
  struct
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    85
  type claset	= Classical.claset
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    86
  val notE	= notE
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    87
  val ccontr	= ccontr
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    88
  val contr_tac = Classical.contr_tac
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    89
  val dup_intr	= Classical.dup_intr
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    90
  val vars_gen_hyp_subst_tac = Hypsubst.vars_gen_hyp_subst_tac
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    91
  val claset	= Classical.claset
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    92
  val rep_claset = Classical.rep_claset
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    93
  end;
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    94
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    95
structure Blast = BlastFun(Blast_Data);
2882
2563063772d9 Declares overloading for if-and-only-if
paulson
parents: 2860
diff changeset
    96
Blast.declConsts (["op ="], [iffI]);	(*overloading of equality as iff*)
2860
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    97
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    98
val Blast_tac = Blast.Blast_tac
6dde30a9e905 Installation of blast_tac
paulson
parents: 1985
diff changeset
    99
and blast_tac = Blast.blast_tac;