Skip to content

pyspec: SpecExpr arithmetic/comparison/boolean vocabulary#1426

Open
julesmt wants to merge 3 commits into
reviewed-kbd-will-merge-to-mainfrom
julesmt/feature/specexpr-vocabulary
Open

pyspec: SpecExpr arithmetic/comparison/boolean vocabulary#1426
julesmt wants to merge 3 commits into
reviewed-kbd-will-merge-to-mainfrom
julesmt/feature/specexpr-vocabulary

Conversation

@julesmt

@julesmt julesmt commented Jun 27, 2026

Copy link
Copy Markdown
Member

Lets contracts use the operators a Python body can, each lowering to the same runtime prelude term the body emits (so a contract and a caller agree):

  • arithmetic: + - * // % **, unary -
  • comparison: == != < <= > >=
  • boolean: and / or / not
  • identity / membership: is / is not None, in / not in

julesmt added 3 commits June 26, 2026 19:56
…wering

Adds the SpecExpr constructors (arithmetic/comparison/boolean/unary/is-membership values incl. pow and neg) with full DDM serialization round-trip and Laurel lowering to the runtime prelude ops (PEq/PNEq/PLt..PGe, PAdd..PPow, PNeg), matching the body translator. No producers yet.
…or/not, unary -, is/in) to the SpecExpr vocabulary

transExpr/transCompare producers via a binArith helper; routes == to the normalized PEq term and is/is-not-None and in/not-in through the prelude P-ops, so a contract and a caller agree. Drops the now-obsolete 'unsupported comparison' warning expectation.
@julesmt
julesmt requested a review from a team as a code owner June 27, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant