Skip to content

A set Settings.Budget caps lids and arguments, and replaces allowances - #2475

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/budget-by-role
Nov 16, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/budget-by-role

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

The semantics decided on #2454: a set MathS.Settings.Budget acts by the role of each site that reads it. BudgetLedger.For(where, ownDefault, BudgetRole) now requires the role, and every site states it in a comment.

site own default role a set budget
EquationSolver.SolveSystem 10,000 steps, 60 s Allowance replaces it, as before
Gröbner (Buchberger) 5 s Allowance replaces it, as before
Saturation.ProvesEqual, the perfect-square proof 2,000 steps, 50 ms Lid the smaller on each axis: it can only tighten
EqualitySaturation, CanonicalizationOverGraph, MathS.AreEqual the budget argument Argument caps it on each axis
  • Lid: a set budget can no longer lift the perfect-square proof's limit, so Unlimited never makes Simplify or Factorize run longer. The minimum is taken on both axes, not on time alone: steps not being comparable between algorithms matters only when one's ceiling would be raised by a number chosen for another, and a lid is never raised, while taking only the clock would ignore a caller who set the reproducible axis exactly where they asked for less. Over the whole unit suite the proof completes in 15 to 1,203 steps (median 212); one stopped early is "not proved" and falls back to the symbolic test, so a tight budget costs time, not answers.
  • Allowance: unchanged, so the solver's own message "Raise MathS.Settings.Budget to allow more" stays true.
  • Argument: an explicit budget is no longer replaced by an ambient one; the ambient one caps it. AreEqual(a, b, budget) inside a scope set to Unlimited used to run unlimited.
  • The MathS.Settings.Budget doc describes the three, and says that { Steps = 1_000_000 } also removes the solver's 60 s, since a WorkBudget cannot say "no opinion" on one axis: that is v3 (Goal: Math OS — a ten-year vision for AngouriMath as an open mathematical reasoning platform #746, budgets as values).

Answers move only under a user-set budget. Measured against the 2.7.0 package, with { Steps = 5, Time = 30 s } inside a scope set to Unlimited, and recorded in BREAKING-CHANGES.md:

call was (2.7.0) now
EqualitySaturation(budget).ApplyOrKeep("x * 2 * 3 + x") x * 7 unchanged input
EqualitySaturation(budget).ApplyOrKeep("2 * sqrt(2) * sqrt(3)") 2 * sqrt(6) unchanged input
CanonicalizationOverGraph(budget).ApplyOrKeep("a * b + b * a") 2 * a * b a * b + a * b
CanonicalizationOverGraph(budget).ApplyOrKeep("x + 0 + 2 * x") 3 * x 2 * x + x

Factorize and Simplify give 2.7.0's answers under no budget, Unlimited, { Steps = 1 } and { Steps = 1_000_000 } on the perfect-square shapes checked.

BudgetRoleTest: 11 tests; with the old replace-always rule restored, 5 of the first 9 fail. Full check before the rebase onto 73b77bf (clean): 20,130 unit tests, 0 failed; MCP 444, Terminal 69, F# 134, Interactive 19; AOT OK; BoundCheck 0 disagreements, RootCheck 596/596, CasBench 120/121 with 0 wrong, SimpSweep 10463/10463, RuleCheck clean, CanonCheck and Confluence at their baselines. After the rebase: budget, system, saturation, factorisation, equality and API tests, 1,253 passed.

Closes #2454.

🤖 Generated with Claude Code

Each BudgetLedger.For call site now declares a BudgetRole, and a set
MathS.Settings.Budget does to it what that role calls for:

- Allowance (SolveSystem's 10,000 steps / 60 s, Gröbner's 5 s): replaced,
  as before, so "raise MathS.Settings.Budget to allow more" stays true.
- Lid (the perfect-square proof's 2,000 steps / 50 ms): the smaller limit
  on each axis, so a set budget, Unlimited included, never lifts it.
- Argument (EqualitySaturation, CanonicalizationOverGraph, AreEqual):
  the argument is the allowance and the set budget caps it, so an
  explicit budget inside an Unlimited scope is spent as passed.

The lid is tightened on both axes rather than the clock alone: a lid is
never raised, so the incomparability of steps between algorithms does
not bite, and a caller who set steps is not ignored. The proof completes
in 15 to 1,203 steps over the unit suite (median 212) and a stopped
proof falls back to the symbolic test; Factorize and Simplify answers
were measured unchanged under unset, Unlimited, {Steps = 1} and
{Steps = 1_000_000}.

What moves: EqualitySaturation and CanonicalizationOverGraph with an
explicit budget inside a scope set to Unlimited, measured against the
2.7.0 package; BREAKING-CHANGES.md has the rows. The four test-only
ledgers pass their own budget, so they are Argument.

Part of #2454

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.96%. Comparing base (73b77bf) to head (7cc1479).

Files with missing lines Patch % Lines
Sources/AngouriMath/Core/Budgets/BudgetLedger.cs 81.25% 1 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2475      +/-   ##
==========================================
- Coverage   86.97%   86.96%   -0.01%     
==========================================
  Files         324      324              
  Lines       71849    71864      +15     
  Branches    20955    20957       +2     
==========================================
+ Hits        62492    62498       +6     
- Misses       5024     5031       +7     
- Partials     4333     4335       +2     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.49% <86.36%> (-0.02%) ⬇️
fsharp 32.97% <ø> (ø)
interactive 39.81% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
Sources/AngouriMath/Convenience/MathS.Equality.cs 100.00% <ø> (ø)
Sources/AngouriMath/Convenience/MathS.cs 90.77% <ø> (ø)
Sources/AngouriMath/Core/Budgets/WorkBudget.cs 100.00% <ø> (ø)
...AngouriMath/Core/Transformations/EqualityOracle.cs 92.15% <100.00%> (ø)
...ces/AngouriMath/Core/Transformations/Saturation.cs 93.54% <100.00%> (ø)
...h/Core/Transformations/Transformation.Catalogue.cs 88.67% <100.00%> (ø)
...gouriMath/Functions/Algebra/Groebner/Buchberger.cs 90.27% <100.00%> (ø)
...ath/Functions/Continuous/Solvers/EquationSolver.cs 86.85% <100.00%> (ø)
...implification/Patterns/Patterns.ExpandFactorize.cs 93.60% <ø> (ø)
Sources/AngouriMath/Core/Budgets/BudgetLedger.cs 88.09% <81.25%> (+10.31%) ⬆️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit 1a80be1 into master Nov 16, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 16, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/budget-by-role branch November 16, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

A set Settings.Budget replaces internal lids rather than capping them

1 participant