Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Janno
iris-coq
Commits
19e70e9e
Commit
19e70e9e
authored
Aug 08, 2016
by
Ralf Jung
Browse files
make the two proofs of contradictions more similar to each other
parent
1c5a85f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
program_logic/counter_examples.v
View file @
19e70e9e
...
...
@@ -14,49 +14,38 @@ Module savedprop. Section savedprop.
Hypothesis
sprop_persistent
:
∀
i
P
,
PersistentP
(
saved
i
P
).
Hypothesis
sprop_alloc_dep
:
∀
(
P
:
sprop
→
iProp
),
True
=
r
=>
(
∃
i
,
saved
i
(
P
i
)).
Hypothesis
sprop_agree
:
∀
i
P
Q
,
saved
i
P
∧
saved
i
Q
⊢
P
↔
Q
.
Hypothesis
sprop_agree
:
∀
i
P
Q
,
saved
i
P
∧
saved
i
Q
⊢
□
(
P
↔
Q
)
.
(* Self-contradicting assertions are inconsistent *)
Lemma
no_self_contradiction
P
`
{!
PersistentP
P
}
:
□
(
P
↔
¬
P
)
⊢
False
.
Proof
.
iIntros
"#[H1 H2]"
.
iAssert
P
as
"#HP"
.
{
iApply
"H2"
.
iIntros
"!# #HP"
.
by
iApply
(
"H1"
with
"[#]"
).
}
by
iApply
(
"H1"
with
"[#]"
).
Qed
.
(** A bad recursive reference: "Assertion with name [i] does not hold" *)
Definition
A
(
i
:
sprop
)
:
iProp
:
=
∃
P
,
¬
P
★
saved
i
P
.
Lemma
A_alloc
:
True
=
r
=>
∃
i
,
saved
i
(
A
i
).
Proof
.
by
apply
sprop_alloc_dep
.
Qed
.
(* "Assertion with name [i]" is equivalent to any assertion P s.t. [saved i P] *)
Definition
A
(
i
:
sprop
)
:
iProp
:
=
∃
P
,
saved
i
P
★
□
P
.
Lemma
saved_is_A
i
P
`
{!
PersistentP
P
}
:
saved
i
P
⊢
□
(
A
i
↔
P
).
Lemma
saved_NA
i
:
saved
i
(
A
i
)
⊢
¬
A
i
.
Proof
.
iIntros
"#HS !#"
.
iSplit
.
-
iDestruct
1
as
(
Q
)
"[#HSQ HQ]"
.
iApply
(
sprop_agree
i
P
Q
with
"[]"
)
;
eauto
.
-
iIntros
"#HP"
.
iExists
P
.
by
iSplit
.
iIntros
"#Hs !# #HA"
.
iPoseProof
"HA"
as
"HA'"
.
iDestruct
"HA'"
as
(
P
)
"[#HNP HsP]"
.
iApply
"HNP"
.
iDestruct
(
sprop_agree
i
P
(
A
i
)
with
"[]"
)
as
"#[_ HP]"
.
{
eauto
.
}
iApply
"HP"
.
done
.
Qed
.
(* Define [Q i] to be "negated assertion with name [i]". Show that this
implies that assertion with name [i] is equivalent to its own negation. *)
Definition
Q
i
:
=
saved
i
(
¬
A
i
).
Lemma
Q_self_contradiction
i
:
Q
i
⊢
□
(
A
i
↔
¬
A
i
).
Proof
.
iIntros
"#HQ !#"
.
by
iApply
(
saved_is_A
i
(
¬
A
i
)).
Qed
.
(* We can obtain such a [Q i]. *)
Lemma
make_Q
:
True
=
r
=>
∃
i
,
Q
i
.
Proof
.
apply
sprop_alloc_dep
.
Qed
.
(* Put together all the pieces to derive a contradiction. *)
Lemma
rvs_false
:
(
True
:
uPred
M
)
=
r
=>
False
.
Lemma
saved_A
i
:
saved
i
(
A
i
)
⊢
A
i
.
Proof
.
rewrite
make_Q
.
apply
uPred
.
rvs_mono
.
iDestruct
1
as
(
i
)
"HQ
"
.
iApply
(
no_self_contradiction
(
A
i
)).
by
iApply
Q_self_contradiction
.
iIntros
"#Hs"
.
iExists
(
A
i
).
iFrame
"#
"
.
by
iApply
saved_NA
.
Qed
.
Lemma
contradiction
:
False
.
Proof
.
apply
(@
uPred
.
adequacy
M
False
1
)
;
simpl
.
rewrite
-
uPred
.
later_intro
.
apply
rvs_false
.
iIntros
""
.
iVs
A_alloc
as
(
i
)
"#H"
.
iPoseProof
(
saved_NA
with
"H"
)
as
"HN"
.
iVsIntro
.
iNext
.
iApply
"HN"
.
iApply
saved_A
.
done
.
Qed
.
End
savedprop
.
End
savedprop
.
(** This proves that we need the ▷ when opening invariants. *)
...
...
@@ -180,26 +169,26 @@ Module inv. Section inv.
Lemma
A_alloc
:
True
⊢
pvs
M1
(
∃
i
,
saved
i
(
A
i
)).
Proof
.
by
apply
saved_alloc
.
Qed
.
Lemma
alloc
_NA
i
:
saved
i
(
A
i
)
⊢
¬
A
i
.
Lemma
saved
_NA
i
:
saved
i
(
A
i
)
⊢
¬
A
i
.
Proof
.
iIntros
"#Hi !# #HA"
.
iPoseProof
"HA"
as
"HA'"
.
iDestruct
"HA'"
as
(
P
)
"#[HNP Hi']"
.
iVs
(
saved_cast
i
with
"[]"
)
as
"HP"
.
{
iSplit
;
first
iExact
"Hi"
.
by
iFrame
"#"
.
}
iVs
(
saved_cast
i
(
A
i
)
P
with
"[]"
)
as
"HP"
.
{
eauto
.
}
by
iApply
"HNP"
.
Qed
.
Lemma
alloc
_A
i
:
saved
i
(
A
i
)
⊢
A
i
.
Lemma
saved
_A
i
:
saved
i
(
A
i
)
⊢
A
i
.
Proof
.
iIntros
"#Hi"
.
i
PoseProof
(
alloc_NA
with
"Hi"
)
as
"HNA
"
.
iExists
(
A
i
).
by
iFrame
"#"
.
iIntros
"#Hi"
.
i
Exists
(
A
i
).
iFrame
"#
"
.
by
iApply
saved_NA
.
Qed
.
Lemma
contradiction
:
False
.
Proof
.
apply
soundness
.
iIntros
""
.
iVs
A_alloc
as
(
i
)
"#H"
.
iPoseProof
(
alloc
_NA
with
"H"
)
as
"HN"
.
iApply
"HN"
.
iApply
alloc
_A
.
done
.
iPoseProof
(
saved
_NA
with
"H"
)
as
"HN"
.
iApply
"HN"
.
iApply
saved
_A
.
done
.
Qed
.
End
inv
.
End
inv
.
Write
Preview
Supports
Markdown
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