Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/Harnesses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
dotnet build -c Release Sources/Tests/Harnesses/PropCheck
dotnet build -c Release Sources/Tests/Harnesses/SimpSweep
dotnet build -c Release Sources/Tests/Harnesses/RuleCheck
dotnet build -c Release Sources/Tests/Harnesses/CanonCheck
dotnet build -c Release Sources/Tests/Harnesses/Confluence

# One step each, every one run whatever the one before did, so a red run names the harness.
- name: BoundCheck
Expand All @@ -70,6 +72,15 @@ jobs:
if: success() || failure()
run: dotnet Sources/Tests/Harnesses/RuleCheck/bin/Release/net10.0/rulecheck.dll

# These two report findings by design and fail when their committed list of them changes.
- name: CanonCheck
if: success() || failure()
run: dotnet Sources/Tests/Harnesses/CanonCheck/bin/Release/net10.0/canoncheck.dll

- name: Confluence
if: success() || failure()
run: dotnet Sources/Tests/Harnesses/Confluence/bin/Release/net10.0/confluence.dll

- name: Reports
if: always()
uses: actions/upload-artifact@v6
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ from. A change of *form* is therefore not a failure and only a change of *value*
lets the corpus stay useful while printed output moves.

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

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

So the release checklist is: the suite and the harnesses in `work/` green, a `BREAKING-CHANGES.md`
So the release checklist is: the suite and the harnesses in `Sources/Tests/Harnesses` green, a `BREAKING-CHANGES.md`
entry for every changed answer measured on real builds, **a performance column measured against the
previous one on the same machine**, a version number that does not contradict #746, **the
integration work of [#718](https://github.com/asc-community/AngouriMath/issues/718) properly done
Expand Down
7 changes: 4 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ nothing else is read:
[`Contributing/SimplificationContract.md`](Sources/AngouriMath/Docs/Contributing/SimplificationContract.md).
A rule states the assumptions under which it holds, or it is asserting there are none.

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,10 @@ private static class PolynomialFactorizationHolder
/// </para>
/// <para>
/// Measured over 834 generated expressions and 2738 ordered pairs by
/// <c>work/canoncheck</c>: <b>idempotent, and independent of the order the operands
/// were written in</b>, where ordering without the leading normalisation fails 21 of
/// the first and <see cref="InnerSimplification"/> alone fails 2024 of the second.
/// <c>Sources/Tests/Harnesses/CanonCheck</c>: <b>idempotent, and independent of the order
/// the operands were written in</b>, where ordering without the leading normalisation
/// fails 18 of the first and <see cref="InnerSimplification"/> alone fails 2024 of the
/// second. Its <c>canoncheck-baseline.tsv</c> lists every one.
/// </para>
/// <para>
/// <b>What it is not.</b> It is not a canonical form for the language — no such thing
Expand Down
21 changes: 13 additions & 8 deletions Sources/AngouriMath/Docs/Contributing/CanonicalForm.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[#746](https://github.com/asc-community/AngouriMath/issues/746) tier 1 asks for two things this
file is: a written specification of what canonical means for each node class, and **a stated
distinction between canonical and "simplest"**. Its item 65 says to take a position, write it down,
and let the engine be checked against it. The checking is `work/canoncheck`, and every number below
and let the engine be checked against it. The checking is `Sources/Tests/Harnesses/CanonCheck`, and every number below
came out of it rather than out of an argument.

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

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

## 7. How this is checked

`work/canoncheck`. It builds expressions by growing a small grammar, then checks idempotence and
order independence generatively and a listed set of agreements by hand. It runs all three over each
of the three candidate forms — `InnerSimplified`, `CanonicalOrderExact` followed by
`InnerSimplified`, and `Simplify` — because the interesting facts are the differences between the
columns rather than any one number. The listed pairs are each a claim this file makes or disclaims,
so a disagreement there is a decision to take rather than necessarily a defect.
`Sources/Tests/Harnesses/CanonCheck`. It builds expressions by growing a small grammar, then
checks idempotence and order independence generatively and a listed set of agreements by hand. It
runs all three over each candidate form, because the interesting facts are the differences between
the columns rather than any one number. The candidates are `InnerSimplified`, `CanonicalOrderExact`
followed by `InnerSimplified`, the same sort after the normalisation, and `Simplify`. The listed
pairs are each a claim this file makes or disclaims, so a disagreement there is a decision to take
rather than necessarily a defect.

CI runs it on every change to the library. Its findings are listed in `canoncheck-baseline.tsv`
beside it, and the run fails when that list changes, so a change to what is canonical is recorded
in the commit that makes it.

It compares entities. Nothing in it reads a printed form, which is deliberate: the associativity
finding in §3 is invisible to a string comparison and is the single most likely thing to be got
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ when TreeAnalyzer.TryPerfectPower(literal, out var root, out var exponent)
// below is guarded for: the principal argument does not negate with its logarithm.
// At b = -0.63, ln(1/b) is 0.462 + pi*i and -ln(b) is 0.462 - pi*i. These three were
// applied unconditionally while their neighbours ten lines down carried a guard, and
// `work/rulecheck` reports them once its corpus is wide enough to build the shape.
// `Sources/Tests/Harnesses/RuleCheck` reports them once its corpus is wide enough to build the shape.
//
// The condition is the same one, and is asked through the same helper: ln(1/b) is
// ln(1) - ln(b), so a reciprocal is the difference case with a numerator of 1. Both
Expand Down
28 changes: 28 additions & 0 deletions Sources/Tests/Harnesses/CanonCheck/CanonCheck.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<!--
Is there a canonical form: idempotence, order independence over commutative operators, and
agreement between writings, for InnerSimplified and Simplify alike.
A harness, not a test project: it is run by .github/workflows/Harnesses.yml and by hand,
and `dotnet test` does not pick it up. See ../README.md.
-->

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>disable</Nullable>
<LangVersion>preview</LangVersion>
<AssemblyName>canoncheck</AssemblyName>
<RootNamespace>CanonCheck</RootNamespace>
<InvariantGlobalization>true</InvariantGlobalization>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<Compile Include="../Shared/*.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../../AngouriMath/AngouriMath.csproj" />
</ItemGroup>
</Project>
Loading
Loading