diff --git a/Sources/AngouriMath/Core/Transformations/RewriteRules.cs b/Sources/AngouriMath/Core/Transformations/RewriteRules.cs index 2396956b3..4f10610f4 100644 --- a/Sources/AngouriMath/Core/Transformations/RewriteRules.cs +++ b/Sources/AngouriMath/Core/Transformations/RewriteRules.cs @@ -117,12 +117,17 @@ public static class RewriteRules /// /// Gets a quotient into the shape the division rules expect before they run. /// + /// + /// Run by the matcher rather than by the switch — + /// . See the note on + /// for what that costs and what still describes it. + /// public static RewriteRuleSet DivisionPreparing { get; } = new( nameof(DivisionPreparing), "Lifts numeric factors out of a quotient so that the division rules can see it.", TransformationRelation.Equivalence, Soundness.SoundUnderAssumptions, - Patterns.DivisionPreparingRules, + Matching.MatchedRules.DivisionPreparing.ApplyHere, Patterns.DivisionPreparingRulesArms); /// @@ -204,12 +209,41 @@ public static class RewriteRules /// /// Brings a quotient of quotients down to a single one. /// + /// + /// + /// Run by the matcher rather than by the switch — + /// . This and + /// are the two sets whose data form is proven to agree + /// with the switch it mirrors over generated expressions + /// (MatchedRulesAgreeWithTheSwitchTest), which is the precondition for running one + /// instead of the other. + /// + /// + /// What it costs. Measured against Simplify itself, both arms in + /// one process with a third arm that is the switch again as a control: the data form + /// is −0.6% where the control differs from its own source by −1.1%, so the change is + /// smaller than this machine's disagreement with itself, and allocation is +0.04%. That + /// number used to be +5% for alone, and what closed it was + /// settling a pattern's determinism once rather than on every attempt + /// (#1050). + /// + /// + /// The switch is still what describes them. carries + /// a and a , + /// which RuleRegistryGenerator reads off the arms of a switch; it has no way + /// yet to read a rule written as data. So the addressable rules of these two sets still come + /// from Patterns, and the arms they describe are the ones the agreement test holds + /// the matcher to rather than dead code. Teaching the generator to read + /// is what would let the switch go, and is + /// #825. + /// + /// public static RewriteRuleSet CollapseMultipleFractions { get; } = new( nameof(CollapseMultipleFractions), "Collapses nested quotients into a single numerator over a single denominator.", TransformationRelation.Equivalence, Soundness.SoundUnderAssumptions, - Patterns.CollapseMultipleFractions, + Matching.MatchedRules.CollapseMultipleFractions.ApplyHere, Patterns.CollapseMultipleFractionsArms); ///