Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Iris
Iris
Commits
a7fe86a3
Commit
a7fe86a3
authored
May 01, 2019
by
Dan Frumin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the argument to `iEval` a selection pattern.
parent
46151cd2
Changes
4
Hide whitespace changes
Inline
Sidebyside
Showing
4 changed files
with
68 additions
and
46 deletions
+68
46
ProofMode.md
ProofMode.md
+13
11
tests/proofmode.ref
tests/proofmode.ref
+11
0
tests/proofmode.v
tests/proofmode.v
+5
0
theories/proofmode/ltac_tactics.v
theories/proofmode/ltac_tactics.v
+39
35
No files found.
ProofMode.md
View file @
a7fe86a3
...
@@ 152,17 +152,19 @@ Rewriting / simplification
...
@@ 152,17 +152,19 @@ Rewriting / simplification
equality in the proof mode goal / hypothesis
`H`
.
equality in the proof mode goal / hypothesis
`H`
.

`iRewrite pm_trm`
/
`iRewrite pm_trm in "H"`
: rewrite in reverse direction

`iRewrite pm_trm`
/
`iRewrite pm_trm in "H"`
: rewrite in reverse direction
using an internal equality in the proof mode goal / hypothesis
`H`
.
using an internal equality in the proof mode goal / hypothesis
`H`
.

`iEval (tac)`
/
`iEval (tac) in H`
: performs a tactic
`tac`
on the proof mode

`iEval (tac)`
/
`iEval (tac) in "selpat"`
: performs a tactic
`tac`
goal / hypothesis
`H`
. The tactic
`tac`
should be a reduction or rewriting
on the proof mode goal / hypotheses given by the selection pattern
tactic like
`simpl`
,
`cbv`
,
`lazy`
,
`rewrite`
or
`setoid_rewrite`
. The
`iEval`
`selpat`
. Using
`%`
as part of the selection pattern is unsupported.
tactic is implemented by running
`tac`
on
`?evar ⊢ P`
/
`P ⊢ ?evar`
where
`P`
The tactic
`tac`
should be a reduction or rewriting tactic like
is the proof goal / hypothesis
`H`
. After running
`tac`
,
`?evar`
is unified
`simpl`
,
`cbv`
,
`lazy`
,
`rewrite`
or
`setoid_rewrite`
. The
`iEval`
with the resulting
`P`
, which in turn becomes the new proof mode goal /
tactic is implemented by running
`tac`
on
`?evar ⊢ P`
/
`P ⊢ ?evar`
hypothesis
`H`
.
where
`P`
is the proof goal / a hypothesis given by
`selpat`
. After
Note that parentheses around
`tac`
are needed.
running
`tac`
,
`?evar`
is unified with the resulting
`P`
, which in
If
`H`
is a list of hypothesis, then
`iEval`
will perform
`tac`
on each of them.
turn becomes the new proof mode goal / a hypothesis given by

`iSimpl`
/
`iSimpl in H`
: performs
`simpl`
on the proof mode goal /
`selpat`
. Note that parentheses around
`tac`
are needed.
hypothesis
`H`
. This is a shorthand for
`iEval (simpl)`
.

`iSimpl`
/
`iSimpl in "selpat"`
: performs
`simpl`
on the proof mode
goal / hypotheses given by the selection pattern
`selpat`
. This is a
shorthand for
`iEval (simpl)`
.
Iris
Iris
...
...
tests/proofmode.ref
View file @
a7fe86a3
...
@@ 111,6 +111,17 @@ Tactic failure: iSpecialize: cannot instantiate (⌜φ⌝ → P ∗ False)%I wi
...
@@ 111,6 +111,17 @@ Tactic failure: iSpecialize: cannot instantiate (⌜φ⌝ → P ∗ False)%I wi
∗
∗
⌜S (S (S x)) = y⌝
⌜S (S (S x)) = y⌝
1 subgoal
PROP : sbi
x, y, z : nat
============================
"H1" : ⌜S (S (S x)) = y⌝
□
"H2" : ⌜(1 + y)%nat = z⌝
∗
⌜S (S (S x)) = y⌝
"test_iFrame_later_1"
"test_iFrame_later_1"
: string
: string
1 subgoal
1 subgoal
...
...
tests/proofmode.v
View file @
a7fe86a3
...
@@ 478,6 +478,11 @@ Lemma test_iSimpl_in_2 x y z :
...
@@ 478,6 +478,11 @@ Lemma test_iSimpl_in_2 x y z :
⌜
S
(
S
(
S
x
))
=
y
⌝
:
PROP
.
⌜
S
(
S
(
S
x
))
=
y
⌝
:
PROP
.
Proof
.
iIntros
"H1 H2"
.
iSimpl
in
"H1 H2"
.
Show
.
done
.
Qed
.
Proof
.
iIntros
"H1 H2"
.
iSimpl
in
"H1 H2"
.
Show
.
done
.
Qed
.
Lemma
test_iSimpl_in3
x
y
z
:
⌜
(
3
+
x
)%
nat
=
y
⌝

∗
⌜
(
1
+
y
)%
nat
=
z
⌝

∗
⌜
S
(
S
(
S
x
))
=
y
⌝
:
PROP
.
Proof
.
iIntros
"#H1 H2"
.
iSimpl
in
"#"
.
Show
.
done
.
Qed
.
Lemma
test_iIntros_pure_neg
:
(
⌜
¬
False
⌝
:
PROP
)%
I
.
Lemma
test_iIntros_pure_neg
:
(
⌜
¬
False
⌝
:
PROP
)%
I
.
Proof
.
by
iIntros
(?).
Qed
.
Proof
.
by
iIntros
(?).
Qed
.
...
...
theories/proofmode/ltac_tactics.v
View file @
a7fe86a3
...
@@ 107,40 +107,6 @@ Ltac iFresh :=
...
@@ 107,40 +107,6 @@ Ltac iFresh :=
constr
:
(
IAnon
n
)
constr
:
(
IAnon
n
)
end
.
end
.
(** * Simplification *)
Tactic
Notation
"iEval"
tactic
(
t
)
:
=
iStartProof
;
eapply
tac_eval
;
[
let
x
:
=
fresh
in
intros
x
;
t
;
unfold
x
;
reflexivity
].
Ltac
iEval_go
t
Hs
:
=
match
Hs
with

[]
=>
idtac

?H
::
?Hs
=>
let
H
:
=
pretty_ident
H
in
eapply
tac_eval_in
with
_
H
_
_
_;
[
pm_reflexivity

fail
"iEval:"
H
"not found"

let
x
:
=
fresh
in
intros
x
;
t
;
unfold
x
;
reflexivity

pm_reflexivity

iEval_go
t
Hs
]
end
.
Tactic
Notation
"iEval"
tactic
(
t
)
"in"
constr
(
H
)
:
=
iStartProof
;
let
Hs
:
=
words
H
in
iEval_go
t
Hs
.
Tactic
Notation
"iSimpl"
:
=
iEval
(
simpl
).
Tactic
Notation
"iSimpl"
"in"
constr
(
H
)
:
=
iEval
(
simpl
)
in
H
.
(* It would be nice to also have an `iSsrRewrite`, however, for this we need to
pass arguments to Ssreflect's `rewrite` like `/= foo /bar` in Ltac, see:
https://sympa.inria.fr/sympa/arc/coqclub/201801/msg00000.html
PMP told me (= Robbert) in person that this is not possible with the current
Ltac, but it may be possible in Ltac2. *)
(** * Context manipulation *)
(** * Context manipulation *)
Tactic
Notation
"iRename"
constr
(
H1
)
"into"
constr
(
H2
)
:
=
Tactic
Notation
"iRename"
constr
(
H1
)
"into"
constr
(
H2
)
:
=
eapply
tac_rename
with
_
H1
H2
_
_;
(* (i:=H1) (j:=H2) *)
eapply
tac_rename
with
_
H1
H2
_
_;
(* (i:=H1) (j:=H2) *)
...
@@ 151,9 +117,12 @@ Tactic Notation "iRename" constr(H1) "into" constr(H2) :=
...
@@ 151,9 +117,12 @@ Tactic Notation "iRename" constr(H1) "into" constr(H2) :=
let
H2
:
=
pretty_ident
H2
in
let
H2
:
=
pretty_ident
H2
in
fail
"iRename:"
H2
"not fresh"
].
fail
"iRename:"
H2
"not fresh"
].
(** Elaborated selection patterns, unlike the type [sel_pat], contains
only specific identifiers, and no wildcards like `#` (with the
exception of the pure selection pattern `%`) *)
Inductive
esel_pat
:
=
Inductive
esel_pat
:
=

ESelPure

ESelPure

ESelIdent
:
bool
→
ident
→
esel_pat
.

ESelIdent
:
(* whether the ident is intuitionistic *)
bool
→
ident
→
esel_pat
.
Local
Ltac
iElaborateSelPat_go
pat
Δ
Hs
:
=
Local
Ltac
iElaborateSelPat_go
pat
Δ
Hs
:
=
lazymatch
pat
with
lazymatch
pat
with
...
@@ 175,6 +144,8 @@ Local Ltac iElaborateSelPat_go pat Δ Hs :=
...
@@ 175,6 +144,8 @@ Local Ltac iElaborateSelPat_go pat Δ Hs :=
fail
"iElaborateSelPat:"
H
"not found"
fail
"iElaborateSelPat:"
H
"not found"
end
end
end
.
end
.
(** Converts a selection pattern (given as a string) to a list of
elaborated selection patterns. *)
Ltac
iElaborateSelPat
pat
:
=
Ltac
iElaborateSelPat
pat
:
=
lazymatch
goal
with
lazymatch
goal
with


envs_entails
?
Δ
_
=>


envs_entails
?
Δ
_
=>
...
@@ 204,6 +175,39 @@ Tactic Notation "iClear" constr(Hs) :=
...
@@ 204,6 +175,39 @@ Tactic Notation "iClear" constr(Hs) :=
Tactic
Notation
"iClear"
"("
ident_list
(
xs
)
")"
constr
(
Hs
)
:
=
Tactic
Notation
"iClear"
"("
ident_list
(
xs
)
")"
constr
(
Hs
)
:
=
iClear
Hs
;
clear
xs
.
iClear
Hs
;
clear
xs
.
(** ** Simplification *)
Tactic
Notation
"iEval"
tactic
(
t
)
:
=
iStartProof
;
eapply
tac_eval
;
[
let
x
:
=
fresh
in
intros
x
;
t
;
unfold
x
;
reflexivity
].
Local
Ltac
iEval_go
t
Hs
:
=
lazymatch
Hs
with

[]
=>
idtac

ESelPure
::
?Hs
=>
fail
"iEval: %: unsupported selection pattern"

ESelIdent
_
?H
::
?Hs
=>
eapply
tac_eval_in
with
_
H
_
_
_;
[
pm_reflexivity

let
H
:
=
pretty_ident
H
in
fail
"iEval:"
H
"not found"

let
x
:
=
fresh
in
intros
x
;
t
;
unfold
x
;
reflexivity

pm_reflexivity

iEval_go
t
Hs
]
end
.
Tactic
Notation
"iEval"
tactic
(
t
)
"in"
constr
(
Hs
)
:
=
iStartProof
;
let
Hs
:
=
iElaborateSelPat
Hs
in
iEval_go
t
Hs
.
Tactic
Notation
"iSimpl"
:
=
iEval
(
simpl
).
Tactic
Notation
"iSimpl"
"in"
constr
(
H
)
:
=
iEval
(
simpl
)
in
H
.
(* It would be nice to also have an `iSsrRewrite`, however, for this we need to
pass arguments to Ssreflect's `rewrite` like `/= foo /bar` in Ltac, see:
https://sympa.inria.fr/sympa/arc/coqclub/201801/msg00000.html
PMP told me (= Robbert) in person that this is not possible with the current
Ltac, but it may be possible in Ltac2. *)
(** * Assumptions *)
(** * Assumptions *)
Tactic
Notation
"iExact"
constr
(
H
)
:
=
Tactic
Notation
"iExact"
constr
(
H
)
:
=
eapply
tac_assumption
with
_
H
_
_;
(* (i:=H) *)
eapply
tac_assumption
with
_
H
_
_;
(* (i:=H) *)
...
...
Write
Preview
Markdown
is supported
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