src/HOL/Hoare/hoare.ML
author wenzelm
Fri, 07 Oct 2005 22:59:18 +0200
changeset 17781 32bb237158a5
parent 15661 9ef583b08647
child 17956 369e2af8ee45
permissions -rw-r--r--
print_translation: does not handle _idtdummy;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Hoare/Hoare.ML
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
     2
    ID:         $Id$
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
     3
    Author:     Leonor Prensa Nieto & Tobias Nipkow
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
     4
    Copyright   1998 TUM
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
     5
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
     6
Derivation of the proof rules and, most importantly, the VCG tactic.
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
     7
*)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
     8
13857
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
     9
val SkipRule = thm"SkipRule";
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
    10
val BasicRule = thm"BasicRule";
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
    11
val SeqRule = thm"SeqRule";
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
    12
val CondRule = thm"CondRule";
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
    13
val WhileRule = thm"WhileRule";
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    14
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    15
(*** The tactics ***)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    16
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    17
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    18
(** The function Mset makes the theorem                                     **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    19
(** "?Mset <= {(x1,...,xn). ?P (x1,...,xn)} ==> ?Mset <= {s. ?P s}",        **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    20
(** where (x1,...,xn) are the variables of the particular program we are    **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    21
(** working on at the moment of the call                                    **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    22
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    23
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    24
local open HOLogic in
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    25
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    26
(** maps (%x1 ... xn. t) to [x1,...,xn] **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    27
fun abs2list (Const ("split",_) $ (Abs(x,T,t))) = Free (x, T)::abs2list t
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    28
  | abs2list (Abs(x,T,t)) = [Free (x, T)]
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    29
  | abs2list _ = [];
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    30
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    31
(** maps {(x1,...,xn). t} to [x1,...,xn] **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    32
fun mk_vars (Const ("Collect",_) $ T) = abs2list T
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    33
  | mk_vars _ = [];
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    34
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    35
(** abstraction of body over a tuple formed from a list of free variables. 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    36
Types are also built **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    37
fun mk_abstupleC []     body = absfree ("x", unitT, body)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    38
  | mk_abstupleC (v::w) body = let val (n,T) = dest_Free v
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    39
                               in if w=[] then absfree (n, T, body)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    40
        else let val z  = mk_abstupleC w body;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    41
                 val T2 = case z of Abs(_,T,_) => T
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    42
                        | Const (_, Type (_,[_, Type (_,[T,_])])) $ _ => T;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    43
       in Const ("split", (T --> T2 --> boolT) --> mk_prodT (T,T2) --> boolT) 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    44
          $ absfree (n, T, z) end end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    45
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    46
(** maps [x1,...,xn] to (x1,...,xn) and types**)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    47
fun mk_bodyC []      = HOLogic.unit
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    48
  | mk_bodyC (x::xs) = if xs=[] then x 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    49
               else let val (n, T) = dest_Free x ;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    50
                        val z = mk_bodyC xs;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    51
                        val T2 = case z of Free(_, T) => T
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    52
                                         | Const ("Pair", Type ("fun", [_, Type
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    53
                                            ("fun", [_, T])])) $ _ $ _ => T;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    54
                 in Const ("Pair", [T, T2] ---> mk_prodT (T, T2)) $ x $ z end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    55
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    56
fun dest_Goal (Const ("Goal", _) $ P) = P;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    57
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    58
(** maps a goal of the form:
13737
e564c3d2d174 added a few lemmas
nipkow
parents: 13696
diff changeset
    59
        1. [| P |] ==> VARS x1 ... xn {._.} _ {._.} or to [x1,...,xn]**) 
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    60
fun get_vars thm = let  val c = dest_Goal (concl_of (thm));
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    61
                        val d = Logic.strip_assums_concl c;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    62
                        val Const _ $ pre $ _ $ _ = dest_Trueprop d;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    63
      in mk_vars pre end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    64
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    65
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    66
(** Makes Collect with type **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    67
fun mk_CollectC trm = let val T as Type ("fun",[t,_]) = fastype_of trm 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    68
                      in Collect_const t $ trm end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    69
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    70
fun inclt ty = Const ("op <=", [ty,ty] ---> boolT);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    71
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    72
(** Makes "Mset <= t" **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    73
fun Mset_incl t = let val MsetT = fastype_of t 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    74
                 in mk_Trueprop ((inclt MsetT) $ Free ("Mset", MsetT) $ t) end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    75
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    76
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    77
fun Mset thm = let val vars = get_vars(thm);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    78
                   val varsT = fastype_of (mk_bodyC vars);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    79
                   val big_Collect = mk_CollectC (mk_abstupleC vars 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    80
                         (Free ("P",varsT --> boolT) $ mk_bodyC vars));
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    81
                   val small_Collect = mk_CollectC (Abs("x",varsT,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    82
                           Free ("P",varsT --> boolT) $ Bound 0));
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    83
                   val impl = implies $ (Mset_incl big_Collect) $ 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    84
                                          (Mset_incl small_Collect);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    85
   in Tactic.prove (Thm.sign_of_thm thm) ["Mset", "P"] [] impl (K (CLASET' blast_tac 1)) end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    86
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    87
end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    88
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    89
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    90
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    91
(** Simplifying:                                                            **)
15661
9ef583b08647 reverted renaming of Some/None in comments and strings;
wenzelm
parents: 15531
diff changeset
    92
(** Some useful lemmata, lists and simplification tactics to control which  **)
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    93
(** theorems are used to simplify at each moment, so that the original      **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    94
(** input does not suffer any unexpected transformation                     **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    95
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    96
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    97
Goal "-(Collect b) = {x. ~(b x)}";
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    98
by (Fast_tac 1);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    99
qed "Compl_Collect";
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   100
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   101
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   102
(**Simp_tacs**)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   103
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   104
val before_set2pred_simp_tac =
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   105
  (simp_tac (HOL_basic_ss addsimps [Collect_conj_eq RS sym,Compl_Collect]));
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   106
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   107
val split_simp_tac = (simp_tac (HOL_basic_ss addsimps [split_conv]));
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   108
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   109
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   110
(** set2pred transforms sets inclusion into predicates implication,         **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   111
(** maintaining the original variable names.                                **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   112
(** Ex. "{x. x=0} <= {x. x <= 1}" -set2pred-> "x=0 --> x <= 1"              **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   113
(** Subgoals containing intersections (A Int B) or complement sets (-A)     **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   114
(** are first simplified by "before_set2pred_simp_tac", that returns only   **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   115
(** subgoals of the form "{x. P x} <= {x. Q x}", which are easily           **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   116
(** transformed.                                                            **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   117
(** This transformation may solve very easy subgoals due to a ligth         **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   118
(** simplification done by (split_all_tac)                                  **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   119
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   120
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   121
fun set2pred i thm = let fun mk_string [] = ""
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   122
                           | mk_string (x::xs) = x^" "^mk_string xs;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   123
                         val vars=get_vars(thm);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   124
                         val var_string = mk_string (map (fst o dest_Free) vars);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   125
      in ((before_set2pred_simp_tac i) THEN_MAYBE
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   126
          (EVERY [rtac subsetI i, 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   127
                  rtac CollectI i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   128
                  dtac CollectD i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   129
                  (TRY(split_all_tac i)) THEN_MAYBE
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   130
                  ((rename_tac var_string i) THEN
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   131
                   (full_simp_tac (HOL_basic_ss addsimps [split_conv]) i)) ])) thm
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   132
      end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   133
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   134
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   135
(** BasicSimpTac is called to simplify all verification conditions. It does **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   136
(** a light simplification by applying "mem_Collect_eq", then it calls      **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   137
(** MaxSimpTac, which solves subgoals of the form "A <= A",                 **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   138
(** and transforms any other into predicates, applying then                 **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   139
(** the tactic chosen by the user, which may solve the subgoal completely.  **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   140
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   141
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   142
fun MaxSimpTac tac = FIRST'[rtac subset_refl, set2pred THEN_MAYBE' tac];
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   143
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   144
fun BasicSimpTac tac =
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   145
  simp_tac
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   146
    (HOL_basic_ss addsimps [mem_Collect_eq,split_conv] addsimprocs [record_simproc])
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   147
  THEN_MAYBE' MaxSimpTac tac;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   148
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   149
(** HoareRuleTac **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   150
13857
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
   151
fun WlpTac Mlem tac i =
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
   152
  rtac SeqRule i THEN  HoareRuleTac Mlem tac false (i+1)
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   153
and HoareRuleTac Mlem tac pre_cond i st = st |>
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   154
        (*abstraction over st prevents looping*)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   155
    ( (WlpTac Mlem tac i THEN HoareRuleTac Mlem tac pre_cond i)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   156
      ORELSE
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   157
      (FIRST[rtac SkipRule i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   158
             EVERY[rtac BasicRule i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   159
                   rtac Mlem i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   160
                   split_simp_tac i],
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   161
             EVERY[rtac CondRule i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   162
                   HoareRuleTac Mlem tac false (i+2),
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   163
                   HoareRuleTac Mlem tac false (i+1)],
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   164
             EVERY[rtac WhileRule i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   165
                   BasicSimpTac tac (i+2),
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   166
                   HoareRuleTac Mlem tac true (i+1)] ] 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   167
       THEN (if pre_cond then (BasicSimpTac tac i) else (rtac subset_refl i)) ));
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   168
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   169
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   170
(** tac:(int -> tactic) is the tactic the user chooses to solve or simplify **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   171
(** the final verification conditions                                       **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   172
 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   173
fun hoare_tac tac i thm =
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   174
  let val Mlem = Mset(thm)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   175
  in SELECT_GOAL(EVERY[HoareRuleTac Mlem tac true 1]) i thm end;