diff --git a/BREAKING-CHANGES.md b/BREAKING-CHANGES.md
index 3561192f7..2d4404736 100644
--- a/BREAKING-CHANGES.md
+++ b/BREAKING-CHANGES.md
@@ -839,6 +839,21 @@ written
| `"forall n in ZZ+ : n! >= 2^(n - 1)".ToEntity().Evaled` | `UnhandledParseException` | `True` |
| `"forall n in ZZ+ /\\ [4; +oo) : n^2 - 2 n - 1 > 0".ToEntity().Evaled` | `UnhandledParseException` | `True` — decided about `4 + t` over `ZZ*` |
+### An implication needs its conclusion's condition only where its assumption holds
+
+`a implies (b provided c)` was `(a implies b) provided c`, the condition lifted over the whole
+implication as it is over other nodes. But where `a` fails the implication holds whatever the
+conclusion is, so the condition is needed only where `a` holds: it is
+`(a implies b) provided (a implies c)`, and a condition among `a`'s conjuncts is no condition at
+all. `not x = 0 implies x/x = 1` was left undefined at `0`, where it holds
+([#1409](https://github.com/asc-community/AngouriMath/issues/1409), Sullivan and Mackey's Prob 1.5.6).
+
+| Input | Was (2.5.0) | Now |
+|---|---|---|
+| `"not x = 0 implies x / x = 1".ToEntity().Simplify()` | `True provided not x = 0` | `True` |
+| `"not x = 0 implies (y / y = 1)".ToEntity().Simplify()` | `True provided not y = 0` | `True provided not x = 0 implies not y = 0` |
+| `forall x in RR : not x = 0 implies x / x = 1` | `UnhandledParseException` (left as written when quantifiers arrived) | `True` |
+
### `acsch(c x)` and `asech(c x)` are integrated with a symbolic `c`, and `|c|` differentiates to `0` in `x`
Three defects behind one symptom: `x acsch(2 x)` was answered and `x acsch(c x)` declined. The
diff --git a/Sources/AngouriMath/Functions/Evaluation/Evaluation.Discrete/Evaluation.Discrete.Classes.cs b/Sources/AngouriMath/Functions/Evaluation/Evaluation.Discrete/Evaluation.Discrete.Classes.cs
index 542a8d0fd..9b1c3dbcc 100644
--- a/Sources/AngouriMath/Functions/Evaluation/Evaluation.Discrete/Evaluation.Discrete.Classes.cs
+++ b/Sources/AngouriMath/Functions/Evaluation/Evaluation.Discrete/Evaluation.Discrete.Classes.cs
@@ -213,7 +213,24 @@ partial record Impliesf
private protected override Entity IntrinsicCondition => True;
///
protected override Entity InnerSimplify(bool isExact)
- => ExpandOnTwoArguments(Assumption, Conclusion,
+ {
+ // A conclusion defined only under a condition needs it only where the assumption
+ // holds, since where the assumption fails the implication holds whatever the
+ // conclusion is: a implies (b provided c) is (a implies b) provided (a implies c),
+ // and a condition among the assumption's conjuncts is no condition. Lifted over the
+ // whole implication, as other nodes lift one, `not x = 0 implies x/x = 1` was
+ // `True provided not x = 0`, undefined at 0 where the implication holds.
+ // https://github.com/asc-community/AngouriMath/issues/1409
+ if (Conclusion.InnerSimplified(isExact) is Providedf(var claim, var condition))
+ {
+ var assumption = Assumption.InnerSimplified(isExact);
+ var established = Andf.LinearChildren(assumption);
+ var needed = Andf.LinearChildren(condition).Where(conjunct => !established.Contains(conjunct)).ToList();
+ var implication = new Impliesf(assumption, claim).InnerSimplified(isExact);
+ return needed.Count == 0 ? implication
+ : implication.Provided(assumption.Implies(needed.Aggregate((left, right) => left & right))).InnerSimplified(isExact);
+ }
+ return ExpandOnTwoArguments(Assumption, Conclusion,
(left, right) => MixesANumberWithATruthValue(left, right) ? null
: (left.Evaled, right.Evaled) switch
{
@@ -225,6 +242,7 @@ protected override Entity InnerSimplify(bool isExact)
_ => null
},
(@this, a, b) => ((Impliesf)@this).New(a, b), isExact, settlesNaN: true);
+ }
}
partial record Equalsf
diff --git a/Sources/Tests/UnitTests/Core/ProvidedImpliedByTheExpressionTest.cs b/Sources/Tests/UnitTests/Core/ProvidedImpliedByTheExpressionTest.cs
index f7d7c71fd..c2bf909ba 100644
--- a/Sources/Tests/UnitTests/Core/ProvidedImpliedByTheExpressionTest.cs
+++ b/Sources/Tests/UnitTests/Core/ProvidedImpliedByTheExpressionTest.cs
@@ -36,6 +36,19 @@ public sealed class ProvidedImpliedByTheExpressionTest
public void TheConditionTheExpressionStatesIsDropped(string input, string expected)
=> Assert.Equal(expected.ToEntity().Simplify(), input.ToEntity().Simplify());
+ ///
+ /// An implication needs its conclusion's condition only where its assumption holds, and
+ /// not at all where the assumption states it: not x = 0 implies x/x = 1 holds at
+ /// every x, 0 among them, where it was True provided not x = 0.
+ /// https://github.com/asc-community/AngouriMath/issues/1409
+ ///
+ [Theory]
+ [InlineData("not x = 0 implies x / x = 1", "True")]
+ [InlineData("x > 0 and not x = 0 implies x / x = 1", "True")]
+ [InlineData("not x = 0 implies (y / y = 1)", "(not x = 0 implies True) provided (not x = 0 implies not y = 0)")]
+ public void AnAssumptionDischargesTheConditionItStates(string input, string expected)
+ => Assert.Equal(expected.ToEntity().Simplify(), input.ToEntity().Simplify());
+
///
/// The derivatives the comparison page shows, which carried the condition twice.
///
diff --git a/Sources/Tests/UnitTests/Core/QuantifierTest.cs b/Sources/Tests/UnitTests/Core/QuantifierTest.cs
index 21a18dca7..154e955e2 100644
--- a/Sources/Tests/UnitTests/Core/QuantifierTest.cs
+++ b/Sources/Tests/UnitTests/Core/QuantifierTest.cs
@@ -118,6 +118,8 @@ public void DecidedOverAFiniteSet(string statement, string expected)
[InlineData("exists x in QQ : 2 x = 3", "True")]
[InlineData("forall x in ZZ : 2 divides x", "False")]
[InlineData("exists x in ZZ : 2 divides x", "True")]
+ // A condition the hypothesis states is no condition on the claim.
+ [InlineData("forall x in RR : not x = 0 implies x / x = 1", "True")]
// Uniqueness: two real roots, one positive whole one.
[InlineData("exists! x in RR : x^2 = 4", "False")]
[InlineData("exists! x in ZZ+ : x^2 = 4", "True")]