Skip to content
Snippets Groups Projects

Simpler syncer specs

Merged Ralf Jung requested to merge uncurried-specs into master
1 unresolved thread

This simplifies the syncer specs. The sequential syncer only is slightly improved, by changing

  Definition synced R (f' f: val) :=
    (□ ∀ P Q (x: val), ({{ R ★ P x }} f x {{ v, R ★ Q x v }}) →
                       ({{ P x }} f' x {{ v, Q x v }}))%I.

such that P, Q don't factor in a dependency on x any more. Since all three are quantified at the same time, the two specs are equivalent -- and the one where P is not a predicate and Q is exactly the postcondition is arguably simpler:

  Definition synced R (f f': val) :=
    (□ ∀ P Q (x: val), ({{ R ★ P }} f x {{ v, R ★ Q v }}) →
                       ({{ P }} f' x {{ Q }}))%I.

For the atomic spec, the changes are deeper. The currying on some location l is entirely removed. is_atomic_syncer better mirrors is_syncer from the sequential version. And finally, we use "original" atomic triples and not some modified version thereof (so atomic_triple_base is killed).

TODO: Fix atomic_pcas.v, it relied on the location currying done by atomic_sync.v. However, I don't entirely grok that file. @zhangz could you give that a look?

Merge request reports

Merged by avatar (Jun 13, 2025 9:06pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Notice that there still is a subtle difference between is_syncer and is_atomic_syncer: The former quantifies over x once, and lifts the spec for x "pointwise". The latter demands that the sequential spec holds for all x before proving the atomic spec for all x. That's strictly weaker, and I think there is no reason to make it weaker like that. We could then probably even remove the dependency of \alpha, \beta on x as they would all be quantified at the same place.

    I'll look into that tomorrow.

  • Ghost User
  • Ghost User
    Ghost User @ghost started a thread on the diff
  • 66 iIntros (f) "%".
    67 iApply wp_wand_r.
    68 iSplitR; first iApply "Hsyncer".
    69 iIntros (f') "#Hsynced".
    70 iExists γ. iFrame.
    71 iIntros (x). iAlways.
    72 iIntros (P Q) "#Hvss".
    73 iSpecialize ("Hsynced" $! P Q x).
    74 iIntros "!# HP". iApply wp_wand_r. iSplitL "HP".
    58 iIntros (s) "#Hsyncer". iApply "HΦ".
    59 iSplitL "Hg2"; first done. iIntros "!#".
    60 iIntros (f). iApply wp_wand_r. iSplitR; first by iApply "Hsyncer".
    61 iIntros (f') "#Hsynced {Hsyncer}".
    62 iIntros (α β) "#Hseq".
    63 iIntros (x P Q) "#Hvss !# HP".
    64 (* TODO: Why can't I iApply "Hsynced"? *)
    • Because the post-condition Q in goal WP f' x {{ v, ∃ x0 : A, Q x0 v }} in goal doesn't look like the assumption we have from syncer spec:

        ​"Hsynced" : ∀ (P0 : uPred (iResUR Σ))
                     (Q0 : language.val heap_lang → uPred (iResUR Σ)) 
                     (x0 : val),
                     {{ (∃ g : A, ϕ g ★ gHalf γ g) ★ P0 }} 
                     f x0 {{ v, (∃ g : A, ϕ g ★ gHalf γ g) ★ Q0 v }}
                     → {{ P0 }} f' x0 {{ v, Q0 v }}

      ?

    • But it looks like if we drop the x argument of Q as @robbertkrebbers proposed in the mail, this should be more elegant

    • Well, but the assumption Hsynced has a generalized post-condition that should match any postcondition.

    • Indeed simplifying the atomic triple did not help.

      @robbertkrebbers could you have a look at the iApply-related TODO in atomic_sync.v? Looks to me as if iApply transparently stripping boxes doesn't work here, or maybe sth. else is going on.

    • Please register or sign in to reply
  • Regarding atomic_pcas.v, I will certainly take care of that :) However this week I am stuck in SPLASH-conf at Amsterdam, so feel free to temporarily break it (or remove it from the _CoqProject.

  • All right, I will just comment out atomic_pcas then.

  • Ralf Jung Added 3 commits:

    Added 3 commits:

    • 129cd4e8 - 1 commit from branch master
    • 087a2abd - Simplify sequential syncer; use Texan triples
    • 958942c3 - Improve atomic_syncer

    Compare with previous version

  • Ralf Jung Added 1 commit:

    Added 1 commit:

    • 531ed2a1 - simplify atomic triples as suggested by Robbert

    Compare with previous version

  • Ralf Jung Unmarked this merge request as a Work In Progress

    Unmarked this merge request as a Work In Progress

  • All right, as far as I am concerned, this is ready to be merged.

  • Ralf Jung Added 4 commits:

    Added 4 commits:

    • 6396d121 - 1 commit from branch master
    • 79caa21f - Simplify sequential syncer; use Texan triples
    • c0647f6a - Improve atomic_syncer
    • 908a83a4 - simplify atomic triples as suggested by Robbert

    Compare with previous version

  • I will take 5 days without complaint as "okay to merge" ;) just so that I can proceed with enabling CI for this repository.

  • Ralf Jung Mentioned in commit 8d5768cb

    Mentioned in commit 8d5768cb

  • Ralf Jung Status changed to merged

    Status changed to merged

  • Please register or sign in to reply
    Loading