Repository navigation
Ground CanonicalOperation beyond OpAdd: arith+comparison+boolean operators by inhabitance from existing algebra (target_model.dag) - #5704
Merged
Conversation
…-enrolled in the CI floor) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e<T> mint, exhaustive (lens-green) equal Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 24, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Track-A operation-grounding (cargo-green keystone)
Grounds
CanonicalOperation(LOAD-BEARINGtarget_model.dag) beyondOpAddto the full arith + comparison + boolean operator set the self-hosted emitter needs, by inhabitance fromv2.std.algebra(§3/§4: no per-operator nicknames; each operator points at the algebra field that provides it).This restores the full verified scope of #5698 (which this supersedes) — same 3-file shape, same
Equivalence<T>mint, same 9 by-execution witnesses — and fixes thenon_fold_residuelens red that blocked #5698 (see "Lens" below).Model — 4 grounded variants
Grounding (every symbol already exists in
algebra.dag):+ *^ring_field_add/^ring_field_mul(AlgebraPrimitive)-^group_field_inverse(AlgebraPrimitive)&& || !^lattice_field_meet/^lattice_field_join/^boolean_algebra_field_complement-AlgebraInverseCompose(^ring_field_add, ^group_field_inverse)— subtraction as the additive-inverse composite, the binary form (not the partial unary field)/AlgebraInverseCompose(^ring_field_mul, ^field_field_reciprocal)< <= > >=^ordered_ring_field_compare+OrderingPredicate(whichOrderings count as true)== !=^equivalence_field_eq+EqualityPredicateEquivalence<T>is minted insrc/v2/std/algebra.dag({ eq: fn(T,T) -> Bool }, withequivalence_type_node/equivalence_node+bool_type_node). Equality grounds on its own algebra — not on ordered-ringcompare— soEqis not conflated with order (a type can have equality without order). This is the structurally-correct grounding the api-review flagged in the earlier 2-variant pass.AlgebraInverseComposelikewise grounds binary-//on two fields (the forward op + its inverse), so the algebra field names the binary operator, not the partial unary one.The downstream operator machinery was already generic (catalog keyed on
canonical_operation_equalover the decoded wire node; emit viaInfixToken/PrefixToken/CallIdent), so the type generalization lights up every operator with zero per-operator emit code — one DRY…_atom_field_from_wirereader, symbol-coded predicates, exhaustive encode/decode.Lens —
non_fold_residuegreen by construction (the #5698 fix)#5698 readded four
_ => falsewildcards over the now-closedCanonicalOperationcoproduct incanonical_operation_equal; thenon_fold_residueroster gate walls any new unrostered wildcard-over-closed-coproduct, so it red. Herecanonical_operation_equalenumerates all cross-variant arms explicitly (no_) — construction, not a wildcard the lens has to catch (§5). Verified:non_fold_residue_no_unrostered_or_stale→Bool(true)by execution.Witnesses — 9/9 green by execution (
…/target_operation_grounding_emit_typescript_test.dag)Auto-enrolled in the CI floor (
*_test.dagwithtest fns). End-to-end TypeScript emit through the catalog + projection, not just the model:x - y(sub),x < y(lt),x == y(eq);x + y(≠x - y); catalog miss rejects; wire round-trip for all 14 ops; wire discrimination (sub≠add,lt≠gt,le≠ge,eq≠ne);OrderingPredicate/EqualityPredicateaccept-set units (IsLessOrEqual → [Less, Equal],IsEqual → true, …).All 9 + the lens verified green locally against the live corpus.
Follow-on
Wiring surface-token →
CanonicalOperationingest (extdeps/languages/dag.dag) and the per-target realization-row catalogs (rust/ts) for- * / < … && ||is downstream (separate files/lane) and rides on these constructors.Supersedes #5698 (orphaned predecessor branch).
canonical_operation_op_add()keeps its name/meaning, so existingextdeps/languages/{typescript,dag}.dagcallers are untouched.🤖 Generated with Claude Code