Skip to content

feat(Boole): nat/pos as first-class types with UF+axiom SMT encoding - #10

Merged
kondylidou merged 6 commits into
mainfrom
nat-binary-datatype
Sep 19, 2026
Merged

kondylidou merged 6 commits into
mainfrom
nat-binary-datatype

Conversation

@kondylidou

@kondylidou kondylidou commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Adds nat as a built-in Boole type. No imports or declarations required — every #strata program Boole; block has it in scope automatically.

The binary-nat algebraic datatype (pos with constructors xH/xO/xI, nat with N0/Npos) is emitted as SMT declare-datatypes with a recursive pos.toInt definition and bridge axioms (nat_nonneg, nat_fromInt_toInt, nat_toInt_fromInt). The library is injected automatically when coreProgUsesNatOrPos detects nat or pos anywhere in the program — procedure headers, spec clauses, ite conditions, loop invariants, quantifier bodies, or algebraic datatype constructor fields.

Nat operations (nat_toInt, nat_fromInt, nat_add, nat_sub, nat_mul, nat_div, nat_mod, nat_lt, nat_le, nat_gt, nat_ge) are available as surface-syntax operators in all Boole programs.

Counterexample support: when cvc5 returns a candidate model for a failing nat property, the natCandidatePhase validates and promotes it to ❌ fail. Binary pos/nat constructor terms in the model are decoded back to integers for display.

Depends on strata-org/Strata#1439 (bumped in this PR).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kondylidou
kondylidou requested a review from barrettcw September 2, 2026 09:42

@barrettcw barrettcw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kondylidou
kondylidou merged commit 5d91cee into main Sep 19, 2026
4 checks passed
@kondylidou
kondylidou deleted the nat-binary-datatype branch September 19, 2026 14:45
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