Skip to content
Snippets Groups Projects
Commit 297fa447 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Fix some very long lines.

parent 5634e2a8
No related branches found
No related tags found
No related merge requests found
...@@ -74,7 +74,8 @@ Section least. ...@@ -74,7 +74,8 @@ Section least.
Qed. Qed.
End least. End least.
Lemma least_fixpoint_strong_mono {PROP : bi} {A : ofe} (F : (A PROP) (A PROP)) `{!BiMonoPred F} Lemma least_fixpoint_strong_mono
{PROP : bi} {A : ofe} (F : (A PROP) (A PROP)) `{!BiMonoPred F}
(G : (A PROP) (A PROP)) `{!BiMonoPred G} : (G : (A PROP) (A PROP)) `{!BiMonoPred G} :
( Φ x, F Φ x -∗ G Φ x) -∗ ( Φ x, F Φ x -∗ G Φ x) -∗
x, bi_least_fixpoint F x -∗ bi_least_fixpoint G x. x, bi_least_fixpoint F x -∗ bi_least_fixpoint G x.
...@@ -84,23 +85,26 @@ Proof. ...@@ -84,23 +85,26 @@ Proof.
by iApply "Hmon". by iApply "Hmon".
Qed. Qed.
(** (** In addition to [least_fixpoint_iter], we provide two derived, stronger
In addition to [least_fixpoint_iter], we provide two derived, stronger induction principles. induction principles:
- [least_fixpoint_ind] allows to assume [F (λ x, Φ x ∧ bi_least_fixpoint F x) y] when proving
the inductive step. - [least_fixpoint_ind] allows to assume [F (λ x, Φ x ∧ bi_least_fixpoint F x) y]
Intuitively, it does not only offer the induction hypothesis ([Φ] under an application of [F]), when proving the inductive step.
but also the induction predicate [bi_least_fixpoint F] itself (under an application of [F]). Intuitively, it does not only offer the induction hypothesis ([Φ] under an
- [least_fixpoint_ind_wf] intuitively corresponds to a kind of well-founded induction. application of [F]), but also the induction predicate [bi_least_fixpoint F]
It provides the hypothesis [F (bi_least_fixpoint (λ Ψ a, Φ a ∧ F Ψ a)) y] and thus allows itself (under an application of [F]).
to assume the induction hypothesis not just below one application of [F], but below any - [least_fixpoint_ind_wf] intuitively corresponds to a kind of well-founded
positive number (by unfolding the least fixpoint). induction. It provides the hypothesis [F (bi_least_fixpoint (λ Ψ a, Φ a ∧ F Ψ a)) y]
The unfolding lemma [least_fixpoint_unfold] as well as [least_fixpoint_strong_mono] can be useful and thus allows to assume the induction hypothesis not just below one
to work with the hypothesis. application of [F], but below any positive number (by unfolding the least
*) fixpoint). The unfolding lemma [least_fixpoint_unfold] as well as
[least_fixpoint_strong_mono] can be useful to work with the hypothesis. *)
Section least_ind. Section least_ind.
Context {PROP : bi} {A : ofe} (F : (A PROP) (A PROP)) `{!BiMonoPred F}. Context {PROP : bi} {A : ofe} (F : (A PROP) (A PROP)) `{!BiMonoPred F}.
Let wf_pred_mono `{!NonExpansive Φ} : BiMonoPred (λ (Ψ : A PROP) (a : A), Φ a F Ψ a)%I. Let wf_pred_mono `{!NonExpansive Φ} :
BiMonoPred (λ (Ψ : A PROP) (a : A), Φ a F Ψ a)%I.
Proof using Type*. Proof using Type*.
split; last solve_proper. split; last solve_proper.
intros Ψ Ψ' Hne Hne'. iIntros "#Mon" (x) "Ha". iSplit; first by iDestruct "Ha" as "[$ _]". intros Ψ Ψ' Hne Hne'. iIntros "#Mon" (x) "Ha". iSplit; first by iDestruct "Ha" as "[$ _]".
...@@ -190,7 +194,8 @@ Section greatest. ...@@ -190,7 +194,8 @@ Section greatest.
Proof. iIntros "#HΦ" (x) "Hx". iExists (OfeMor Φ). auto. Qed. Proof. iIntros "#HΦ" (x) "Hx". iExists (OfeMor Φ). auto. Qed.
End greatest. End greatest.
Lemma greatest_fixpoint_strong_mono {PROP : bi} {A : ofe} (F : (A PROP) (A PROP)) `{!BiMonoPred F} Lemma greatest_fixpoint_strong_mono {PROP : bi} {A : ofe}
(F : (A PROP) (A PROP)) `{!BiMonoPred F}
(G : (A PROP) (A PROP)) `{!BiMonoPred G} : (G : (A PROP) (A PROP)) `{!BiMonoPred G} :
( Φ x, F Φ x -∗ G Φ x) -∗ ( Φ x, F Φ x -∗ G Φ x) -∗
x, bi_greatest_fixpoint F x -∗ bi_greatest_fixpoint G x. x, bi_greatest_fixpoint F x -∗ bi_greatest_fixpoint G x.
...@@ -200,42 +205,44 @@ Proof using Type*. ...@@ -200,42 +205,44 @@ Proof using Type*.
by iApply "Hmon". by iApply "Hmon".
Qed. Qed.
(** (** In addition to [greatest_fixpoint_coiter], we provide two derived, stronger
In addition to [greatest_fixpoint_coiter], we provide two derived, stronger coinduction principles. coinduction principles:
- [greatest_fixpoint_coind] requires to prove [F (λ x, Φ x ∨ bi_greatest_fixpoint F x) y]
in the coinductive step instead of [F Φ y] and thus instead allows to prove the original - [greatest_fixpoint_coind] requires to prove
fixpoint again, after taking one step. [F (λ x, Φ x ∨ bi_greatest_fixpoint F x) y] in the coinductive step instead of
- [greatest_fixpoint_paco] allows for so-called parameterized coinduction, a stronger coinduction [F Φ y] and thus instead allows to prove the original fixpoint again, after
principle, where [F (bi_greatest_fixpoint (λ Ψ a, Φ a ∨ F Ψ a)) y] needs to be established in taking one step.
the coinductive step. It allows to prove the hypothesis [Φ] not just after one step, - [greatest_fixpoint_paco] allows for so-called parameterized coinduction, a
but after any positive number of unfoldings of the greatest fixpoint. stronger coinduction principle, where [F (bi_greatest_fixpoint (λ Ψ a, Φ a ∨ F Ψ a)) y]
This encodes a way of accumulating "knowledge" in the coinduction hypothesis: needs to be established in the coinductive step. It allows to prove the
if you return to the "initial point" [Φ] of the coinduction after some number of hypothesis [Φ] not just after one step, but after any positive number of
unfoldings (not just one), the proof is done. unfoldings of the greatest fixpoint. This encodes a way of accumulating
(interestingly, this is the dual to [least_fixpoint_ind_wf]). "knowledge" in the coinduction hypothesis: if you return to the "initial
The unfolding lemma [greatest_fixpoint_unfold] and [greatest_fixpoint_strong_mono] may be useful point" [Φ] of the coinduction after some number of unfoldings (not just one),
when using this lemma. the proof is done. (Interestingly, this is the dual to [least_fixpoint_ind_wf]).
The unfolding lemma [greatest_fixpoint_unfold] and
Example use case: [greatest_fixpoint_strong_mono] may be useful when using this lemma.
Suppose that [F] defines a coinductive simulation relation, e.g.,
[F rec '(e_t, e_s) := *Example use case:*
(is_val e_s ∧ is_val e_t ∧ post e_t e_s) ∨
(safe e_t ∧ ∀ e_t', step e_t e_t' → ∃ e_s', step e_s e_s' ∧ rec e_t' e_s')], Suppose that [F] defines a coinductive simulation relation, e.g.,
and [sim e_t e_s := bi_greatest_fixpoint F]. [F rec '(e_t, e_s) :=
Suppose you want to show a simulation of two loops, (is_val e_s ∧ is_val e_t ∧ post e_t e_s) ∨
[sim (while ...) (while ...)], (safe e_t ∧ ∀ e_t', step e_t e_t' → ∃ e_s', step e_s e_s' ∧ rec e_t' e_s')],
i.e. [Φ '(e_t, e_s) := e_t = while ... ∧ e_s = while ...]. and [sim e_t e_s := bi_greatest_fixpoint F].
Then the standard coinduction principle [greatest_fixpoint_iter] Suppose you want to show a simulation of two loops,
requires to establish the coinduction hypothesis [Φ] after precisely [sim (while ...) (while ...)],
one unfolding of [sim], which is clearly not strong enough if the i.e., [Φ '(e_t, e_s) := e_t = while ... ∧ e_s = while ...].
loop takes multiple steps of computation per iteration. Then the standard coinduction principle [greatest_fixpoint_iter] requires to
But [greatest_fixpoint_paco] allows to establish a fixpoint to which [Φ] has establish the coinduction hypothesis [Φ] after precisely one unfolding of [sim],
been added as a disjunct. which is clearly not strong enough if the loop takes multiple steps of
This fixpoint can be unfolded arbitrarily many times, allowing to establish the computation per iteration. But [greatest_fixpoint_paco] allows to establish a
coinduction hypothesis after any number of steps. fixpoint to which [Φ] has been added as a disjunct. This fixpoint can be
This enables to take multiple simulation steps, before closing the coinduction unfolded arbitrarily many times, allowing to establish the coinduction
by establishing the hypothesis [Φ] again. hypothesis after any number of steps. This enables to take multiple simulation
*) steps, before closing the coinduction by establishing the hypothesis [Φ]
again. *)
Section greatest_coind. Section greatest_coind.
Context {PROP : bi} {A : ofe} (F : (A PROP) (A PROP)) `{!BiMonoPred F}. Context {PROP : bi} {A : ofe} (F : (A PROP) (A PROP)) `{!BiMonoPred F}.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment