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
Terraform modules
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
Pierre Roux
Iris
Commits
85cc1a8f
Commit
85cc1a8f
authored
3 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Tests.
parent
6736ea06
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/proofmode.ref
+21
-0
21 additions, 0 deletions
tests/proofmode.ref
tests/proofmode.v
+60
-0
60 additions, 0 deletions
tests/proofmode.v
with
81 additions
and
0 deletions
tests/proofmode.ref
+
21
−
0
View file @
85cc1a8f
...
...
@@ -790,3 +790,24 @@ Tactic failure: iIntuitionistic: "H" not fresh.
: string
The command has indeed failed with message:
Tactic failure: iSpatial: "H" not fresh.
"test_iInduction_Forall"
: string
1 goal
PROP : bi
P : ntree → PROP
l : list ntree
============================
"H" : ∀ l0 : list ntree, (∀ x : ntree, ⌜x ∈ l0⌝ → P x) -∗ P (Tree l0)
"IH" : [∗ list] x ∈ l, □ P x
--------------------------------------□
P (Tree l)
"test_iInduction_Forall_fail"
: string
The command has indeed failed with message:
Tactic failure: iInduction: cannot import IH
(my_Forall
(λ t : ntree,
"H" : ∀ l : list ntree, ([∗ 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
+
60
−
0
View file @
85cc1a8f
...
...
@@ -1712,3 +1712,63 @@ Proof.
Abort
.
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
ntree
:=
Tree
:
list
ntree
→
ntree
.
(** 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
ntree_ind
(
φ
:
ntree
→
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 an induction hypothesis of
the form [∀ x, ⌜ x ∈ l ⌝ → ...]. This is most interesting, since the proof
mode generates a version with [[∗ list]]. *)
Check
"test_iInduction_Forall"
.
Lemma
test_iInduction_Forall
(
P
:
ntree
→
PROP
)
:
□
(
∀
l
,
(
∀
x
,
⌜
x
∈
l
⌝
→
P
x
)
-∗
P
(
Tree
l
))
-∗
∀
t
,
P
t
.
Proof
.
iIntros
"#H"
(
t
)
.
iInduction
t
as
[]
"IH"
.
Show
.
(* make sure that the induction hypothesis is exactly what we want *)
iApply
"H"
.
iIntros
(
x
?)
.
by
iApply
(
big_sepL_elem_of
with
"IH"
)
.
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
ntree_ind_alt
(
φ
:
ntree
→
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
.
Check
"test_iInduction_Forall_fail"
.
Lemma
test_iInduction_Forall_fail
(
P
:
ntree
→
PROP
)
:
□
(
∀
l
,
([
∗
list
]
x
∈
l
,
P
x
)
-∗
P
(
Tree
l
))
-∗
∀
t
,
P
t
.
Proof
.
iIntros
"#H"
(
t
)
.
Fail
iInduction
t
as
[]
"IH"
using
ntree_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