Skip to content

Standardize function naming: rename asserting to Asserting#48

Merged
jcp19 merged 3 commits into
mainfrom
claude/gobra-predicate-syntax-vudube
Jul 5, 2026
Merged

Standardize function naming: rename asserting to Asserting#48
jcp19 merged 3 commits into
mainfrom
claude/gobra-predicate-syntax-vudube

Conversation

@jcp19

@jcp19 jcp19 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR standardizes the naming convention for the assertion helper function across the codebase by renaming asserting to Asserting (PascalCase). This aligns with Go naming conventions where exported functions use PascalCase.

Key Changes

  • Renamed asserting function to Asserting in all files where it is defined:

    • evaluation/experiments/program_proofs_example_10_2/full/full.gobra
    • evaluation/experiments/program_proofs_example_10_2/last_half/last_half.gobra
    • evaluation/experiments/program_proofs_example_10_2/first_half/first_half.gobra
    • evaluation/experiments/program_proofs_example_10_2/minimal/minimal.gobra
  • Updated all call sites to use Asserting instead of asserting:

    • resalgebra/product.gobra (40+ occurrences)
    • resalgebra/loc.gobra (8 occurrences)
    • resalgebra/ra.gobra (7 occurrences)
    • resalgebra/oneshot_test.gobra (updated template syntax from !<...!> to {...})

Implementation Details

The function signature remains unchanged:

pure func Asserting(b bool) Unit

This is a pure verification helper that requires its boolean argument to be true and returns a Unit value. The rename improves consistency with Go naming conventions and makes the codebase more idiomatic.

https://claude.ai/code/session_01KscwsNqoA4o7nkNjcLbGCB

claude added 3 commits July 4, 2026 17:10
Two changes in Gobra broke this library:

- viperproject/gobra#1024 replaced the predicate-constructor
  delimiters !<...!> with {...}. Update the oneshotInv constructor
  uses in resalgebra/oneshot_test.gobra accordingly.

- viperproject/gobra#1036 lifted `asserting` expressions from Viper,
  making `asserting` a reserved keyword. Rename the user-defined
  `asserting` helper functions (and their call sites) to `Asserting`
  in resalgebra and in the program_proofs_example_10_2 evaluation
  experiments, matching the naming already used in util and
  refinementguard.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KscwsNqoA4o7nkNjcLbGCB
Gobra now supports `asserting <cond> in <expr>` natively
(viperproject/gobra#1036), so replace calls to the Asserting helper
functions with asserting expressions and drop the definitions that are
no longer used (refinementguard, resalgebra, and the
program_proofs_example_10_2 experiments). This adopts the rewrites from
PR #47.

The one exception (which made PR #47's CI fail with termination errors
at dicts.gobra:117) is the fact established inside dicts' `Remove`:
`Union`'s termination proof needs `ys intersection domain(d) == ys` to
be available when Remove's body is inlined at the recursive call sites,
which works with the `util.Asserting` call but not with an `asserting`
expression. Keep `util.Asserting` there (and in the two evaluation
copies of dicts), and hence keep its definition in both util packages.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KscwsNqoA4o7nkNjcLbGCB
Per review feedback: when the asserted fact is the entire returned
expression, `return Asserting(cond)` is cleaner than
`return asserting cond in Unit{}`, since Asserting already returns
Unit{}. Revert the tail-position rewrites accordingly (sets, seqs,
dicts, resalgebra, the standard_library evaluation copies, and the
full/last_half experiments), restoring the Asserting definitions in
resalgebra and those two experiment files. Mid-chain uses keep the
native `asserting ... in` expression.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KscwsNqoA4o7nkNjcLbGCB
@jcp19
jcp19 marked this pull request as ready for review July 5, 2026 10:49
@jcp19
jcp19 merged commit cab4eb7 into main Jul 5, 2026
1 check passed
@jcp19
jcp19 deleted the claude/gobra-predicate-syntax-vudube branch July 5, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants