Skip to content

Commit 71eefc9

Browse files
The canonical-form and arm-order checkers run in CI, gated on their findings (#1653)
* The canonical-form and arm-order checkers run in CI, gated on their findings CanonCheck and Confluence report findings by design. InnerSimplified is a normalisation and does not reorder operands, and three pairs of arms in Common and Power disagree where both fire. Neither can fail on a non-empty list. Each now commits its list of findings beside it, as corpus-baseline.tsv does, and fails when the list changes in either direction. HARNESS_UPDATE_BASELINE=1 rewrites the list. A finding whose case timed out counts as unmeasured, not gone, so a timeout still fails nothing. The lists hold 2091 lines for canoncheck and 3 for confluence. A canoncheck line names the stage, the property and the case, written out in full. A confluence line names the set and the two arms by their rule names, which survive an arm being inserted above them. AGENTS.md's two mentions of the harnesses in work/ now point here. Part of #1256. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura * References to the harnesses name where they are now Five comments and CanonicalForm.md pointed at work/canoncheck, work/rulecheck and work/simpsweep, which are Sources/Tests/Harnesses now. CanonicalForm.md's section 7 also listed three candidate forms where the harness measures four, and now says how CI gates it. The catalogue's count of idempotence failures for the sort alone is 18 on master, not 21, and the comment now points to the list that holds every one. BREAKING-CHANGES.md keeps its two mentions: they say where a change was found at the time. Part of #1256. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent cd3b27b commit 71eefc9

16 files changed

Lines changed: 2973 additions & 23 deletions

File tree

‎.github/workflows/Harnesses.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
dotnet build -c Release Sources/Tests/Harnesses/PropCheck
4646
dotnet build -c Release Sources/Tests/Harnesses/SimpSweep
4747
dotnet build -c Release Sources/Tests/Harnesses/RuleCheck
48+
dotnet build -c Release Sources/Tests/Harnesses/CanonCheck
49+
dotnet build -c Release Sources/Tests/Harnesses/Confluence
4850
4951
# One step each, every one run whatever the one before did, so a red run names the harness.
5052
- name: BoundCheck
@@ -70,6 +72,15 @@ jobs:
7072
if: success() || failure()
7173
run: dotnet Sources/Tests/Harnesses/RuleCheck/bin/Release/net10.0/rulecheck.dll
7274

75+
# These two report findings by design and fail when their committed list of them changes.
76+
- name: CanonCheck
77+
if: success() || failure()
78+
run: dotnet Sources/Tests/Harnesses/CanonCheck/bin/Release/net10.0/canoncheck.dll
79+
80+
- name: Confluence
81+
if: success() || failure()
82+
run: dotnet Sources/Tests/Harnesses/Confluence/bin/Release/net10.0/confluence.dll
83+
7384
- name: Reports
7485
if: always()
7586
uses: actions/upload-artifact@v6

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ from. A change of *form* is therefore not a failure and only a change of *value*
237237
lets the corpus stay useful while printed output moves.
238238

239239
**It is a gate and not a harness.** It is small and takes about a second, because everything in the
240-
suite is paid for on every commit. The harnesses in `work/` are where a measurement generates its own
240+
suite is paid for on every commit. The harnesses in `Sources/Tests/Harnesses` are where a measurement generates its own
241241
inputs, takes minutes, and gets read by a person; the two are not substitutes, and a finding from a
242242
harness that is worth keeping belongs in the corpus as a new problem.
243243

@@ -858,7 +858,7 @@ whatever else it delivered:
858858
3. **Correctness coverage grows with the surface.** Each new layer adds ways to be wrong that the one
859859
below could not express.
860860

861-
So the release checklist is: the suite and the harnesses in `work/` green, a `BREAKING-CHANGES.md`
861+
So the release checklist is: the suite and the harnesses in `Sources/Tests/Harnesses` green, a `BREAKING-CHANGES.md`
862862
entry for every changed answer measured on real builds, **a performance column measured against the
863863
previous one on the same machine**, a version number that does not contradict #746, **the
864864
integration work of [#718](https://github.com/asc-community/AngouriMath/issues/718) properly done

‎CLAUDE.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ nothing else is read:
1919
[`Contributing/SimplificationContract.md`](Sources/AngouriMath/Docs/Contributing/SimplificationContract.md).
2020
A rule states the assumptions under which it holds, or it is asserting there are none.
2121

22-
Seven measurement harnesses live in `Sources/Tests/Harnesses` and run in CI on every change to the
22+
Nine measurement harnesses live in `Sources/Tests/Harnesses` and run in CI on every change to the
2323
library: the boundary checker, root completeness, the self-verifying solver corpus, the property
24-
checker, the simplification sweep, the rule-set checker, and a crash harness that survives a stack
25-
overflow. Each fails on a defect; its README says which. The rest are still in the analysis workspace
24+
checker, the simplification sweep, the rule-set checker, a crash harness that survives a stack
25+
overflow, the canonical-form checker and the arm-order checker. Each fails on a defect, or the last
26+
two on a change to the findings they list; the README says which. The rest are still in the analysis workspace
2627
one directory up (`work/`), among them a checker for the documentation's code samples. Run them before claiming anything is
2728
fixed.
2829

‎Sources/AngouriMath/Core/Transformations/Transformation.Catalogue.cs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,10 @@ private static class PolynomialFactorizationHolder
301301
/// </para>
302302
/// <para>
303303
/// Measured over 834 generated expressions and 2738 ordered pairs by
304-
/// <c>work/canoncheck</c>: <b>idempotent, and independent of the order the operands
305-
/// were written in</b>, where ordering without the leading normalisation fails 21 of
306-
/// the first and <see cref="InnerSimplification"/> alone fails 2024 of the second.
304+
/// <c>Sources/Tests/Harnesses/CanonCheck</c>: <b>idempotent, and independent of the order
305+
/// the operands were written in</b>, where ordering without the leading normalisation
306+
/// fails 18 of the first and <see cref="InnerSimplification"/> alone fails 2024 of the
307+
/// second. Its <c>canoncheck-baseline.tsv</c> lists every one.
307308
/// </para>
308309
/// <para>
309310
/// <b>What it is not.</b> It is not a canonical form for the language — no such thing

‎Sources/AngouriMath/Docs/Contributing/CanonicalForm.md‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[#746](https://github.com/asc-community/AngouriMath/issues/746) tier 1 asks for two things this
44
file is: a written specification of what canonical means for each node class, and **a stated
55
distinction between canonical and "simplest"**. Its item 65 says to take a position, write it down,
6-
and let the engine be checked against it. The checking is `work/canoncheck`, and every number below
6+
and let the engine be checked against it. The checking is `Sources/Tests/Harnesses/CanonCheck`, and every number below
77
came out of it rather than out of an argument.
88

99
Read [SimplificationContract.md](SimplificationContract.md) first if you are changing a rewrite.
@@ -60,7 +60,7 @@ Three properties, each of which a canonical form must have and none of which nee
6060
- **order independence** — the operands of a commutative operator may be written either way round;
6161
- **agreement** — two writings of one expression reach the same form.
6262

63-
`work/canoncheck` measures all three against each candidate, comparing **entities and not printed
63+
`Sources/Tests/Harnesses/CanonCheck` measures all three against each candidate, comparing **entities and not printed
6464
strings**. The figures below are on `master` with the two defects of the following subsection fixed
6565
— [#929](https://github.com/asc-community/AngouriMath/issues/929) and
6666
[#930](https://github.com/asc-community/AngouriMath/issues/930), each landing separately. Without
@@ -269,12 +269,17 @@ The one thing it *is* required to be is sound, which is [SimplificationContract.
269269

270270
## 7. How this is checked
271271

272-
`work/canoncheck`. It builds expressions by growing a small grammar, then checks idempotence and
273-
order independence generatively and a listed set of agreements by hand. It runs all three over each
274-
of the three candidate forms — `InnerSimplified`, `CanonicalOrderExact` followed by
275-
`InnerSimplified`, and `Simplify` — because the interesting facts are the differences between the
276-
columns rather than any one number. The listed pairs are each a claim this file makes or disclaims,
277-
so a disagreement there is a decision to take rather than necessarily a defect.
272+
`Sources/Tests/Harnesses/CanonCheck`. It builds expressions by growing a small grammar, then
273+
checks idempotence and order independence generatively and a listed set of agreements by hand. It
274+
runs all three over each candidate form, because the interesting facts are the differences between
275+
the columns rather than any one number. The candidates are `InnerSimplified`, `CanonicalOrderExact`
276+
followed by `InnerSimplified`, the same sort after the normalisation, and `Simplify`. The listed
277+
pairs are each a claim this file makes or disclaims, so a disagreement there is a decision to take
278+
rather than necessarily a defect.
279+
280+
CI runs it on every change to the library. Its findings are listed in `canoncheck-baseline.tsv`
281+
beside it, and the run fails when that list changes, so a change to what is canonical is recorded
282+
in the commit that makes it.
278283

279284
It compares entities. Nothing in it reads a printed form, which is deliberate: the associativity
280285
finding in §3 is invisible to a string comparison and is the single most likely thing to be got

‎Sources/AngouriMath/Functions/Simplification/Patterns/Patterns.Power.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ when TreeAnalyzer.TryPerfectPower(literal, out var root, out var exponent)
250250
// below is guarded for: the principal argument does not negate with its logarithm.
251251
// At b = -0.63, ln(1/b) is 0.462 + pi*i and -ln(b) is 0.462 - pi*i. These three were
252252
// applied unconditionally while their neighbours ten lines down carried a guard, and
253-
// `work/rulecheck` reports them once its corpus is wide enough to build the shape.
253+
// `Sources/Tests/Harnesses/RuleCheck` reports them once its corpus is wide enough to build the shape.
254254
//
255255
// The condition is the same one, and is asked through the same helper: ln(1/b) is
256256
// ln(1) - ln(b), so a reciprocal is the difference case with a numerator of 1. Both
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<!--
4+
Is there a canonical form: idempotence, order independence over commutative operators, and
5+
agreement between writings, for InnerSimplified and Simplify alike.
6+
A harness, not a test project: it is run by .github/workflows/Harnesses.yml and by hand,
7+
and `dotnet test` does not pick it up. See ../README.md.
8+
-->
9+
10+
<PropertyGroup>
11+
<OutputType>Exe</OutputType>
12+
<TargetFramework>net10.0</TargetFramework>
13+
<Nullable>disable</Nullable>
14+
<LangVersion>preview</LangVersion>
15+
<AssemblyName>canoncheck</AssemblyName>
16+
<RootNamespace>CanonCheck</RootNamespace>
17+
<InvariantGlobalization>true</InvariantGlobalization>
18+
<IsPackable>false</IsPackable>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<Compile Include="../Shared/*.cs" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<ProjectReference Include="../../../AngouriMath/AngouriMath.csproj" />
27+
</ItemGroup>
28+
</Project>

0 commit comments

Comments
 (0)