Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simon Friis Vindum
Iris
Commits
fd243450
Commit
fd243450
authored
May 25, 2021
by
Ralf Jung
Browse files
better error when iMod fails due to mask mismatch
parent
2e9d27eb
Changes
5
Hide whitespace changes
Inline
Side-by-side
iris/proofmode/class_instances_updates.v
View file @
fd243450
...
...
@@ -161,6 +161,13 @@ Proof.
by
rewrite
/
ElimModal
intuitionistically_if_elim
fupd_frame_r
wand_elim_r
fupd_trans
.
Qed
.
Global
Instance
elim_modal_fupd_fupd_wrong_mask
`
{!
BiFUpd
PROP
}
p
E0
E1
E2
E3
P
Q
:
ElimModal
(
pm_error
"Goal and eliminated modality must have the same mask.
Use [iMod (fupd_mask_subseteq E2)] to adjust the mask of your goal to [E2]"
)
p
false
(|={
E1
,
E2
}=>
P
)
False
(|={
E0
,
E3
}=>
Q
)
False
|
100
.
Proof
.
intros
[].
Qed
.
Global
Instance
add_modal_bupd
`
{!
BiBUpd
PROP
}
P
Q
:
AddModal
(|==>
P
)
P
(|==>
Q
).
Proof
.
by
rewrite
/
AddModal
bupd_frame_r
wand_elim_r
bupd_trans
.
Qed
.
...
...
iris/proofmode/classes.v
View file @
fd243450
...
...
@@ -5,6 +5,11 @@ From iris.proofmode Require Export ident_name modalities.
From
iris
.
prelude
Require
Import
options
.
Import
bi
.
(** Use this as precondition on "failing" instances of typeclasses that have
pure preconditions (such as [ElimModal]), if you want a nice error to be shown
when this instances is picked as part of some proof mode tactic. *)
Definition
pm_error
(
s
:
string
)
:
=
False
.
Class
FromAssumption
{
PROP
:
bi
}
(
p
:
bool
)
(
P
Q
:
PROP
)
:
=
from_assumption
:
□
?p
P
⊢
Q
.
Global
Arguments
FromAssumption
{
_
}
_
_
%
I
_
%
I
:
simpl
never
.
...
...
iris/proofmode/ltac_tactics.v
View file @
fd243450
...
...
@@ -28,7 +28,10 @@ Ltac iSolveTC :=
(** Tactic used for solving side-conditions arising from TC resolution in [iMod]
and [iInv]. *)
Ltac
iSolveSideCondition
:
=
split_and
?
;
try
solve
[
fast_done
|
solve_ndisj
|
iSolveTC
].
lazymatch
goal
with
|
|-
pm_error
?err
=>
fail
""
err
|
_
=>
split_and
?
;
try
solve
[
fast_done
|
solve_ndisj
|
iSolveTC
]
end
.
(** Used for printing [string]s and [ident]s. *)
Ltac
pretty_ident
H
:
=
...
...
tests/proofmode.ref
View file @
fd243450
...
...
@@ -707,6 +707,16 @@ Tactic failure: iRevert: k is used in hypothesis "Hk".
: string
The command has indeed failed with message:
Tactic failure: iLöb: no 'BiLöb' instance found.
"iMod_mask_mismatch"
: string
The command has indeed failed with message:
Tactic failure:
"Goal and eliminated modality must have the same mask.
Use [iMod (fupd_mask_subseteq E2)] to adjust the mask of your goal to [E2]".
The command has indeed failed with message:
Tactic failure:
"Goal and eliminated modality must have the same mask.
Use [iMod (fupd_mask_subseteq E2)] to adjust the mask of your goal to [E2]".
"test_pure_name"
: string
1 goal
...
...
tests/proofmode.v
View file @
fd243450
...
...
@@ -1389,16 +1389,19 @@ Proof. intros Hk. Fail iRevert (k). Abort.
Check
"iRevert_dep_var"
.
Lemma
iRevert_dep_var
(
k
:
nat
)
(
Φ
:
nat
→
PROP
)
:
Φ
k
-
∗
Φ
(
S
k
).
Proof
.
iIntros
"Hk"
.
Fail
iRevert
(
k
).
Abort
.
End
error_tests
.
Section
error_tests_bi
.
Context
{
PROP
:
bi
}.
Implicit
Types
P
Q
R
:
PROP
.
Check
"iLöb_no_BiLöb"
.
Lemma
iL
ö
b_no_BiL
ö
b
P
:
⊢
P
.
Proof
.
Fail
iL
ö
b
as
"IH"
.
Abort
.
End
error_tests_bi
.
Check
"iMod_mask_mismatch"
.
Lemma
iMod_mask_mismatch
`
{!
BiFUpd
PROP
}
E1
E2
(
P
:
PROP
)
:
(|={
E2
}=>
P
)
⊢
|={
E1
}=>
P
.
Proof
.
Fail
iIntros
">HP"
.
iIntros
"HP"
.
Fail
iMod
"HP"
.
Abort
.
End
error_tests
.
Section
pure_name_tests
.
Context
{
PROP
:
bi
}.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment