Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
Iris
Commits
23ed2310
Commit
23ed2310
authored
7 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Split `iSpecializeCore` into two parts to improve reuse.
parent
7b1face0
No related branches found
No related tags found
1 merge request
!66
Generalized proofmode
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/proofmode/tactics.v
+44
-38
44 additions, 38 deletions
theories/proofmode/tactics.v
with
44 additions
and
38 deletions
theories/proofmode/tactics.v
+
44
−
38
View file @
23ed2310
...
@@ -559,48 +559,54 @@ introduction pattern, which will be coerced into [true] when it solely contains
...
@@ -559,48 +559,54 @@ introduction pattern, which will be coerced into [true] when it solely contains
In case the specialization pattern in [t] states that the modality of the goal
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]
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). *)
defaults to [false] (i.e. spatial hypotheses are not preserved). *)
Tactic
Notation
"iSpecializeCore"
open_constr
(
t
)
"as"
constr
(
p
)
:=
Tactic
Notation
"iSpecializeCore"
open_constr
(
H
)
"with"
open_constr
(
xs
)
open_constr
(
pat
)
"as"
constr
(
p
)
:=
let
p
:=
intro_pat_persistent
p
in
let
p
:=
intro_pat_persistent
p
in
let
t
:=
let
pa
t
:=
spec_pat
.
parse
pat
in
match
type
of
t
with
let
H
:=
|
string
=>
constr
:(
ITrm
(
INamed
t
)
hnil
""
)
lazymatch
type
of
H
with
|
ident
=>
constr
:(
I
Trm
t
hnil
""
)
|
string
=>
constr
:(
I
Named
H
)
|
_
=>
t
|
_
=>
H
end
in
end
in
lazymatch
t
with
iSpecializeArgs
H
xs
;
|
ITrm
?H
?xs
?pat
=>
lazymatch
type
of
H
with
|
ident
=>
(* The lemma [tac_specialize_persistent_helper] allows one to use all
spatial hypotheses for both proving the premises of the lemma we
specialize as well as those of the remaining goal. We can only use it when
the result of the specialization is persistent, and no modality is
eliminated. As an optimization, we do not use this when only universal
quantifiers are instantiated. *)
let
pat
:=
spec_pat
.
parse
pat
in
let
pat
:=
spec_pat
.
parse
pat
in
let
H
:=
lazymatch
type
of
H
with
string
=>
constr
:(
INamed
H
)
|
_
=>
H
end
in
lazymatch
eval
compute
in
iSpecializeArgs
H
xs
;
(
p
&&
bool_decide
(
pat
≠
[])
&&
negb
(
existsb
spec_pat_modal
pat
))
with
lazymatch
type
of
H
with
|
true
=>
|
ident
=>
(* FIXME: do something reasonable when the BI is not affine *)
(* The lemma [tac_specialize_persistent_helper] allows one to use all
eapply
tac_specialize_persistent_helper
with
_
H
_
_
_
_;
spatial hypotheses for both proving the premises of the lemma we
[
env_reflexivity
||
fail
"iSpecialize:"
H
"not found"
specialize as well as those of the remaining goal. We can only use it when
|
iSpecializePat
H
pat
;
last
(
iExact
H
)
the result of the specialization is persistent, and no modality is
|
apply
_
||
eliminated. As an optimization, we do not use this when only universal
let
Q
:=
match
goal
with
|
-
IntoPersistent
_
?Q
_
=>
Q
end
in
quantifiers are instantiated. *)
fail
"iSpecialize:"
Q
"not persistent"
let
pat
:=
spec_pat
.
parse
pat
in
|
env_cbv
;
apply
_
||
lazymatch
eval
compute
in
let
Q
:=
match
goal
with
|
-
TCAnd
_
(
Affine
?Q
)
=>
Q
end
in
(
p
&&
bool_decide
(
pat
≠
[])
&&
negb
(
existsb
spec_pat_modal
pat
))
with
fail
"iSpecialize:"
Q
"not affine"
|
true
=>
|
env_reflexivity
(* FIXME: do something reasonable when the BI is not affine *)
|
(* goal *)
]
eapply
tac_specialize_persistent_helper
with
_
H
_
_
_
_;
|
false
=>
iSpecializePat
H
pat
[
env_reflexivity
||
fail
"iSpecialize:"
H
"not found"
end
|
iSpecializePat
H
pat
;
last
(
iExact
H
)
|
_
=>
fail
"iSpecialize:"
H
"should be a hypothesis, use iPoseProof instead"
|
apply
_
||
end
.
let
Q
:=
match
goal
with
|
-
IntoPersistent
_
?Q
_
=>
Q
end
in
fail
"iSpecialize:"
Q
"not persistent"
Tactic
Notation
"iSpecializeCore"
open_constr
(
t
)
"as"
constr
(
p
)
:=
|
env_cbv
;
apply
_
||
lazymatch
type
of
t
with
let
Q
:=
match
goal
with
|
-
TCAnd
_
(
Affine
?Q
)
=>
Q
end
in
|
string
=>
iSpecializeCore
t
with
hnil
""
as
p
fail
"iSpecialize:"
Q
"not affine"
|
ident
=>
iSpecializeCore
t
with
hnil
""
as
p
|
env_reflexivity
|
_
=>
|
(* goal *)
]
lazymatch
t
with
|
false
=>
iSpecializePat
H
pat
|
ITrm
?H
?xs
?pat
=>
iSpecializeCore
H
with
xs
pat
as
p
end
|
_
=>
fail
"iSpecialize:"
t
"should be a proof mode term"
|
_
=>
fail
"iSpecialize:"
H
"should be a hypothesis, use iPoseProof instead"
end
end
|
_
=>
fail
"iSpecialize:"
t
"should be a proof mode term"
end
.
end
.
Tactic
Notation
"iSpecialize"
open_constr
(
t
)
:=
Tactic
Notation
"iSpecialize"
open_constr
(
t
)
:=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment