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
Branches containing commit
No related tags found
Tags containing commit
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
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
(
H
)
"with"
open_constr
(
xs
)
open_constr
(
pat
)
"as"
constr
(
p
)
:=
let
p
:=
intro_pat_persistent
p
in
let
t
:=
match
type
of
t
with
|
string
=>
constr
:(
ITrm
(
INamed
t
)
hnil
""
)
|
ident
=>
constr
:(
I
Trm
t
hnil
""
)
|
_
=>
t
let
pa
t
:=
spec_pat
.
parse
pat
in
let
H
:=
lazymatch
type
of
H
with
|
string
=>
constr
:(
I
Named
H
)
|
_
=>
H
end
in
lazymatch
t
with
|
ITrm
?H
?xs
?pat
=>
iSpecializeArgs
H
xs
;
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
H
:=
lazymatch
type
of
H
with
string
=>
constr
:(
INamed
H
)
|
_
=>
H
end
in
iSpecializeArgs
H
xs
;
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
lazymatch
eval
compute
in
(
p
&&
bool_decide
(
pat
≠
[])
&&
negb
(
existsb
spec_pat_modal
pat
))
with
|
true
=>
(* FIXME: do something reasonable when the BI is not affine *)
eapply
tac_specialize_persistent_helper
with
_
H
_
_
_
_;
[
env_reflexivity
||
fail
"iSpecialize:"
H
"not found"
|
iSpecializePat
H
pat
;
last
(
iExact
H
)
|
apply
_
||
let
Q
:=
match
goal
with
|
-
IntoPersistent
_
?Q
_
=>
Q
end
in
fail
"iSpecialize:"
Q
"not persistent"
|
env_cbv
;
apply
_
||
let
Q
:=
match
goal
with
|
-
TCAnd
_
(
Affine
?Q
)
=>
Q
end
in
fail
"iSpecialize:"
Q
"not affine"
|
env_reflexivity
|
(* goal *)
]
|
false
=>
iSpecializePat
H
pat
end
|
_
=>
fail
"iSpecialize:"
H
"should be a hypothesis, use iPoseProof instead"
lazymatch
eval
compute
in
(
p
&&
bool_decide
(
pat
≠
[])
&&
negb
(
existsb
spec_pat_modal
pat
))
with
|
true
=>
(* FIXME: do something reasonable when the BI is not affine *)
eapply
tac_specialize_persistent_helper
with
_
H
_
_
_
_;
[
env_reflexivity
||
fail
"iSpecialize:"
H
"not found"
|
iSpecializePat
H
pat
;
last
(
iExact
H
)
|
apply
_
||
let
Q
:=
match
goal
with
|
-
IntoPersistent
_
?Q
_
=>
Q
end
in
fail
"iSpecialize:"
Q
"not persistent"
|
env_cbv
;
apply
_
||
let
Q
:=
match
goal
with
|
-
TCAnd
_
(
Affine
?Q
)
=>
Q
end
in
fail
"iSpecialize:"
Q
"not affine"
|
env_reflexivity
|
(* goal *)
]
|
false
=>
iSpecializePat
H
pat
end
|
_
=>
fail
"iSpecialize:"
H
"should be a hypothesis, use iPoseProof instead"
end
.
Tactic
Notation
"iSpecializeCore"
open_constr
(
t
)
"as"
constr
(
p
)
:=
lazymatch
type
of
t
with
|
string
=>
iSpecializeCore
t
with
hnil
""
as
p
|
ident
=>
iSpecializeCore
t
with
hnil
""
as
p
|
_
=>
lazymatch
t
with
|
ITrm
?H
?xs
?pat
=>
iSpecializeCore
H
with
xs
pat
as
p
|
_
=>
fail
"iSpecialize:"
t
"should be a proof mode term"
end
|
_
=>
fail
"iSpecialize:"
t
"should be a proof mode term"
end
.
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