Make the ht1 tactic a bit more robust in HoareLogic.v

(Without this change, the HtIf rule can fail to generalize and unify spuriously
with goals of the right shape)
This commit is contained in:
Clément Pit-Claudel 2021-04-12 15:07:34 -04:00
parent 2ed1d52171
commit 1e81721268
2 changed files with 18 additions and 6 deletions

View file

@ -215,9 +215,15 @@ Qed.
* rules. Some other obligations are generated, generally of implications * rules. Some other obligations are generated, generally of implications
* between assertions, and [ht] also makes a best effort to solve those. *) * between assertions, and [ht] also makes a best effort to solve those. *)
Ltac ht1 := apply HtSkip || apply HtAssign || apply HtWrite || eapply HtSeq Ltac ht1 :=
|| eapply HtIf || eapply HtWhile || eapply HtAssert match goal with
|| eapply HtStrengthenPost. | [ |- {{ _ }} _ {{ ?P }} ] =>
tryif is_evar P then
apply HtSkip || apply HtAssign || apply HtWrite || eapply HtSeq
|| eapply HtIf || eapply HtWhile || eapply HtAssert
else
eapply HtStrengthenPost
end.
Ltac t := cbv beta; propositional; subst; Ltac t := cbv beta; propositional; subst;
repeat match goal with repeat match goal with

View file

@ -186,9 +186,15 @@ Qed.
* rules. Some other obligations are generated, generally of implications * rules. Some other obligations are generated, generally of implications
* between assertions, and [ht] also makes a best effort to solve those. *) * between assertions, and [ht] also makes a best effort to solve those. *)
Ltac ht1 := apply HtSkip || apply HtAssign || apply HtWrite || eapply HtSeq Ltac ht1 :=
|| eapply HtIf || eapply HtWhile || eapply HtAssert match goal with
|| eapply HtStrengthenPost. | [ |- {{ _ }} _ {{ ?P }} ] =>
tryif is_evar P then
apply HtSkip || apply HtAssign || apply HtWrite || eapply HtSeq
|| eapply HtIf || eapply HtWhile || eapply HtAssert
else
eapply HtStrengthenPost
end.
Ltac t := cbv beta; propositional; subst; Ltac t := cbv beta; propositional; subst;
repeat match goal with repeat match goal with