Skip to content

feat(types): native type-system decoration layer#26

Merged
hyperpolymath merged 2 commits intomainfrom
claude/echidna-type-system-Zan8V
Apr 20, 2026
Merged

feat(types): native type-system decoration layer#26
hyperpolymath merged 2 commits intomainfrom
claude/echidna-type-system-Zan8V

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

  • Add Term::Sigma (dependent pairs) to core IR, closing a genuine gap — Pi was representable but Sigma was not
  • Introduce src/rust/types/mod.rs with TypeInfo sidecar decoration spanning 8 dimensions: Universe (level/cumulativity/impredicativity/HoTT), Multiplicity (QTT 0/1/ω/linear/affine/graded), EffectRow (row-polymorphic algebraic effects), refinement predicates, Modality (alethic/epistemic/doxastic/deontic/provability), TemporalOp (LTL/CTL/μ-calculus), Semiring (Boolean/tropical/Viterbi/Łukasiewicz), and relational arity (dyadic/n-ary)
  • Wire backend consumers: Idris2 emits QTT annotations from multiplicity, F* emits effect prefixes + refinement syntax, Dedukti renders/parses Sigma as dk_sigma
  • Extend GNN with HasMultiplicity/HasEffect/HasModality edge kinds and type-info-aware graph construction
  • Fix pre-existing z3 build break (create outcome.rs module, extract orphan check method)
  • Sigma rendering wired through all 8 backends that render Pi (Lean, Agda, Idris2, HOL4, HOL Light, Mizar, PVS, ACL2)

Test plan

  • 587 lib tests pass (up from 585 on main), 0 failures
  • 0 clippy warnings
  • cargo check --lib passes cleanly (also fixes pre-existing z3 build break)
  • TypeInfo JSON roundtrip tests (including backwards-compat with prior-format Hypothesis JSON)
  • Sigma term rendering + serde roundtrip test
  • Dedukti Sigma encode/decode tests

https://claude.ai/code/session_01FYkVX52Tdn6Arp9dWfPLxq

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Step 3 of the native type-system plan: wire backends to consume TypeInfo
decorations, extend GNN graph awareness, and fix a pre-existing build
break.

Changes:

1. Fix pre-existing z3 build break:
   - Create `src/rust/provers/outcome.rs` with `ProverOutcome` enum
     (8 variants: Proved, InconsistentPremises, NoProofFound,
     UnsupportedFeature, InvalidInput, Timeout, ProverError, SystemError)
   - Move orphan `check` method from `impl ProverBackend for Z3Backend`
     to its own `impl Z3Backend` block — it was not a trait member
   - Result: `cargo check --lib` now passes cleanly (0 errors, 0 warnings)

2. Idris2 QTT multiplicity wiring:
   - `export()` now reads `Definition.type_info.multiplicity` and emits
     QTT annotations (`0 `, `1 `, or unrestricted) on type signatures
   - Added `multiplicity_to_idris2()` helper mapping all Multiplicity
     variants to Idris2 QTT syntax
   - Removed duplicate local Multiplicity enum (now uses crate::types)

3. F* effect + refinement wiring:
   - `to_input_format()` now reads `Definition.type_info.effects` and
     emits F* effect prefixes (Tot, IO, ST, Exn, Div, GTot, ALL, Custom)
   - Reads `type_info.refinement` and emits `{v:T | P}` syntax
   - Added `effect_to_fstar()` helper

4. Dedukti exchange layer Sigma support:
   - `term_to_dedukti()` renders `Term::Sigma` as `dk_sigma A (x => B)`
   - `parse_dedukti_term()` parses `dk_sigma` back to `Term::Sigma`

5. GNN graph type-info awareness:
   - Added `EdgeKind::HasMultiplicity`, `HasEffect`, `HasModality`
   - `add_type_info_edges()` creates annotation nodes and edges from
     hypothesis/definition type_info decorations
   - Embeddings: added "sigma" label detection in feature extraction,
     updated quantifier feature to include sigma binders

Test results: 587 passed, 0 failed, 0 clippy warnings.

https://claude.ai/code/session_01FYkVX52Tdn6Arp9dWfPLxq
@hyperpolymath hyperpolymath enabled auto-merge April 20, 2026 10:10
Adds Term::Sigma (dependent pairs) to core IR and introduces a unified
TypeInfo sidecar decoration spanning 8 dimensions: Universe, Multiplicity,
EffectRow, refinement predicates, Modality, TemporalOp, Semiring, and
relational arity. Wires backend consumers (Idris2 QTT, F* effects/refinement,
Dedukti Sigma) and extends GNN with type-info-aware edge kinds.

Rebased onto latest main; all new type_info fields and Sigma arms re-applied
on top of upstream changes.

https://claude.ai/code/session_01FYkVX52Tdn6Arp9dWfPLxq
@hyperpolymath hyperpolymath force-pushed the claude/echidna-type-system-Zan8V branch from a3b6813 to f68110f Compare April 20, 2026 10:26
@hyperpolymath hyperpolymath merged commit f12fc15 into main Apr 20, 2026
18 of 41 checks passed
@hyperpolymath hyperpolymath deleted the claude/echidna-type-system-Zan8V branch April 20, 2026 10:27
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