Commit 7ee24879 by Ralf Jung

### make sbi_laterN compute and rely on that instead of MakeLaterN

`With a pretty proof by Robbert`
parent 5d0644f4
 "sep_exist" : string 1 subgoal 1 subgoal M : ucmraT M : ucmraT ... @@ -44,6 +46,8 @@ P ... @@ -44,6 +46,8 @@ P --------------------------------------∗ --------------------------------------∗ P P "sep_exist_short" : string 1 subgoal 1 subgoal M : ucmraT M : ucmraT ... @@ -57,6 +61,8 @@ P ... @@ -57,6 +61,8 @@ P --------------------------------------∗ --------------------------------------∗ ∃ a : A, Ψ a ∗ P ∃ a : A, Ψ a ∗ P "read_spec" : string 1 subgoal 1 subgoal Σ : gFunctors Σ : gFunctors ... ...
 ... @@ -25,6 +25,7 @@ Section demo. ... @@ -25,6 +25,7 @@ Section demo. Qed. Qed. (* The version in IPM *) (* The version in IPM *) Check "sep_exist". Lemma sep_exist A (P R: iProp) (Ψ: A → iProp) : Lemma sep_exist A (P R: iProp) (Ψ: A → iProp) : P ∗ (∃ a, Ψ a) ∗ R ⊢ ∃ a, Ψ a ∗ P. P ∗ (∃ a, Ψ a) ∗ R ⊢ ∃ a, Ψ a ∗ P. Proof. Proof. ... @@ -35,6 +36,7 @@ Section demo. ... @@ -35,6 +36,7 @@ Section demo. Qed. Qed. (* The short version in IPM, as in the paper *) (* The short version in IPM, as in the paper *) Check "sep_exist_short". Lemma sep_exist_short A (P R: iProp) (Ψ: A → iProp) : Lemma sep_exist_short A (P R: iProp) (Ψ: A → iProp) : P ∗ (∃ a, Ψ a) ∗ R ⊢ ∃ a, Ψ a ∗ P. P ∗ (∃ a, Ψ a) ∗ R ⊢ ∃ a, Ψ a ∗ P. Proof. iIntros "[HP [HΨ HR]]". Show. iFrame "HP". iAssumption. Qed. Proof. iIntros "[HP [HΨ HR]]". Show. iFrame "HP". iAssumption. Qed. ... @@ -235,6 +237,7 @@ Section counter_proof. ... @@ -235,6 +237,7 @@ Section counter_proof. wp_if. iApply ("IH" with "[Hγf]"). rewrite {3}/C; eauto 10. wp_if. iApply ("IH" with "[Hγf]"). rewrite {3}/C; eauto 10. Qed. Qed. Check "read_spec". Lemma read_spec l n : Lemma read_spec l n : {{ C l n }} read #l {{ v, ∃ m : nat, ⌜v = #m ∧ n ≤ m⌝ ∧ C l m }}. {{ C l n }} read #l {{ v, ∃ m : nat, ⌜v = #m ∧ n ≤ m⌝ ∧ C l m }}. Proof. Proof. ... ...
 ... @@ -59,6 +59,31 @@ In nested Ltac calls to "iSpecialize (open_constr)", ... @@ -59,6 +59,31 @@ In nested Ltac calls to "iSpecialize (open_constr)", "iSpecializePat (open_constr) (constr)" and "iSpecializePat_go", last call "iSpecializePat (open_constr) (constr)" and "iSpecializePat_go", last call failed. failed. Tactic failure: iSpecialize: cannot instantiate (⌜φ⌝ → P -∗ False)%I with P. Tactic failure: iSpecialize: cannot instantiate (⌜φ⌝ → P -∗ False)%I with P. 1 subgoal PROP : sbi P, Q : PROP n, m, k : nat ============================ --------------------------------------∗ ▷^(S n + S m) emp 1 subgoal PROP : sbi P, Q : PROP ============================ --------------------------------------∗ ▷ emp 1 subgoal PROP : sbi P, Q : PROP ============================ --------------------------------------∗ ▷ emp The command has indeed failed with message: The command has indeed failed with message: In nested Ltac calls to "iFrame (constr)", In nested Ltac calls to "iFrame (constr)", "" and "" and ... ...
 ... @@ -367,7 +367,7 @@ Lemma test_iNext_plus_2 P n m : ▷^n ▷^m P -∗ ▷^(n+m) P. ... @@ -367,7 +367,7 @@ Lemma test_iNext_plus_2 P n m : ▷^n ▷^m P -∗ ▷^(n+m) P. Proof. iIntros "H". iNext. done. Qed. Proof. iIntros "H". iNext. done. Qed. Lemma test_iNext_plus_3 P Q n m k : Lemma test_iNext_plus_3 P Q n m k : ▷^m ▷^(2 + S n + k) P -∗ ▷^m ▷ ▷^(2 + S n) Q -∗ ▷^k ▷ ▷^(S (S n + S m)) (P ∗ Q). ▷^m ▷^(2 + S n + k) P -∗ ▷^m ▷ ▷^(2 + S n) Q -∗ ▷^k ▷ ▷^(S (S n + S m)) (P ∗ Q). Proof. iIntros "H1 H2". iNext. iNext. iNext. iFrame. Qed. Proof. iIntros "H1 H2". iNext. iNext. iNext. iFrame. Show. iModIntro. done. Qed. Lemma test_iNext_unfold P Q n m (R := (▷^n P)%I) : Lemma test_iNext_unfold P Q n m (R := (▷^n P)%I) : R ⊢ ▷^m True. R ⊢ ▷^m True. ... @@ -409,10 +409,10 @@ Lemma test_iPureIntro_absorbing (φ : Prop) : ... @@ -409,10 +409,10 @@ Lemma test_iPureIntro_absorbing (φ : Prop) : Proof. intros ?. iPureIntro. done. Qed. Proof. intros ?. iPureIntro. done. Qed. Lemma test_iFrame_later_1 P Q : P ∗ ▷ Q -∗ ▷ (P ∗ ▷ Q). Lemma test_iFrame_later_1 P Q : P ∗ ▷ Q -∗ ▷ (P ∗ ▷ Q). Proof. iIntros "H". iFrame "H". auto. Qed. Proof. iIntros "H". iFrame "H". Show. auto. Qed. Lemma test_iFrame_later_2 P Q : ▷ P ∗ ▷ Q -∗ ▷ (▷ P ∗ ▷ Q). Lemma test_iFrame_later_2 P Q : ▷ P ∗ ▷ Q -∗ ▷ (▷ P ∗ ▷ Q). Proof. iIntros "H". iFrame "H". auto. Qed. Proof. iIntros "H". iFrame "H". Show. auto. Qed. Lemma test_with_ident P Q R : P -∗ Q -∗ (P -∗ Q -∗ R) -∗ R. Lemma test_with_ident P Q R : P -∗ Q -∗ (P -∗ Q -∗ R) -∗ R. Proof. Proof. ... ...
 ... @@ -206,7 +206,7 @@ Lemma ofe_fun_validI `{B : A → ucmraT} (g : ofe_fun B) : ✓ g ⊣⊢ ∀ i, ... @@ -206,7 +206,7 @@ Lemma ofe_fun_validI `{B : A → ucmraT} (g : ofe_fun B) : ✓ g ⊣⊢ ∀ i, Proof. exact: uPred_primitive.ofe_fun_validI. Qed. Proof. exact: uPred_primitive.ofe_fun_validI. Qed. (** Consistency/soundness statement *) (** Consistency/soundness statement *) Lemma soundness φ n : (▷^n ⌜ φ ⌝ : uPred M)%I → φ. Lemma soundness_iter φ n : Nat.iter n sbi_later (⌜ φ ⌝ : uPred M)%I → φ. Proof. exact: uPred_primitive.soundness. Qed. Proof. exact: uPred_primitive.soundness. Qed. End restate. End restate. ... ...
 ... @@ -91,8 +91,14 @@ Global Instance uPred_ownM_sep_homomorphism : ... @@ -91,8 +91,14 @@ Global Instance uPred_ownM_sep_homomorphism : MonoidHomomorphism op uPred_sep (≡) (@uPred_ownM M). MonoidHomomorphism op uPred_sep (≡) (@uPred_ownM M). Proof. split; [split; try apply _|]. apply ownM_op. apply ownM_unit'. Qed. Proof. split; [split; try apply _|]. apply ownM_op. apply ownM_unit'. Qed. (** Iterated later *) Lemma laterN_iter n P : (▷^n P)%I = Nat.iter n sbi_later P. Proof. induction n; f_equal/=; auto. Qed. (** Consistency/soundness statement *) (** Consistency/soundness statement *) Lemma soundness φ n : (▷^n ⌜ φ ⌝ : uPred M)%I → φ. Proof. rewrite laterN_iter. apply soundness_iter. Qed. Corollary consistency_modal n : ¬ (▷^n False : uPred M)%I. Corollary consistency_modal n : ¬ (▷^n False : uPred M)%I. Proof. exact (soundness False n). Qed. Proof. exact (soundness False n). Qed. ... ...
 ... @@ -88,8 +88,11 @@ Fixpoint bi_hforall {PROP : bi} {As} : himpl As PROP → PROP := ... @@ -88,8 +88,11 @@ Fixpoint bi_hforall {PROP : bi} {As} : himpl As PROP → PROP := | tcons A As => λ Φ, ∀ x, bi_hforall (Φ x) | tcons A As => λ Φ, ∀ x, bi_hforall (Φ x) end%I. end%I. Definition sbi_laterN {PROP : sbi} (n : nat) (P : PROP) : PROP := Fixpoint sbi_laterN {PROP : sbi} (n : nat) (P : PROP) : PROP := Nat.iter n sbi_later P. match n with | O => P | S n' => ▷ sbi_laterN n' P end%I. Arguments sbi_laterN {_} !_%nat_scope _%I. Arguments sbi_laterN {_} !_%nat_scope _%I. Instance: Params (@sbi_laterN) 2. Instance: Params (@sbi_laterN) 2. Notation "▷^ n P" := (sbi_laterN n P) : bi_scope. Notation "▷^ n P" := (sbi_laterN n P) : bi_scope. ... ...
 ... @@ -27,8 +27,8 @@ Tactic Notation "wp_expr_eval" tactic(t) := ... @@ -27,8 +27,8 @@ Tactic Notation "wp_expr_eval" tactic(t) := | _ => fail "wp_expr_eval: not a 'wp'" | _ => fail "wp_expr_eval: not a 'wp'" end. end. Ltac wp_expr_simpl := wp_expr_eval simpl. Ltac wp_expr_simpl := (wp_expr_eval simpl); pm_prettify. Ltac wp_expr_simpl_subst := wp_expr_eval simpl_subst. Ltac wp_expr_simpl_subst := (wp_expr_eval simpl_subst); pm_prettify. Lemma tac_wp_pure `{heapG Σ} Δ Δ' s E e1 e2 φ Φ : Lemma tac_wp_pure `{heapG Σ} Δ Δ' s E e1 e2 φ Φ : PureExec φ e1 e2 → PureExec φ e1 e2 → ... ...
 ... @@ -287,10 +287,6 @@ Proof. by rewrite /KnownMakeLaterN /MakeLaterN laterN_True. Qed. ... @@ -287,10 +287,6 @@ Proof. by rewrite /KnownMakeLaterN /MakeLaterN laterN_True. Qed. Global Instance make_laterN_emp `{!BiAffine PROP} n : Global Instance make_laterN_emp `{!BiAffine PROP} n : @KnownMakeLaterN PROP n emp emp | 0. @KnownMakeLaterN PROP n emp emp | 0. Proof. by rewrite /KnownMakeLaterN /MakeLaterN laterN_emp. Qed. Proof. by rewrite /KnownMakeLaterN /MakeLaterN laterN_emp. Qed. Global Instance make_laterN_0 P : MakeLaterN 0 P P | 0. Proof. by rewrite /MakeLaterN. Qed. Global Instance make_laterN_1 P : MakeLaterN 1 P (▷ P) | 2. Proof. by rewrite /MakeLaterN. Qed. Global Instance make_laterN_default P : MakeLaterN n P (▷^n P) | 100. Global Instance make_laterN_default P : MakeLaterN n P (▷^n P) | 100. Proof. by rewrite /MakeLaterN. Qed. Proof. by rewrite /MakeLaterN. Qed. ... ...
 ... @@ -22,7 +22,7 @@ Declare Reduction pm_cbn := cbn [ ... @@ -22,7 +22,7 @@ Declare Reduction pm_cbn := cbn [ tele_fold tele_bind tele_app tele_fold tele_bind tele_app (* BI connectives *) (* BI connectives *) bi_persistently_if bi_affinely_if bi_intuitionistically_if bi_persistently_if bi_affinely_if bi_intuitionistically_if bi_wandM big_opL bi_wandM sbi_laterN big_opL bi_tforall bi_texist bi_tforall bi_texist ]. ]. Ltac pm_eval t := Ltac pm_eval t := ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!