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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Ike Mulder
Iris
Commits
a9354385
Commit
a9354385
authored
3 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Add `iInduction` tests.
parent
6ab9c4e7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/proofmode.ref
+8
-0
8 additions, 0 deletions
tests/proofmode.ref
tests/proofmode.v
+59
-0
59 additions, 0 deletions
tests/proofmode.v
with
67 additions
and
0 deletions
tests/proofmode.ref
+
8
−
0
View file @
a9354385
...
@@ -781,3 +781,11 @@ Tactic failure: iPure: (φ n) not pure.
...
@@ -781,3 +781,11 @@ Tactic failure: iPure: (φ n) not pure.
: string
: string
The command has indeed failed with message:
The command has indeed failed with message:
Tactic failure: iIntuitionistic: Q not persistent.
Tactic failure: iIntuitionistic: Q not persistent.
The command has indeed failed with message:
Tactic failure: iInduction: cannot import IH
(my_Forall
(λ t : tree,
"H" : ∀ l : list tree, ([∗ list] x ∈ l, P x) -∗ P (Tree l)
--------------------------------------□
P t
) l) into proof mode context.
This diff is collapsed.
Click to expand it.
tests/proofmode.v
+
59
−
0
View file @
a9354385
...
@@ -1618,3 +1618,62 @@ Proof.
...
@@ -1618,3 +1618,62 @@ Proof.
Qed
.
Qed
.
End
tactic_tests
.
End
tactic_tests
.
Section
mutual_induction
.
Context
{
PROP
:
bi
}
.
Implicit
Types
P
Q
R
:
PROP
.
Implicit
Types
φ
:
nat
→
PROP
.
Implicit
Types
Ψ
:
nat
→
nat
→
PROP
.
Unset
Elimination
Schemes
.
Inductive
tree
:=
Tree
:
list
tree
→
tree
.
(** The common induction principle for finitely branching trees. By default,
Coq generates a too weak induction principle, so we have to prove it by hand. *)
Lemma
tree_ind
(
φ
:
tree
→
Prop
)
:
(
∀
l
,
Forall
φ
l
→
φ
(
Tree
l
))
→
∀
t
,
φ
t
.
Proof
.
intros
Hrec
.
fix
REC
1
.
intros
[
l
]
.
apply
Hrec
.
clear
Hrec
.
induction
l
as
[|
t
l
IH
];
constructor
;
auto
.
Qed
.
(** Now let's test that we can derive the internal induction principle for
finitely branching trees in separation logic. There are many variants of the
induction principle, but we pick the variant with the big op [[∗ list]] in
the induction hypothesis. This is also most interesting, since the proof mode
generates an induction hypothesis of the form [∀ x, ⌜ x ∈ l ⌝ → ...]. *)
Lemma
test_iInduction_Forall
(
P
:
tree
→
PROP
)
:
□
(
∀
l
,
([
∗
list
]
x
∈
l
,
P
x
)
-∗
P
(
Tree
l
))
-∗
∀
t
,
P
t
.
Proof
.
iIntros
"#H"
(
t
)
.
iInduction
t
as
[]
"IH"
.
iApply
"H"
.
iApply
big_sepL_intro
.
iIntros
"!#"
(
k
t'
?
%
elem_of_list_lookup_2
)
.
by
iApply
(
"IH"
with
"[%]"
)
.
Qed
.
(** Now let's define a custom version of [Forall], called [my_Forall], and
use that in the variant [tree_ind_alt] of the induction principle. The proof
mode does not support [my_Forall], so we test if [iInduction] generates a
proper error message. *)
Inductive
my_Forall
{
A
}
(
φ
:
A
→
Prop
)
:
list
A
→
Prop
:=
|
my_Forall_nil
:
my_Forall
φ
[]
|
my_Forall_cons
x
l
:
φ
x
→
my_Forall
φ
l
→
my_Forall
φ
(
x
::
l
)
.
Lemma
tree_ind_alt
(
φ
:
tree
→
Prop
)
:
(
∀
l
,
my_Forall
φ
l
→
φ
(
Tree
l
))
→
∀
t
,
φ
t
.
Proof
.
intros
Hrec
.
fix
REC
1
.
intros
[
l
]
.
apply
Hrec
.
clear
Hrec
.
induction
l
as
[|
t
l
IH
];
constructor
;
auto
.
Qed
.
Lemma
test_iInduction_Forall_fail
(
P
:
tree
→
PROP
)
:
□
(
∀
l
,
([
∗
list
]
x
∈
l
,
P
x
)
-∗
P
(
Tree
l
))
-∗
∀
t
,
P
t
.
Proof
.
iIntros
"#H"
(
t
)
.
Fail
iInduction
t
as
[]
"IH"
using
tree_ind_alt
.
Abort
.
End
mutual_induction
.
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