Skip to content

Represent integer terms with arbitrary precision - #279

Draft
coord-e wants to merge 1 commit into
mainfrom
claude/vibrant-brown-tjmb6h-bigint
Draft

coord-e wants to merge 1 commit into
mainfrom
claude/vibrant-brown-tjmb6h-bigint

Conversation

@coord-e

@coord-e coord-e commented Sep 24, 2026

Copy link
Copy Markdown
Owner

chc::Term::Int stands for an SMT-LIB Int, and SMT-LIB numerals have no size limit. Both Z3 and PCSat accept literals such as 2^128. Term::Int itself, however, held an i64.

Changes

  • Term::Int, rty::EnumVariantDef::discr and chc::DatatypeCtor::discriminant now hold a num_bigint::BigInt, and Term::int accepts any impl Into<BigInt>.
  • The places that received u128/i128 values from rustc and narrowed them to i64 now pass the values through unchanged:
    • integer constants (const_value_ty)
    • SwitchInt targets
    • integer literals in formulas (annot_fn); this removes the expect("integer literal out of i64 range in formula")
    • enum discriminants (discr_value)
  • Term::pow2 is now a single literal, BigInt::from(1) << exp. It no longer builds 2^63 and above as a product of literals.

No new tests, as agreed.

Testing

cargo test fails on the same set of tests as main, and on nothing else. The 65 failures are all PCSat tests: the local coar:main image can't handle (Seq Int). cargo fmt --check and cargo clippy --all-targets are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MvvhC4sHsobSMHAn9CgLBq


Generated by Claude Code

chc::Term::Int stands for an SMT-LIB Int, whose numerals are unbounded,
but it held an i64. Rust integer constants, SwitchInt targets, formula
literals and enum discriminants arrive as u128/i128 and were narrowed with
try_into().unwrap(), panicking beyond the i64 range, and Term::pow2 had to
build 2^63 and above as a product of literals.

Term::Int, rty::EnumVariantDef::discr and chc::DatatypeCtor::discriminant
now hold a num_bigint::BigInt, and Term::int accepts anything convertible
into one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MvvhC4sHsobSMHAn9CgLBq

This branch has not been deployed

No deployments
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