Skip to content
Snippets Groups Projects
Commit ac2fe511 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Fix `iDestruct foo as #pat` when `foo` contains a `>[...]` spec pattern.

In this case, we cannot use all the hypotheses for proving the premises as well
as for the remaining goal.
parent a68ee609
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,9 @@ Inductive spec_pat := ...@@ -15,6 +15,9 @@ Inductive spec_pat :=
| SName : string spec_pat | SName : string spec_pat
| SForall : spec_pat. | SForall : spec_pat.
Definition spec_pat_modal (p : spec_pat) : bool :=
match p with SGoal g => spec_goal_modal g | _ => false end.
Module spec_pat. Module spec_pat.
Inductive token := Inductive token :=
| TName : string token | TName : string token
......
...@@ -332,16 +332,21 @@ Local Tactic Notation "iSpecializePat" constr(H) constr(pat) := ...@@ -332,16 +332,21 @@ Local Tactic Notation "iSpecializePat" constr(H) constr(pat) :=
persistent. If so, one can use all spatial hypotheses for both proving the persistent. If so, one can use all spatial hypotheses for both proving the
premises and the remaning goal. The argument [p] can either be a Boolean or an premises and the remaning goal. The argument [p] can either be a Boolean or an
introduction pattern, which will be coerced into [true] when it solely contains introduction pattern, which will be coerced into [true] when it solely contains
`#` or `%` patterns at the top-level. *) `#` or `%` patterns at the top-level.
In case the specialization pattern in [t] states that the modality of the goal
should be kept for one of the premises (i.e. [>[H1 .. Hn]] is used) then [p]
defaults to [false] (i.e. spatial hypotheses are not preserved). *)
Tactic Notation "iSpecializeCore" open_constr(t) "as" constr(p) := Tactic Notation "iSpecializeCore" open_constr(t) "as" constr(p) :=
let p := intro_pat_persistent p in let p := intro_pat_persistent p in
let t := let t :=
match type of t with string => constr:(ITrm t hnil "") | _ => t end in match type of t with string => constr:(ITrm t hnil "") | _ => t end in
lazymatch t with lazymatch t with
| ITrm ?H ?xs ?pat => | ITrm ?H ?xs ?pat =>
let pat := spec_pat.parse pat in
lazymatch type of H with lazymatch type of H with
| string => | string =>
lazymatch p with lazymatch eval compute in (p && negb (existsb spec_pat_modal pat)) with
| true => | true =>
eapply tac_specialize_persistent_helper with _ H _ _ _; eapply tac_specialize_persistent_helper with _ H _ _ _;
[env_cbv; reflexivity || fail "iSpecialize:" H "not found" [env_cbv; reflexivity || fail "iSpecialize:" H "not found"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment