Update of /cvsroot/hol/hol98/examples/pgcl/src
In directory sc8-pr-cvs1:/tmp/cvs-serv23484/src
Modified Files:
expectationScript.sml qtl wpScript.sml wpTools.sml
Log Message:
Factorized out some common subexpressions as new definitions.
Index: expectationScript.sml
===================================================================
RCS file: /cvsroot/hol/hol98/examples/pgcl/src/expectationScript.sml,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -C2 -d -r1.3 -r1.4
*** expectationScript.sml 30 Sep 2003 01:44:56 -0000 1.3
--- expectationScript.sml 30 Sep 2003 15:39:15 -0000 1.4
***************
*** 231,240 ****
(* ------------------------------------------------------------------------- *)
! val prob_def = Define
! `prob p (a : 'a expect) b s =
let x = bound1 (p s) in x * a s + (1 - x) * b s`;
! val cond_def = Define
! `cond c (a : 'a expect) b s = if c s then a s else b s`;
(* ------------------------------------------------------------------------- *)
--- 231,251 ----
(* ------------------------------------------------------------------------- *)
! val Lin_def = Define
! `Lin p (a : 'a expect) b s =
let x = bound1 (p s) in x * a s + (1 - x) * b s`;
! val Cond_def = Define
! `Cond c (a : 'a expect) b s = if c s then a s else b s`;
!
! val lin_eta = store_thm
! ("lin_eta",
! ``!p a b.
! Lin p a b = \s. let x = bound1 (p s) in x * a s + (1 - x) * b s``,
! METIS_TAC [Lin_def]);
!
! val cond_eta = store_thm
! ("cond_eta",
! ``!c a b. Cond c a b = \s. if c s then a s else b s``,
! METIS_TAC [Cond_def]);
(* ------------------------------------------------------------------------- *)
Index: qtl
===================================================================
RCS file: /cvsroot/hol/hol98/examples/pgcl/src/qtl,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -C2 -d -r1.1 -r1.2
*** qtl 8 Apr 2003 13:48:49 -0000 1.1
--- qtl 30 Sep 2003 15:39:15 -0000 1.2
***************
*** 45,54 ****
val Suff = Q_TAC SUFF_TAC;
val REVERSE = Tactical.REVERSE;
!
! val real_ss = simpLib.++
! (realLib.real_ss,
! simpLib.SIMPSET
! {ac = [], congs = [], convs = [], dprocs = [], filter = NONE,
! rewrs = []});
(* ------------------------------------------------------------------------- *)
--- 45,49 ----
val Suff = Q_TAC SUFF_TAC;
val REVERSE = Tactical.REVERSE;
! val lemma = I prove;
(* ------------------------------------------------------------------------- *)
***************
*** 421,425 ****
(* ------------------------------------------------------------------------- *)
! val eventually_lfp_lemma =prove
(``!step a.
wf_trans step /\ wf_prob (sem step a) ==>
--- 416,420 ----
(* ------------------------------------------------------------------------- *)
! val eventually_lfp_lemma = lemma
(``!step a.
wf_trans step /\ wf_prob (sem step a) ==>
***************
*** 436,440 ****
++ PROVE_TAC [wf_trans_mono, wf_prob_expect, leq_refl]]);
! val unless_gfp_lemma =prove
(``!step a b.
wf_trans step /\ wf_prob (sem step a) /\ wf_prob (sem step b) ==>
--- 431,435 ----
++ PROVE_TAC [wf_trans_mono, wf_prob_expect, leq_refl]]);
! val unless_gfp_lemma = lemma
(``!step a b.
wf_trans step /\ wf_prob (sem step a) /\ wf_prob (sem step b) ==>
Index: wpScript.sml
===================================================================
RCS file: /cvsroot/hol/hol98/examples/pgcl/src/wpScript.sml,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -C2 -d -r1.4 -r1.5
*** wpScript.sml 30 Sep 2003 01:44:56 -0000 1.4
--- wpScript.sml 30 Sep 2003 15:39:15 -0000 1.5
***************
*** 48,52 ****
val Suff = Q_TAC SUFF_TAC;
val REVERSE = Tactical.REVERSE;
! val lemma = prove;
(* ------------------------------------------------------------------------- *)
--- 48,52 ----
val Suff = Q_TAC SUFF_TAC;
val REVERSE = Tactical.REVERSE;
! val lemma = I prove;
(* ------------------------------------------------------------------------- *)
***************
*** 85,90 ****
(Program (c :: c' :: cs) = Seq c (Program (c' :: cs)))`;
! val Cond_def = Define
! `Cond c a b = Prob (\s. if c s then 1 else 0) a b`;
(* Demons [] should evaluate to the identity for Demon, which is Magic. *)
--- 85,90 ----
(Program (c :: c' :: cs) = Seq c (Program (c' :: cs)))`;
! val If_def = Define
! `If c a b = Prob (\s. if c s then 1 else 0) a b`;
(* Demons [] should evaluate to the identity for Demon, which is Magic. *)
***************
*** 101,105 ****
`(guards cs [] = if cs = [] then Abort else Demons cs) /\
(guards cs ((p, c) :: rest) =
! Cond p (guards (c :: cs) rest) (guards cs rest))`;
val Guards_def = Define `Guards l = guards [] l`;
--- 101,105 ----
`(guards cs [] = if cs = [] then Abort else Demons cs) /\
(guards cs ((p, c) :: rest) =
! If p (guards (c :: cs) rest) (guards cs rest))`;
val Guards_def = Define `Guards l = guards [] l`;
***************
*** 126,135 ****
`(wp Abort = \r. Zero) /\
(wp Skip = \r. r) /\
! (wp (Assign v e) = \r s. r (\w. if w = v then e s else s w)) /\
(wp (Seq a b) = \r. wp a (wp b r)) /\
(wp (Demon a b) = \r. Min (wp a r) (wp b r)) /\
! (wp (Prob p a b) =
! \r s. let x = bound1 (p s) in x * wp a r s + (1 - x) * wp b r s) /\
! (wp (While c b) = \r. expect_lfp (\e s. if c s then wp b e s else r s))`;
val wp_incognito_def = Define `wp_incognito = wp`;
--- 126,134 ----
`(wp Abort = \r. Zero) /\
(wp Skip = \r. r) /\
! (wp (Assign v e) = \r s. r (assign v e s)) /\
(wp (Seq a b) = \r. wp a (wp b r)) /\
(wp (Demon a b) = \r. Min (wp a r) (wp b r)) /\
! (wp (Prob p a b) = \r. Lin p (wp a r) (wp b r)) /\
! (wp (While c b) = \r. expect_lfp (\e. Cond c (wp b e) r))`;
val wp_incognito_def = Define `wp_incognito = wp`;
***************
*** 151,155 ****
++ Q.EXISTS_TAC `\v. if v "n" = 1 then 1 else 0`
++ Q.EXISTS_TAC `\v. 0`
! ++ REWRITE_TAC [wp_def]
++ SIMP_TAC int_ss [Min_def]
++ SIMP_TAC posreal_ss [preal_min_def]);
--- 150,154 ----
++ Q.EXISTS_TAC `\v. if v "n" = 1 then 1 else 0`
++ Q.EXISTS_TAC `\v. 0`
! ++ REWRITE_TAC [wp_def, assign_eta]
++ SIMP_TAC int_ss [Min_def]
++ SIMP_TAC posreal_ss [preal_min_def]);
***************
*** 174,178 ****
(``!v e. healthy (wp (Assign v e))``,
RW_TAC posreal_ss
! [wp_def, healthy_def, sublinear_def, feasible_def, Zero_def, sub_mono]
++ RW_TAC real_ss [up_continuous_def, lub_def, Leq_def, expect_def]
>> (BETA_TAC ++ PROVE_TAC [])
--- 173,178 ----
(``!v e. healthy (wp (Assign v e))``,
RW_TAC posreal_ss
! [wp_def, healthy_def, sublinear_def, feasible_def, Zero_def, sub_mono,
! assign_eta]
++ RW_TAC real_ss [up_continuous_def, lub_def, Leq_def, expect_def]
>> (BETA_TAC ++ PROVE_TAC [])
***************
*** 371,375 ****
healthy (wp prog) /\ healthy (wp prog') ==>
healthy (wp (Prob f prog prog'))``,
! RW_TAC real_ss [wp_def]
++ RW_TAC real_ss [healthy_def]
<< [RW_TAC posreal_ss [feasible_def]
--- 371,375 ----
healthy (wp prog) /\ healthy (wp prog') ==>
healthy (wp (Prob f prog prog'))``,
! RW_TAC real_ss [wp_def, lin_eta]
++ RW_TAC real_ss [healthy_def]
<< [RW_TAC posreal_ss [feasible_def]
***************
*** 529,535 ****
val wp_while_monotonic = lemma
! (``!trans cnd l.
healthy trans /\
! (!r. expect_lfp (\e s. (if cnd s then trans e s else r s)) = l r) ==>
monotonic (expect,Leq) l``,
RW_TAC std_ss []
--- 529,535 ----
val wp_while_monotonic = lemma
! (``!trans cond l.
healthy trans /\
! (!r. expect_lfp (\e s. (if cond s then trans e s else r s)) = l r) ==>
monotonic (expect,Leq) l``,
RW_TAC std_ss []
***************
*** 547,556 ****
val wp_while_upcontinuous = lemma
! (``!trans cnd l.
healthy trans /\
! (!r. expect_lfp (\e s. (if cnd s then trans e s else r s)) = l r) ==>
! (!r. (\s. (if cnd s then trans (l r) s else r s)) = l r) /\
(!r y.
! Leq (\s. (if cnd s then trans y s else r s)) y ==> Leq (l r) y) ==>
up_continuous (expect,Leq) l``,
RW_TAC std_ss []
--- 547,556 ----
val wp_while_upcontinuous = lemma
! (``!trans cond l.
healthy trans /\
! (!r. expect_lfp (\e s. (if cond s then trans e s else r s)) = l r) ==>
! (!r. (\s. (if cond s then trans (l r) s else r s)) = l r) /\
(!r y.
! Leq (\s. (if cond s then trans y s else r s)) y ==> Leq (l r) y) ==>
up_continuous (expect,Leq) l``,
RW_TAC std_ss []
***************
*** 598,602 ****
++ Q.PAT_ASSUM `chain X Y` MP_TAC
++ RW_TAC posreal_ss [chain_def, expect_def]
! ++ MP_TAC (Q.SPECL [`trans`, `cnd`, `l`] wp_while_monotonic)
++ RW_TAC std_ss [monotonic_def, expect_def]
++ METIS_TAC [])
--- 598,602 ----
++ Q.PAT_ASSUM `chain X Y` MP_TAC
++ RW_TAC posreal_ss [chain_def, expect_def]
! ++ MP_TAC (Q.SPECL [`trans`, `cond`, `l`] wp_while_monotonic)
++ RW_TAC std_ss [monotonic_def, expect_def]
++ METIS_TAC [])
***************
*** 611,619 ****
val wp_while_sublinear1 = lemma
! (``!cnd prog l.
healthy (wp prog) /\
! (!r. (\s. (if cnd s then wp prog (l r) s else r s)) = l r) /\
(!r y.
! Leq (\s. (if cnd s then wp prog y s else r s)) y ==> Leq (l r) y) ==>
(!r c s. ~(c = infty) ==> l r s - c <= l (\s'. r s' - c) s)``,
RW_TAC posreal_ss []
--- 611,619 ----
val wp_while_sublinear1 = lemma
! (``!cond prog l.
healthy (wp prog) /\
! (!r. (\s. (if cond s then wp prog (l r) s else r s)) = l r) /\
(!r y.
! Leq (\s. (if cond s then wp prog y s else r s)) y ==> Leq (l r) y) ==>
(!r c s. ~(c = infty) ==> l r s - c <= l (\s'. r s' - c) s)``,
RW_TAC posreal_ss []
***************
*** 640,651 ****
val healthy_wp_while = lemma
! (``!cnd prog. healthy (wp prog) ==> healthy (wp (While cnd prog))``,
! RW_TAC real_ss [wp_def]
++ Know
`!r.
! (expect_lfp (\e s. (if cnd s then wp prog e s else r s)) =
! (\r. expect_lfp (\e s. (if cnd s then wp prog e s else r s))) r) /\
! lfp (expect,Leq) (\e s. if cnd s then wp prog e s else r s)
! ((\r. expect_lfp (\e s. (if cnd s then wp prog e s else r s))) r)`
>> (RW_TAC std_ss []
++ MATCH_MP_TAC expect_lfp_def
--- 640,651 ----
val healthy_wp_while = lemma
! (``!cond prog. healthy (wp prog) ==> healthy (wp (While cond prog))``,
! RW_TAC real_ss [wp_def, cond_eta]
++ Know
`!r.
! (expect_lfp (\e s. (if cond s then wp prog e s else r s)) =
! (\r. expect_lfp (\e s. (if cond s then wp prog e s else r s))) r) /\
! lfp (expect,Leq) (\e s. if cond s then wp prog e s else r s)
! ((\r. expect_lfp (\e s. (if cond s then wp prog e s else r s))) r)`
>> (RW_TAC std_ss []
++ MATCH_MP_TAC expect_lfp_def
***************
*** 660,668 ****
++ METIS_TAC [healthy_mono])
++ Q.SPEC_TAC
! (`\r. expect_lfp (\e s. (if cnd s then wp prog e s else r s))`, `l`)
++ SIMP_TAC std_ss [lfp_def, expect_def, FORALL_AND_THM]
++ RW_TAC std_ss []
! ++ MP_TAC (Q.SPECL [`cnd`, `l`] (Q.ISPEC `wp prog` wp_while_monotonic))
! ++ MP_TAC (Q.SPECL [`cnd`, `l`] (Q.ISPEC `wp prog` wp_while_upcontinuous))
++ RW_TAC std_ss []
++ ASM_SIMP_TAC real_ss [healthy_def]
--- 660,668 ----
++ METIS_TAC [healthy_mono])
++ Q.SPEC_TAC
! (`\r. expect_lfp (\e s. (if cond s then wp prog e s else r s))`, `l`)
++ SIMP_TAC std_ss [lfp_def, expect_def, FORALL_AND_THM]
++ RW_TAC std_ss []
! ++ MP_TAC (Q.SPECL [`cond`, `l`] (Q.ISPEC `wp prog` wp_while_monotonic))
! ++ MP_TAC (Q.SPECL [`cond`, `l`] (Q.ISPEC `wp prog` wp_while_upcontinuous))
++ RW_TAC std_ss []
++ ASM_SIMP_TAC real_ss [healthy_def]
***************
*** 682,686 ****
++ METIS_TAC [feasible_def, healthy_feasible])
++ RW_TAC real_ss [sublinear_alt]
! << [MP_TAC (Q.SPECL [`cnd`, `prog`, `l`] wp_while_sublinear1)
++ RW_TAC std_ss [],
Suff `Leq (\s. c * l r s) (l (\s'. c * r s'))` >> RW_TAC std_ss [Leq_def]
--- 682,686 ----
++ METIS_TAC [feasible_def, healthy_feasible])
++ RW_TAC real_ss [sublinear_alt]
! << [MP_TAC (Q.SPECL [`cond`, `prog`, `l`] wp_while_sublinear1)
++ RW_TAC std_ss [],
Suff `Leq (\s. c * l r s) (l (\s'. c * r s'))` >> RW_TAC std_ss [Leq_def]
***************
*** 874,878 ****
++ Know `!s. l r s <= & n`
>> (GEN_TAC
! ++ MP_TAC (Q.SPECL [`cnd`, `prog`, `l`] wp_while_sublinear1)
++ ASM_SIMP_TAC std_ss []
++ DISCH_THEN (MP_TAC o Q.SPECL [`r`, `& n`, `s`])
--- 874,878 ----
++ Know `!s. l r s <= & n`
>> (GEN_TAC
! ++ MP_TAC (Q.SPECL [`cond`, `prog`, `l`] wp_while_sublinear1)
++ ASM_SIMP_TAC std_ss []
++ DISCH_THEN (MP_TAC o Q.SPECL [`r`, `& n`, `s`])
***************
*** 910,914 ****
(fn th => CONV_TAC (RAND_CONV (ONCE_REWRITE_CONV [GSYM th])))
++ RW_TAC posreal_ss [Leq_def]
! ++ REVERSE (Cases_on `cnd s` ++ ASM_SIMP_TAC posreal_ss [add_sub])
++ POP_ASSUM (K ALL_TAC)
++ MP_TAC (Q.SPECL [`\s. l (\s' : state. r1 s' + r s' : posreal) s`,
--- 910,914 ----
(fn th => CONV_TAC (RAND_CONV (ONCE_REWRITE_CONV [GSYM th])))
++ RW_TAC posreal_ss [Leq_def]
! ++ REVERSE (Cases_on `cond s` ++ ASM_SIMP_TAC posreal_ss [add_sub])
++ POP_ASSUM (K ALL_TAC)
++ MP_TAC (Q.SPECL [`\s. l (\s' : state. r1 s' + r s' : posreal) s`,
***************
*** 971,979 ****
RW_TAC std_ss [wp_def]);
! val wp_cond = store_thm
! ("wp_cond",
! ``!c a b r.
! wp (Cond c a b) r = \s. if c s then wp a r s else wp b r s``,
! RW_TAC std_ss [wp_def, Cond_def]
++ CONV_TAC FUN_EQ_CONV
++ RW_TAC posreal_ss [bound1_basic]);
--- 971,978 ----
RW_TAC std_ss [wp_def]);
! val wp_if = store_thm
! ("wp_if",
! ``!c a b r. wp (If c a b) r = Cond c (wp a r) (wp b r)``,
! RW_TAC std_ss [wp_def, If_def, cond_eta, lin_eta]
++ CONV_TAC FUN_EQ_CONV
++ RW_TAC posreal_ss [bound1_basic]);
***************
*** 995,999 ****
("refines_demon_prob",
``!f p q. refines (wp (Demon p q)) (wp (Prob f p q))``,
! RW_TAC std_ss [refines_def, wp_def, Min_def, Leq_def, min_le_lin]);
(* ------------------------------------------------------------------------- *)
--- 994,998 ----
("refines_demon_prob",
``!f p q. refines (wp (Demon p q)) (wp (Prob f p q))``,
! RW_TAC std_ss [refines_def, wp_def, Min_def, Leq_def, min_le_lin, Lin_def]);
(* ------------------------------------------------------------------------- *)
***************
*** 1004,1013 ****
`(wlp Abort = \r. Magic) /\
(wlp Skip = \r. r) /\
! (wlp (Assign v e) = \r s. r (\w. if w = v then e s else s w)) /\
(wlp (Seq a b) = \r. wlp a (wlp b r)) /\
(wlp (Demon a b) = \r. Min (wlp a r) (wlp b r)) /\
! (wlp (Prob p a b) =
! \r s. let x = bound1 (p s) in x * wlp a r s + (1 - x) * wlp b r s) /\
! (wlp (While c b) = \r. expect_gfp (\e s. if c s then wlp b e s else r s))`;
(* ------------------------------------------------------------------------- *)
--- 1003,1011 ----
`(wlp Abort = \r. Magic) /\
(wlp Skip = \r. r) /\
! (wlp (Assign v e) = \r s. r (assign v e s)) /\
(wlp (Seq a b) = \r. wlp a (wlp b r)) /\
(wlp (Demon a b) = \r. Min (wlp a r) (wlp b r)) /\
! (wlp (Prob p a b) = \r. Lin p (wlp a r) (wlp b r)) /\
! (wlp (While c b) = \r. expect_gfp (\e. Cond c (wlp b e) r))`;
(* ------------------------------------------------------------------------- *)
***************
*** 1020,1030 ****
``!p r1 r2. Leq r1 r2 ==> Leq (wlp p r1) (wlp p r2)``,
(Induct ++ RW_TAC std_ss [wlp_def, leq_refl])
! << [FULL_SIMP_TAC std_ss [Leq_def],
METIS_TAC [min_leq2_imp],
! RW_TAC std_ss [Leq_def]
++ MATCH_MP_TAC le_add2
++ METIS_TAC [Leq_def, le_lmul_imp, le_add2],
MATCH_MP_TAC refines_gfp
! ++ RW_TAC std_ss [monotonic_def, refines_def, Leq_def]
++ RW_TAC posreal_ss []
++ METIS_TAC [Leq_def]]);
--- 1018,1028 ----
``!p r1 r2. Leq r1 r2 ==> Leq (wlp p r1) (wlp p r2)``,
(Induct ++ RW_TAC std_ss [wlp_def, leq_refl])
! << [FULL_SIMP_TAC std_ss [Leq_def, assign_eta],
METIS_TAC [min_leq2_imp],
! RW_TAC std_ss [Leq_def, lin_eta]
++ MATCH_MP_TAC le_add2
++ METIS_TAC [Leq_def, le_lmul_imp, le_add2],
MATCH_MP_TAC refines_gfp
! ++ RW_TAC std_ss [monotonic_def, refines_def, Leq_def, cond_eta]
++ RW_TAC posreal_ss []
++ METIS_TAC [Leq_def]]);
***************
*** 1038,1051 ****
val wlp_while = store_thm
("wlp_while",
! ``!cnd body pre post.
! Leq pre (\s. if cnd s then wlp body pre s else post s) ==>
! Leq pre (wlp (While cnd body) post)``,
! RW_TAC std_ss [wlp_def]
++ Know
`!r.
! (expect_gfp (\e s. (if cnd s then wlp body e s else r s)) =
! (\r. expect_gfp (\e s. (if cnd s then wlp body e s else r s))) r) /\
! gfp (expect,Leq) (\e s. if cnd s then wlp body e s else r s)
! ((\r. expect_gfp (\e s. (if cnd s then wlp body e s else r s))) r)`
>> (RW_TAC std_ss []
++ MATCH_MP_TAC expect_gfp_def
--- 1036,1049 ----
val wlp_while = store_thm
("wlp_while",
! ``!cond body pre post.
! Leq pre (Cond cond (wlp body pre) post) ==>
! Leq pre (wlp (While cond body) post)``,
! RW_TAC std_ss [wlp_def, cond_eta]
++ Know
`!r.
! (expect_gfp (\e s. (if cond s then wlp body e s else r s)) =
! (\r. expect_gfp (\e s. (if cond s then wlp body e s else r s))) r) /\
! gfp (expect,Leq) (\e s. if cond s then wlp body e s else r s)
! ((\r. expect_gfp (\e s. (if cond s then wlp body e s else r s))) r)`
>> (RW_TAC std_ss []
++ MATCH_MP_TAC expect_gfp_def
***************
*** 1060,1064 ****
++ SIMP_TAC std_ss []
++ Q.SPEC_TAC
! (`expect_gfp (\e s. (if cnd s then wlp body e s else post s))`, `g`)
++ RW_TAC std_ss [gfp_def, expect_def]);
--- 1058,1062 ----
++ SIMP_TAC std_ss []
++ Q.SPEC_TAC
! (`expect_gfp (\e s. (if cond s then wlp body e s else post s))`, `g`)
++ RW_TAC std_ss [gfp_def, expect_def]);
***************
*** 1120,1129 ****
``!pre1 pre2 post p c1 c2.
Leq pre1 (wlp c1 post) /\ Leq pre2 (wlp c2 post) ==>
! Leq (prob p pre1 pre2) (wlp (Prob p c1 c2) post)``,
RW_TAC std_ss [wlp_def, Leq_def]
++ MATCH_MP_TAC le_trans
! ++ Q.EXISTS_TAC `prob p pre1 pre2 s`
++ RW_TAC std_ss []
! ++ RW_TAC std_ss [prob_def, le_refl]
++ METIS_TAC [le_add2, le_lmul_imp]);
--- 1118,1127 ----
``!pre1 pre2 post p c1 c2.
Leq pre1 (wlp c1 post) /\ Leq pre2 (wlp c2 post) ==>
! Leq (Lin p pre1 pre2) (wlp (Prob p c1 c2) post)``,
RW_TAC std_ss [wlp_def, Leq_def]
++ MATCH_MP_TAC le_trans
! ++ Q.EXISTS_TAC `Lin p pre1 pre2 s`
++ RW_TAC std_ss []
! ++ RW_TAC std_ss [Lin_def, le_refl]
++ METIS_TAC [le_add2, le_lmul_imp]);
***************
*** 1131,1135 ****
("wlp_while_vc",
``!pre post mid b c.
! Leq mid (wlp c pre) /\ Leq pre (cond b mid post) ==>
Leq pre (wlp (Assert pre (While b c)) post)``,
RW_TAC std_ss []
--- 1129,1133 ----
("wlp_while_vc",
``!pre post mid b c.
! Leq mid (wlp c pre) /\ Leq pre (Cond b mid post) ==>
Leq pre (wlp (Assert pre (While b c)) post)``,
RW_TAC std_ss []
***************
*** 1138,1154 ****
++ RW_TAC std_ss [leq_refl]
++ MATCH_MP_TAC wlp_while
! ++ FULL_SIMP_TAC std_ss [Leq_def, cond_def]
++ METIS_TAC [le_trans]);
! val wlp_cond_vc = store_thm
! ("wlp_cond_vc",
``!pre1 pre2 post b c1 c2.
Leq pre1 (wlp c1 post) /\ Leq pre2 (wlp c2 post) ==>
! Leq (cond b pre1 pre2) (wlp (Cond b c1 c2) post)``,
! RW_TAC std_ss [Cond_def]
++ MATCH_MP_TAC leq_trans
! ++ Q.EXISTS_TAC `prob (\s. if b s then 1 else 0) pre1 pre2`
++ REVERSE CONJ_TAC >> METIS_TAC [wlp_prob_vc]
! ++ RW_TAC std_ss [Leq_def, bound1_def, prob_def, cond_def]
++ RW_TAC posreal_ss []
++ FULL_SIMP_TAC posreal_ss []);
--- 1136,1152 ----
++ RW_TAC std_ss [leq_refl]
++ MATCH_MP_TAC wlp_while
! ++ FULL_SIMP_TAC std_ss [Leq_def, Cond_def]
++ METIS_TAC [le_trans]);
! val wlp_if_vc = store_thm
! ("wlp_if_vc",
``!pre1 pre2 post b c1 c2.
Leq pre1 (wlp c1 post) /\ Leq pre2 (wlp c2 post) ==>
! Leq (Cond b pre1 pre2) (wlp (If b c1 c2) post)``,
! RW_TAC std_ss [If_def]
++ MATCH_MP_TAC leq_trans
! ++ Q.EXISTS_TAC `Lin (\s. if b s then 1 else 0) pre1 pre2`
++ REVERSE CONJ_TAC >> METIS_TAC [wlp_prob_vc]
! ++ RW_TAC std_ss [Leq_def, bound1_def, Lin_def, Cond_def]
++ RW_TAC posreal_ss []
++ FULL_SIMP_TAC posreal_ss []);
Index: wpTools.sml
===================================================================
RCS file: /cvsroot/hol/hol98/examples/pgcl/src/wpTools.sml,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -C2 -d -r1.4 -r1.5
*** wpTools.sml 30 Sep 2003 01:44:56 -0000 1.4
--- wpTools.sml 30 Sep 2003 15:39:15 -0000 1.5
***************
*** 90,94 ****
val vc_solve = prolog
[wlp_abort_vc, wlp_skip_vc, wlp_assign_vc, wlp_seq_vc, wlp_demon_vc,
! wlp_prob_vc, wlp_while_vc, wlp_cond_vc, wlp_assert_vc];
in
fun vc_tac (asl,goal) =
--- 90,94 ----
val vc_solve = prolog
[wlp_abort_vc, wlp_skip_vc, wlp_assign_vc, wlp_seq_vc, wlp_demon_vc,
! wlp_prob_vc, wlp_while_vc, wlp_if_vc, wlp_assert_vc];
in
fun vc_tac (asl,goal) =
***************
*** 189,193 ****
local
fun simps ths = ths @
! [wlp_min_def, prob_def, cond_def, o_THM, magic_alt, assign_def];
in
val leq_tac =
--- 189,193 ----
local
fun simps ths = ths @
! [wlp_min_def, Lin_def, Cond_def, o_THM, magic_alt, assign_def];
in
val leq_tac =
|