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
13 changes: 13 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,19 @@ and `13` is not, every `n` from `24` is `4 a + 9 b` and `23` is not
| `exists a in ZZ* : exists b in ZZ* : 13 = 3 a + 8 b` | `UnhandledParseException` (left as written when quantifiers arrived) | `False` |
| `forall n in ZZ : n >= 14 implies (exists a in ZZ* : exists b in ZZ* : n = 3 a + 8 b)` | `UnhandledParseException` (left as written when quantifiers arrived) | `True` |

### The modulus of a whole number is a whole number

With the facts in scope making `s` a whole number, `|s| in ZZ` and `|s| in ZZ*` are `True`, and
`|s| in ZZ+` is `not s = 0`, which the quantifiers then decide. So Sullivan and Mackey's Ex 7.2.6,
where `f(z) = |2 z + 1|` is a function from `ZZ` to their `N`, is `True`, since `2 z + 1 = 0` has no
whole root, while `|z|` fails at `0` and `|z^2 - 4|` at `2`
([#1409](https://github.com/asc-community/AngouriMath/issues/1409)).

| Input | Was (2.5.0) | Now |
|---|---|---|
| `forall z in ZZ : abs(2 z + 1) in ZZ+` | `UnhandledParseException` (left as written when quantifiers arrived) | `True` |
| `forall z in ZZ : abs(z - 3) in ZZ*` | `UnhandledParseException` (left as written when quantifiers arrived) | `True` |

### An antiderivative built through an even root says where the root is real

The linear-radical substitution, `u = (a x + b)^(1/q)`, and the general substitution for an even
Expand Down
14 changes: 13 additions & 1 deletion Sources/AngouriMath/Functions/Boolean/QuantifierFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ internal static bool PrimeDividesItsBinomial(Entity p, Entity k)
/// <summary>
/// <c>s in S</c> for a set of whole numbers, as the comparison it is where the facts in scope
/// make <c>s</c> a whole number: <c>s &gt;= 0</c> in <c>ZZ*</c>, <c>s &gt;= 1</c> in <c>ZZ+</c>, and
/// <c>True</c> in <c>ZZ</c>. <see langword="null"/> otherwise. Sullivan and Mackey's Prob
/// <c>True</c> in <c>ZZ</c>; and <c>|s|</c> as <c>not s = 0</c> in <c>ZZ+</c> and <c>True</c> in the
/// other two. <see langword="null"/> otherwise. Sullivan and Mackey's Prob
/// 4.11.6 asks for a <c>z</c> in <c>ZZ*</c> with <c>x - y = z</c> or <c>y - x = z</c>, for whole
/// <c>x</c> and <c>y</c>: the witnesses are <c>x - y</c> and <c>y - x</c>, one of which is
/// not negative.
Expand All @@ -277,6 +278,17 @@ internal static bool PrimeDividesItsBinomial(Entity p, Entity k)
SpecialSet.PositiveIntegers => element >= Integer.One,
_ => null,
};
// The modulus of a whole quantity is whole and not negative, and positive where the
// quantity is not zero: |2 z + 1| is in ZZ+ for every whole z, since 2 z + 1 = 0 has
// no whole root. Sullivan and Mackey's Ex 7.2.6, where f(z) = |2 z + 1| is a function
// from ZZ to their N. https://github.com/asc-community/AngouriMath/issues/1409
if (element is Absf(var quantity) && IsWholePolynomial(quantity))
return set switch
{
SpecialSet.Integers or SpecialSet.NonNegativeIntegers => Entity.Boolean.True,
SpecialSet.PositiveIntegers => !quantity.Equalizes(Integer.Zero),
_ => null,
};
// A whole quantity over a whole number m is whole where m divides it, and then has
// the sign of the quantity: (13 - 3 a)/8 in ZZ* is 8 divides 13 - 3 a and
// 13 - 3 a >= 0. That is what an equation 13 = 3 a + 8 b leaves of b, so the
Expand Down
8 changes: 8 additions & 0 deletions Sources/Tests/UnitTests/Core/QuantifierTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ public void DecidedOverAFiniteSet(string statement, string expected)
[InlineData("forall x in ZZ : forall y in ZZ : exists z in ZZ* : x - y = z or y - x = z", "True")]
[InlineData("forall x in ZZ : forall y in ZZ : exists z in ZZ+ : x - y = z or y - x = z", "False")]
[InlineData("forall x in RR : forall y in RR : exists z in ZZ* : x - y = z or y - x = z", "False")]
// Ex 7.2.6: f(z) = |2 z + 1| is a function from ZZ to Sullivan and Mackey's N, which is
// ZZ+, since the modulus of a whole number is one, and 2 z + 1 = 0 has no whole root.
// |z| is not, at 0, nor |z^2 - 4|, at 2.
[InlineData("forall z in ZZ : abs(2 z + 1) in ZZ+", "True")]
[InlineData("forall z in ZZ : abs(z) in ZZ+", "False")]
[InlineData("forall z in ZZ : abs(z^2 - 4) in ZZ+", "False")]
[InlineData("forall z in ZZ : abs(z - 3) in ZZ*", "True")]
[InlineData("forall n in ZZ+ : abs(n) in ZZ+", "True")]
// Prob 4.11.5: a square is not the greatest square, for y = x^2 + 1 is past every x, and
// a term in x is a witness for every x at once. Where none of the terms tried works, a
// single member may still decide it: x = 0 is below every square.
Expand Down
Loading