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
7 changes: 7 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,12 @@ exists to stop, and it has happened: the first pass over
[#1409](https://github.com/asc-community/AngouriMath/issues/1409)'s book was a table of contents
turned into a feature list.

**And name it where you cite it.** A comment, a test summary or a changelog entry that says
"the reference's Ex 5.3.2" names nothing once a second reference exists, and there will be a
second one. Write the authors — *Sullivan and Mackey's Ex 5.3.2* — or the title, the way a paper
is cited, at every citation and not only the first, and put the work with its link in
[`Docs/References.md`](Sources/AngouriMath/Docs/References.md), which is the credits.

## Working practice

**A plan belongs in an issue, not in a comment.** When work splits into separable pieces — or when
Expand Down Expand Up @@ -641,6 +647,7 @@ are short, and a stale one is worse than none — if you change what a file desc
| [`Docs/Usage/Syntax.md`](Sources/AngouriMath/Docs/Usage/Syntax.md) | what the parser accepts. The grammar was the only statement of it until [#706](https://github.com/asc-community/AngouriMath/pull/706) |
| [`Docs/Usage/Exceptions.md`](Sources/AngouriMath/Docs/Usage/Exceptions.md) | the exception hierarchy under `AngouriMathBaseException` |
| [`Docs/Usage/Comparison.md`](Sources/AngouriMath/Docs/Usage/Comparison.md) | how we measure against Math.NET Symbolics, Symbolism and SymPy, with the versions and what each comparison does not establish |
| [`Docs/References.md`](Sources/AngouriMath/Docs/References.md) | the books, papers, corpora and reference works the code and its tests draw on, with the link and what each is used for. Add a work there when it is first cited |
| [`Docs/Contributing/`](Sources/AngouriMath/Docs/Contributing/README.md) | the index of the contributor docs |
| [`Contributing/General.md`](Sources/AngouriMath/Docs/Contributing/General.md) | the `Entity` hierarchy, in a paragraph |
| [`Contributing/AddingNode.cs`](Sources/AngouriMath/Docs/Contributing/AddingNode.cs) | every place a new node has to be taught about. Read it *before* adding one |
Expand Down
37 changes: 33 additions & 4 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ solved now — the members of a listed set each as an equation, an interval as i
strict or not as the end is — and a statement that is not read is the set of `x` with the
property, left as written. A quantifier that put the negated body to the solver read that
emptiness as a proof: `forall x in RR : x^2 in ZZ` was `True`
([#1409](https://github.com/asc-community/AngouriMath/issues/1409), the reference's pre-images).
([#1409](https://github.com/asc-community/AngouriMath/issues/1409), Sullivan and Mackey's pre-images).

| Input | Was (2.5.0) | Now |
|---|---|---|
Expand Down Expand Up @@ -716,7 +716,7 @@ of [#1409](https://github.com/asc-community/AngouriMath/issues/1409) — is `Tru
`A`, an interval by interval arithmetic where `x` occurs once in `f`, and a membership object
otherwise; `preimage(f(x), x in A, Y)` is `{ x in A : f(x) in Y }`, and a set builder of that
shape is solved on evaluation where the membership is read (a listed `Y`, an interval)
([#1409](https://github.com/asc-community/AngouriMath/issues/1409), the reference's §7.3). Both
([#1409](https://github.com/asc-community/AngouriMath/issues/1409), Sullivan and Mackey's §7.3). Both
names are keywords now, and were names.

| Input | Was (2.5.0) | Now |
Expand All @@ -731,7 +731,7 @@ names are keywords now, and were names.
`(-oo)^(-1)`, while `(+oo)^2` was `+oo`: the finite-base arms did not apply and the polar form
had nothing to say. They are the extended reals' powers now, `-oo`, `+oo` and `0`, so the image of
`(-oo; +oo)` under a cube is `(-oo; +oo)`; and `forall b in B : exists a in A : f(a) = b` — surjectivity
onto `B`, Def 7.4.1 of the reference of [#1409](https://github.com/asc-community/AngouriMath/issues/1409)
onto `B`, Sullivan and Mackey's Def 7.4.1, [#1409](https://github.com/asc-community/AngouriMath/issues/1409)
— is decided as `B` lying in the image of `A` under `f` where that image evaluates.

| Input | Was (2.5.0) | Now |
Expand All @@ -750,7 +750,7 @@ theorem read backwards, as the factorial spelling already was (`sum(binomial(n,
is `(x + y)^n` for `n >= 0`). **Wrong answer fixed** in the alternating sum, in both spellings:
`sum(binomial(n, k) (-1)^k, k, 0, n)` is `1` at `n = 0` and `0` above, and the closed form `0^n`
carried a condition the piecewise read as no value, so the sum was `0` at `n = 0`
([#1409](https://github.com/asc-community/AngouriMath/issues/1409), the reference's §8.4).
([#1409](https://github.com/asc-community/AngouriMath/issues/1409), Sullivan and Mackey's §8.4).

| Input | Was (2.5.0) | Now |
|---|---|---|
Expand All @@ -759,6 +759,35 @@ carried a condition the piecewise read as no value, so the sum was `0` at `n = 0
| `"sum(binomial(n, k), k, 0, n)".ToEntity().Evaled` | `UnhandledParseException` | `piecewise((2 ^ n) provided (n >= 0), 0 provided True)` |
| `"sum(n! / (k! (n - k)!) (-1)^k, k, 0, n)".ToEntity().Evaled` | `piecewise(0 provided True)` — wrong at `n = 0` | `piecewise(1 provided (n = 0), 0 provided True)` |

### A statement about a sum up to `n` is decided by induction

`forall n in ZZ+ : sum(f, k, a, n) = g` is proved from the least member of the set: the statement
there, and the statement at `n + 1` with the sum unfolded by one term and the sum to `n` replaced
by `g`, decided as an identity. A sum the summation already folds is read through the piecewise
its closed form comes as, and an identity is read over atoms — `2^n`, `n!`, `(-1)^n`, `sin(x)` —
with a whole shift in an exponent or a factorial's argument unfolded, and a difference of
quotients put over one denominator — claimed where that denominator is not zero, which is decided
over the set for the quantified name and stated as a condition for a free parameter. An
inequality with an exponential or a factorial is decided by induction as well, the step read off
a multiple of the hypothesis (`P(n + 1) = c P(n) + D` with `c >= 0` and `D >= 0` by a sign
calculus), and the whole numbers from `m` are read as `ZZ*` shifted by `m`. A statement that
fails at the least member is `False`; a closed form with a case on a free parameter is left as
written
([#1409](https://github.com/asc-community/AngouriMath/issues/1409), Sullivan and Mackey's chapter 5).

| Input | Was (2.5.0) | Now |
|---|---|---|
| `"forall n in ZZ+ : sum(k, k, 1, n) = n (n + 1) / 2".ToEntity().Evaled` | `UnhandledParseException` — quantifiers are new since; left as written when they arrived, the body being a `piecewise` | `True` |
| `"forall n in ZZ+ : sum(1 / (k (k + 1)), k, 1, n) = n / (n + 1)".ToEntity().Evaled` | `UnhandledParseException` | `True`, by induction |
| `"forall n in ZZ+ : sum(k k!, k, 1, n) = (n + 1)!".ToEntity().Evaled` | `UnhandledParseException` | `False`, at `n = 1` |
| `"forall n in ZZ+ : (n + 1)! + (n + 1) (n + 1)! = (n + 2)!".ToEntity().Evaled` | `UnhandledParseException` | `True` |
| `"forall x in RR : (sin(x) + 1)^2 = sin(x)^2 + 2 sin(x) + 1".ToEntity().Evaled` | `UnhandledParseException` | `True` |
| `"forall n in ZZ+ /\\ [2; +oo) : n = n".ToEntity().Evaled` | `UnhandledParseException` | `True` — the set is known not to be empty |
| `"forall n in ZZ+ : sum(1 / (a k (k + 1)), k, 1, n) = n / (a (n + 1))".ToEntity().Evaled` | `UnhandledParseException` | `True provided not a = 0` |
| `"forall n in ZZ+ /\\ [5; +oo) : 2^n > n^2".ToEntity().Evaled` | `UnhandledParseException` | `True` |
| `"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*` |

### `binomial(n, k)` is a function

**Addition, not silent.** The binomial coefficient is a node, `Entity.Binomialf`, spelled
Expand Down
3 changes: 3 additions & 0 deletions Sources/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed
[AngouriMath/Functions/NumberTheory/ResidueClasses.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

[Tests/UnitTests/Core/InductionTest.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

[Tests/UnitTests/Core/SurjectivityTest.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ internal Cardf New(Entity argument)
/// A quantified statement: <c>forall x in S : P</c>, <c>exists x in S : P</c> and
/// <c>exists! x in S : P</c>. A binder, like a set builder: the name is bound throughout
/// the body and the set, and the statement is a function of what else the body mentions.
/// The quantification set is mandatory, as the reference this follows insists — a
/// The quantification set is mandatory, as Sullivan and Mackey's proofs book insists — a
/// statement is quantified over something, and <c>forall x : x^2 &gt;= 0</c> is true of
/// the reals and false of the complex numbers.
/// https://github.com/asc-community/AngouriMath/issues/1409
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,8 +859,8 @@ is var (divided, remainder)
description: "(x + a)! * y = (x + a + 1)!, where y is the next term"),

// The binomial coefficient's three identities, each in the direction that collects:
// Pascal's rule, the chairperson identity and the symmetry. The reference's
// Props 8.4.1-8.4.3 (Sullivan and Mackey), which it proves by counting in two ways;
// Pascal's rule, the chairperson identity and the symmetry. Sullivan and Mackey's
// Props 8.4.1-8.4.3, which it proves by counting in two ways;
// here they are identities of the falling factorial for a whole lower index and of
// the gamma function elsewhere. https://github.com/asc-community/AngouriMath/issues/1409
new MatchedRule(
Expand Down
49 changes: 49 additions & 0 deletions Sources/AngouriMath/Docs/References.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# References

The books, papers, corpora and libraries this code and its tests draw on, with what each is used
for. A citation in a comment, a test summary or a changelog entry names the work as it is named
here — *Sullivan and Mackey's Ex 5.3.2*, *Bronstein §2.2* — and this page carries the full title
and the link. Add a work here when it is first cited.

## Textbooks

- **Sullivan, Brendan W., with Mackey, John.** *Everything You Always Wanted To Know About
Mathematics (But didn't even know to ask): A Guided Journey Into the World of Abstract
Mathematics and the Writing of Proofs.* Carnegie Mellon University, 2013.
<https://www.math.cmu.edu/~jmackey/151_128/bws_book.pdf>.
The proofs book of [#1409](https://github.com/asc-community/AngouriMath/issues/1409): sets,
subsets and power sets, indexed unions and intersections, the integer range `[n]`, quantified
statements, congruences and residue classes, image and pre-image, injectivity and surjectivity,
binomial identities, and induction — its examples and exercises are the rows of
`QuantifierTest`, `SubsetTest`, `IndexedSetOperationTest`, `ImageAndPreImageTest`,
`BinomialIdentityTest`, `InductionTest` and `ThresholdSetTest`.
- **Bronstein, Manuel.** *Symbolic Integration I: Transcendental Functions.* 2nd ed., Springer,
2005. The Hermite reduction, the rational and logarithmic parts, and the Risch structure the
integrator follows.
- **von zur Gathen, Joachim, and Gerhard, Jürgen.** *Modern Computer Algebra.* 3rd ed., Cambridge
University Press, 2013. The polynomial layer: gcds, factorisation, resultants.
- **Gruntz, Dominik.** *On Computing Limits in a Symbolic Manipulation System.* PhD thesis, ETH
Zürich, 1996. The limit algorithm.
- **Timofeev, A. F.** *Integration of Functions* (Интегрирование функций). 1948. Its integrals are
a family of Rubi's test suite, and are cited by his name where one of them is the row.

## Corpora

- **Rubi — Rule-based Integration** (Albert D. Rich et al.), <https://rulebasedintegration.org/>,
and its test problems, <https://rulebasedintegration.org/testProblems.html>: the integration
corpus the integrator is measured against
([#718](https://github.com/asc-community/AngouriMath/issues/718)).
- **Wester, Michael.** *A Critique of the Mathematical Abilities of CA Systems*, in *Computer
Algebra Systems: A Practical Guide*, Wiley, 1999. The Wester problems of `Docs/Usage/Comparison.md`.

## Reference works

- **NIST Digital Library of Mathematical Functions (DLMF)**, <https://dlmf.nist.gov/>: the
identities and branch cuts of the special functions, cited by section (`DLMF 4.23`).
- **Wolfram MathWorld**, <https://mathworld.wolfram.com/>: conventions and the names of things,
where a convention is chosen and the choice recorded.
- **mathlib4**, <https://leanprover-community.github.io/mathlib4_docs/>: the hypotheses of an
identity, machine-checked, which is what a rewrite rule's contract is checked against
(`Contributing/SimplificationContract.md`).
- **SymPy**, <https://www.sympy.org/>: readable reference implementations of Risch, Gruntz and
Gröbner, with the papers cited in the docstrings; the target of `ToSympyCode`.
29 changes: 27 additions & 2 deletions Sources/AngouriMath/Docs/Usage/Syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,33 @@ about `y`. Decided over a finite set by evaluating the body at every member (`fo
False}`, and over an infinite set by a counterexample (`forall n in ZZ : n^2 <= n^3` is `False` at
`n = -1`) or by solving where the solver reads the body (`forall x in RR : x^2 >= 0` is `True`,
`exists x in RR : x^2 + 1 = 0` is `False` and `exists x in CC : x^2 + 1 = 0` is `True`); left as
written otherwise, never guessed. `not` passes through a quantifier by flipping it: `not forall
x in S : P` is `exists x in S : not P`. In LaTeX, `\forall x \in S : P`. `forall`, `exists` and
written otherwise, never guessed. A body that is a `piecewise` — what `sum` and `product` fold to,
`sum(k, k, 1, n)` being `(n + n^2)/2 provided n >= 0` — is read as the case whose condition holds
at every member, so `forall n in ZZ+ : sum(k, k, 1, n) = n (n + 1)/2` is `True`. An equation whose
sides differ by a polynomial that expands to nothing is `True` over any set, where a polynomial is
read over *atoms*: whatever is not a sum, product, quotient or whole power is one indeterminate,
a whole shift in an exponent is a factor (`2^(n + 1)` is `2 · 2^n`) and a factorial of a shifted
argument is the smaller one times the numbers between (`(n + 2)!` is `(n + 2)(n + 1) n!`), so
`forall n in ZZ+ : (n + 1)! + (n + 1)(n + 1)! = (n + 2)!` is `True`. And **a statement about a sum
or a product up to `n`, over the whole numbers from some least one, is decided by induction**:
`forall n in ZZ+ : sum(1/(k (k + 1)), k, 1, n) = n/(n + 1)` is `True` because it holds at `n = 1`
and, with the sum to `n + 1` unfolded to the sum to `n` plus one term and that sum replaced by
`n/(n + 1)`, the statement at `n + 1` is an identity; `forall n in ZZ+ /\ [2; +oo) : ...` starts at
`2`. A difference of quotients is put over one denominator, and the identity is claimed where the
denominator is not zero: decided over the set for the quantified name (`n + 1` is never `0` on
`ZZ+`), and stated as a condition for a free parameter (`forall n in ZZ+ : sum(1/(a k (k + 1)), k, 1, n) =
n/(a (n + 1))` is `True provided not a = 0`). Only the shape with one sum or product
alone on a side of an equation is read this way; a sum whose closed form has a case on a free
parameter is left as written. **An inequality with an exponential or a factorial in `n`** is
decided by induction too, with the step read off a multiple of the hypothesis: writing it as
`P(n) >= 0`, `P(n + 1) = c P(n) + D` for a `c >= 0` (one, the base of an exponential, `n + 1`
beside a factorial) and a `D` whose sign is read from its shape — a positive base to any power, a
factorial, a polynomial in `n` decided over the set, sums and products of these — so `forall n in
ZZ+ /\ [5; +oo) : 2^n > n^2` is `True` (`2^(n + 1) - 2 · 2^n` leaves `n^2 - 2 n - 1`, positive
from `5`), `forall n in ZZ+ /\ [4; +oo) : 2^n > n^2` is `False` at `4`, and `forall n in ZZ+ :
n! >= 2^(n - 1)` is `True`. The whole numbers from `m` are `ZZ*` shifted by `m`, so a statement
over `ZZ+ /\ [4; +oo)` is decided as one about `4 + t` over `ZZ*`, whichever route reads it. `not`
passes through a quantifier by flipping it: `not forall x in S : P` is `exists x in S : not P`. In LaTeX, `\forall x \in S : P`. `forall`, `exists` and
`exists!` are keywords, so they are not names.

`domain` takes a special set — `CC` `RR` `QQ` `ZZ` `ZZ*` `ZZ+` `BB` — or the keyword `Any`, and
Expand Down
Loading
Loading