src/HOL/Hoare/hoare.ML
author wenzelm
Wed, 04 Apr 2007 00:11:08 +0200
changeset 22579 6e56ff1a22eb
parent 20049 f48c4a3a34bc
child 22997 d4f3b015b50b
permissions -rw-r--r--
eliminated obsolete rename_tac;
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
(** maps a goal of the form:
13737
e564c3d2d174 added a few lemmas
nipkow
parents: 13696
diff changeset
    57
        1. [| P |] ==> VARS x1 ... xn {._.} _ {._.} or to [x1,...,xn]**) 
18022
c1bb6480534f Logic.unprotect;
wenzelm
parents: 17956
diff changeset
    58
fun get_vars thm = let  val c = Logic.unprotect (concl_of (thm));
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    59
                        val d = Logic.strip_assums_concl c;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    60
                        val Const _ $ pre $ _ $ _ = dest_Trueprop d;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    61
      in mk_vars pre end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    62
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    63
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    64
(** Makes Collect with type **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    65
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
    66
                      in Collect_const t $ trm end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    67
19277
f7602e74d948 renamed op < <= to Orderings.less(_eq)
haftmann
parents: 18022
diff changeset
    68
fun inclt ty = Const ("Orderings.less_eq", [ty,ty] ---> boolT);
13696
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
(** Makes "Mset <= t" **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    71
fun Mset_incl t = let val MsetT = fastype_of t 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    72
                 in mk_Trueprop ((inclt MsetT) $ Free ("Mset", MsetT) $ t) end;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    73
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    74
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    75
fun Mset thm = let val vars = get_vars(thm);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    76
                   val varsT = fastype_of (mk_bodyC vars);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    77
                   val big_Collect = mk_CollectC (mk_abstupleC vars 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    78
                         (Free ("P",varsT --> boolT) $ mk_bodyC vars));
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    79
                   val small_Collect = mk_CollectC (Abs("x",varsT,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    80
                           Free ("P",varsT --> boolT) $ Bound 0));
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    81
                   val impl = implies $ (Mset_incl big_Collect) $ 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    82
                                          (Mset_incl small_Collect);
20049
f48c4a3a34bc Goal.prove: context;
wenzelm
parents: 19277
diff changeset
    83
   in Goal.prove (ProofContext.init (Thm.theory_of_thm thm)) ["Mset", "P"] [] impl (K (CLASET' blast_tac 1)) end;
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    84
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    85
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
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
(** Simplifying:                                                            **)
15661
9ef583b08647 reverted renaming of Some/None in comments and strings;
wenzelm
parents: 15531
diff changeset
    90
(** Some useful lemmata, lists and simplification tactics to control which  **)
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    91
(** 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
    92
(** input does not suffer any unexpected transformation                     **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    93
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    94
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    95
Goal "-(Collect b) = {x. ~(b x)}";
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    96
by (Fast_tac 1);
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    97
qed "Compl_Collect";
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    98
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
    99
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   100
(**Simp_tacs**)
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
val before_set2pred_simp_tac =
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   103
  (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
   104
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   105
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
   106
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   107
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   108
(** set2pred transforms sets inclusion into predicates implication,         **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   109
(** maintaining the original variable names.                                **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   110
(** 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
   111
(** Subgoals containing intersections (A Int B) or complement sets (-A)     **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   112
(** are first simplified by "before_set2pred_simp_tac", that returns only   **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   113
(** 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
   114
(** transformed.                                                            **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   115
(** This transformation may solve very easy subgoals due to a ligth         **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   116
(** simplification done by (split_all_tac)                                  **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   117
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   118
22579
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   119
fun set2pred i thm =
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   120
  let val var_names = map (fst o dest_Free) (get_vars thm) in
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   121
    ((before_set2pred_simp_tac i) THEN_MAYBE
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   122
     (EVERY [rtac subsetI i, 
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   123
             rtac CollectI i,
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   124
             dtac CollectD i,
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   125
             (TRY(split_all_tac i)) THEN_MAYBE
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   126
             ((rename_params_tac var_names i) THEN
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   127
              (full_simp_tac (HOL_basic_ss addsimps [split_conv]) i)) ])) thm
6e56ff1a22eb eliminated obsolete rename_tac;
wenzelm
parents: 20049
diff changeset
   128
  end;
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   129
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   130
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   131
(** BasicSimpTac is called to simplify all verification conditions. It does **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   132
(** a light simplification by applying "mem_Collect_eq", then it calls      **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   133
(** MaxSimpTac, which solves subgoals of the form "A <= A",                 **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   134
(** and transforms any other into predicates, applying then                 **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   135
(** 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
   136
(*****************************************************************************)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   137
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   138
fun MaxSimpTac tac = FIRST'[rtac subset_refl, set2pred THEN_MAYBE' tac];
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   139
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   140
fun BasicSimpTac tac =
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   141
  simp_tac
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   142
    (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
   143
  THEN_MAYBE' MaxSimpTac tac;
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   144
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   145
(** HoareRuleTac **)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   146
13857
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
   147
fun WlpTac Mlem tac i =
11d7c5a8dbb7 *** empty log message ***
nipkow
parents: 13737
diff changeset
   148
  rtac SeqRule i THEN  HoareRuleTac Mlem tac false (i+1)
13696
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   149
and HoareRuleTac Mlem tac pre_cond i st = st |>
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   150
        (*abstraction over st prevents looping*)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   151
    ( (WlpTac Mlem tac i THEN HoareRuleTac Mlem tac pre_cond i)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   152
      ORELSE
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   153
      (FIRST[rtac SkipRule i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   154
             EVERY[rtac BasicRule i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   155
                   rtac Mlem i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   156
                   split_simp_tac i],
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   157
             EVERY[rtac CondRule i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   158
                   HoareRuleTac Mlem tac false (i+2),
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   159
                   HoareRuleTac Mlem tac false (i+1)],
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   160
             EVERY[rtac WhileRule i,
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   161
                   BasicSimpTac tac (i+2),
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   162
                   HoareRuleTac Mlem tac true (i+1)] ] 
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   163
       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
   164
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   165
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   166
(** 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
   167
(** the final verification conditions                                       **)
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
fun hoare_tac tac i thm =
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   170
  let val Mlem = Mset(thm)
631460c31a1f a new pointer example and some syntactic sugar
nipkow
parents:
diff changeset
   171
  in SELECT_GOAL(EVERY[HoareRuleTac Mlem tac true 1]) i thm end;