Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
Iris
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PierreMarie Pédrot
Iris
Commits
23ed2310
Commit
23ed2310
authored
Feb 19, 2018
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split `iSpecializeCore` into two parts to improve reuse.
parent
7b1face0
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
44 additions
and
38 deletions
+44
38
theories/proofmode/tactics.v
theories/proofmode/tactics.v
+44
38
No files found.
theories/proofmode/tactics.v
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
:
(
ITrm
t
hnil
""
)

_
=>
t
let
pat
:
=
spec_pat
.
parse
pat
in
let
H
:
=
lazymatch
type
of
H
with

string
=>
constr
:
(
INamed
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
)
:
=
...
...
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