Skip to content

fix(corpus): run conformance programs, and correct a second false assertion - #97

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/corpus-eval-and-false-claims
Jul 29, 2026
Merged

fix(corpus): run conformance programs, and correct a second false assertion#97
hyperpolymath merged 1 commit into
mainfrom
fix/corpus-eval-and-false-claims

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

The false assertion corrected in #95 was not an isolated slip. Auditing whether the conformance corpus actually runs — the gate only ever checked that it parsed — turned up a second mathematically false claim of exactly the same kind, plus one genuine unimplemented feature.

The second false assertion

conformance/valid/v16_close_mirror_reverse.tangle:

assert reverse(braid[s1, s2]) == braid[s2, s1]

reverse reverses the word and negates every exponent — it yields the inverse braid, so reverse(s1 s2) = s2⁻¹ s1⁻¹.

Disproved by invariant: writhe(reverse(braid[s1,s2])) = -2 while writhe(braid[s2,s1]) = +2, and writhe is invariant under the braid relations, so they cannot be the same element.

Two authors, same mistake → a documentation failure

examples/trefoil.tangle and this file made the identical wrong assumption. That is not carelessness. FORMAL-SEMANTICS.md described the operation as:

|  reverse(e)     -- reverse word

which reads as order-only. Now stated as an identity:

reverse(g₁ g₂ … gₙ)  =  gₙ⁻¹ … g₂⁻¹ g₁⁻¹        i.e.  reverse(w) = w⁻¹

with the contrast against mirror (which negates in place) spelled out, and the writhe argument recorded so the next reader can check it rather than trust it.

The systemic fix

scripts/check-corpus.sh now evaluates conformance/valid, not just parses it. Parsing was never enough — a program can parse perfectly and assert something false. Both bad assertions survived precisely because nothing ran them.

Verified in both directions: reintroducing the exact false assertion makes the gate fail (exit 1, "parses but does not evaluate"); restoring it returns exit 0.

The genuine gap

v09_twist.tangle uses (~a) to twist a named strand inside a weave. spec/grammar.ebnf says "In weave context: (~a) twists named strand a", but infer_expr rejects any strand name used as an expression — specified and unimplemented. Recorded in the new CONFORMANCE_KNOWN_UNRUNNABLE list rather than papered over, and raised as #96.

Worth noting why it was invisible: until #93 a weave block could not be bound to anything, so its body was never evaluated. The construct has literally never run.

Regression tests

Four pinning reverse, chosen so they cannot pass vacuously:

Test Why it can't be faked
reverse is not order-reversal asserts inequality with the wrong answer
reverse(reverse(w)) = w only holds if it genuinely inverts
reverse negates writhe the invariant that disproved both false claims
mirror negates in place pins the contrast that caused the confusion

Suites 112 → 116, all green; TG-3 still 1008/0.

🤖 Generated with Claude Code

…ertion

The trefoil assertion corrected in #95 was not an isolated slip. Auditing
whether the conformance corpus actually RUNS — the gate only ever checked that
it PARSED — turned up a second mathematically false claim of exactly the same
kind, plus one genuine unimplemented feature.

## The second false assertion

conformance/valid/v16_close_mirror_reverse.tangle asserted

    assert reverse(braid[s1, s2]) == braid[s2, s1]

`reverse` reverses the word AND negates every exponent — it yields the INVERSE
braid, so reverse(s1 s2) = s2^-1 s1^-1. Disproved by invariant:
writhe(reverse(braid[s1,s2])) = -2 while writhe(braid[s2,s1]) = +2, and writhe
is invariant under the braid relations. Corrected.

Two independent authors made the identical mistake, which is a documentation
failure, not carelessness: FORMAL-SEMANTICS.md described the operation as
"reverse word", which reads as order-only. Now stated as an identity —
reverse(w) = w^-1, i.e. reverse(g1 … gn) = gn^-1 … g1^-1 — with the contrast
against `mirror` (which negates IN PLACE) spelled out, and with the writhe
argument recorded so the next reader can check it themselves.

## The systemic fix

`scripts/check-corpus.sh` now EVALUATES conformance/valid, not just parses it.
Parsing was never enough: a program can parse perfectly and assert something
false. Both bad assertions survived precisely because nothing ran them.

Verified by reintroducing the exact false assertion — the gate catches it
(exit 1, "parses but does not evaluate") — and by restoring it (exit 0).

## The genuine gap

conformance/valid/v09_twist.tangle uses `(~a)` to twist a named strand inside
a weave. spec/grammar.ebnf says "In weave context: (~a) twists named strand
a", but infer_expr rejects any strand name used as an expression, so the
construct is specified and unimplemented. Recorded in the new
CONFORMANCE_KNOWN_UNRUNNABLE manifest list rather than papered over, and
raised as its own issue.

## Regression tests

Four pinning `reverse`'s semantics, chosen so they cannot pass vacuously:
that it is NOT order-reversal, that applying it twice is the identity (only
true if it really inverts), that it negates writhe, and the contrast with
`mirror`. Suites 112 -> 116; all green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gitar-bot

gitar-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

Note

Automatic reviews are paused because your trial's included automatic processing has been used for this period. Upgrade now, or comment "Gitar review" to run a review anytime.
Learn more

Code Review ✅ Approved

Updates the corpus check script to evaluate conformance programs rather than just parsing them, and corrects a false reverse-braid assertion alongside documentation and regression tests. No issues found.

Auto-approved and auto-merge armed: No blocking issues found.
Please see Auto-approve Docs for details on setting custom approval criteria. — merges when pipeline and required approvals pass.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@gitar-bot

gitar-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

⚠️ Gitar auto-approved this PR but could not enable auto-merge: auto-merge is disabled for this repository — enable "Allow auto-merge" in the repository settings.

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gitar has auto-approved this PR and enabled auto-merge (configure)

@gitar-bot gitar-bot Bot added the gitar-approved Added by Gitar label Jul 29, 2026
@hyperpolymath
hyperpolymath merged commit 1403f2a into main Jul 29, 2026
25 checks passed
@hyperpolymath
hyperpolymath deleted the fix/corpus-eval-and-false-claims branch July 29, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gitar-approved Added by Gitar

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant