Skip to content

Commit 12d7371

Browse files
The size of an infinite set is an aleph, and sizes compare (#1577)
aleph(k), MathS.Aleph, is Entity.Alephf, indexed by the whole numbers from zero. card of PP, ZZ+, ZZ*, ZZ and QQ is aleph(0); of RR, CC and an interval with distinct ends 2^aleph(0), which is an aleph but not a named one -- that it is aleph(1) is the continuum hypothesis; of a power set 2^card(S); of a union with an infinite side its larger side; of an infinite A less a smaller B, RR \ QQ among them, the size of A. A sum or a product of sizes, one of them infinite, is the larger, so aleph(0) + 1 is aleph(0); a difference or a quotient of sizes, or a size with a negative or fractional number added or multiplied, has no value and is NaN, as log(0) is. Sizes compare by what ZFC proves: alephs by their index, s < 2^s for every size, a tower of height t over aleph(k) at least aleph(k + t), 2^s monotone in s; a subset is no larger than its superset. What that leaves open, 2^aleph(0) = aleph(1) among it, stays written, and a constant with a size inside is not compared as a number. The parser is regenerated for the name, and the public API baseline carries the node. Part of #1409. Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 58987de commit 12d7371

28 files changed

Lines changed: 1611 additions & 960 deletions

‎BREAKING-CHANGES.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,23 @@ met piece by piece now ([#1409](https://github.com/asc-community/AngouriMath/iss
722722
| `{ x in RR : x^2 - 3 x + 2 >= 0 } = { y in RR : y <= 1 or y >= 2 }` | left as written | `True` |
723723
| `"({ 2 } \/ (-oo; 1] \/ (2; +oo)) /\ (1; 2)".ToEntity().Evaled` | left as written | `{ }` |
724724

725+
### The size of an infinite set is an aleph, and sizes compare
726+
727+
`card` of an infinite set is an aleph, `aleph(k)`, or a power of 2 of one: `card(ZZ)`, `card(QQ)`
728+
and `card(PP)` are `aleph(0)`, and `card(RR)` is `2^aleph(0)`, an aleph but not a named one, since
729+
which one it is is the continuum hypothesis, which ZFC does not decide: `2^aleph(0) = aleph(1)`
730+
stays as written. `card(powerset(S))` is `2^card(S)`. A sum or a product of sizes, one of them
731+
infinite, is the larger, and a difference or a quotient of sizes has no value and is `NaN`, as
732+
`log(0)` is. Sizes compare by what ZFC proves, and a set is smaller than its power set whatever it
733+
is ([#1409](https://github.com/asc-community/AngouriMath/issues/1409), Sullivan and Mackey's §7.6).
734+
735+
| Input | Was (2.5.0) | Now |
736+
|---|---|---|
737+
| `"card(ZZ)".ToEntity().Simplify()` | `#ZZ` | `aleph(0)` |
738+
| `"card(ZZ) = card(QQ)".ToEntity().Simplify()` | `#ZZ = #QQ` | `True` |
739+
| `"card(ZZ) < card(RR)".ToEntity().Simplify()` | `#ZZ < #RR` | `True` |
740+
| `"aleph(0) + 1".ToEntity().Simplify()` | `1` — `aleph(0)` was read as `aleph * 0` | `aleph(0)` |
741+
725742
### An integer range is listed, and a family of sets has a union and an intersection
726743

727744
`ZZ /\ [1; 10]` lists its members now — an integer set cut by a numeric interval with at most

‎Sources/.editorconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed
341341

342342
[AngouriMath/Core/Entity/Continuous/Entity.Continuous.Iverson.Classes.cs]
343343
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
344+
[AngouriMath/Core/Entity/Continuous/Entity.Continuous.Aleph.Classes.cs]
345+
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
344346

345347
[Tests/UnitTests/Core/ProofRecordingTest.cs]
346348
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
@@ -396,6 +398,9 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed
396398
[AngouriMath/Core/Entity/Omni/Sets/SetOperators.Subset.cs]
397399
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
398400

401+
[AngouriMath/Core/Entity/Omni/Sets/Cardinality.cs]
402+
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
403+
399404
[Tests/UnitTests/Core/Sets/SubsetTest.cs]
400405
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
401406

‎Sources/AngouriMath/Convenience/MathS.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,18 @@ public static Entity VectorLength(Matrix v)
13941394
[MethodImpl(MethodImplOptions.AggressiveInlining)]
13951395
public static Entity Iverson(Entity statement) => new Iversonf(statement);
13961396

1397+
/// <summary>The aleph number <c>aleph(k)</c>, the size of an infinite set</summary>
1398+
/// <param name="index">The index, a whole number from zero</param>
1399+
/// <returns>The <see cref="Entity.Alephf"/> node</returns>
1400+
/// <remarks>
1401+
/// <c>aleph(0)</c> is the size of the whole numbers and of the rationals, and
1402+
/// <c>card(ZZ)</c> is it. The size of the reals is <c>2^aleph(0)</c>, not a named aleph:
1403+
/// which one it is, is the continuum hypothesis.
1404+
/// https://github.com/asc-community/AngouriMath/issues/1409
1405+
/// </remarks>
1406+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1407+
public static Entity Aleph(Entity index) => new Alephf(index);
1408+
13971409
/// <summary>The error function, <c>erf(z) = 2/sqrt(pi) int_0^z e^(-t^2) dt</c></summary>
13981410
/// <param name="a">The argument, any complex number</param>
13991411
/// <returns>The <see cref="Entity.Erff"/> node</returns>

‎Sources/AngouriMath/Core/Antlr/AngouriMath.g‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ atom returns[Entity value]
599599
/* The Iverson bracket, 1 where a statement holds and 0 where it does not: a count written as
600600
a sum. https://github.com/asc-community/AngouriMath/issues/1478 */
601601
| 'iverson(' args = function_arguments ')' { Assert("iverson", 1, $args.list.Count); $value = MathS.Iverson($args.list[0]); }
602+
/* The aleph numbers, the sizes of infinite sets. https://github.com/asc-community/AngouriMath/issues/1409 */
603+
| 'aleph(' args = function_arguments ')' { Assert("aleph", 1, $args.list.Count); $value = MathS.Aleph($args.list[0]); }
602604
/* The error functions. https://github.com/asc-community/AngouriMath/issues/1501 */
603605
| 'erf(' args = function_arguments ')' { Assert("erf", 1, $args.list.Count); $value = MathS.Erf($args.list[0]); }
604606
| 'erfc(' args = function_arguments ')' { Assert("erfc", 1, $args.list.Count); $value = MathS.Erfc($args.list[0]); }

‎Sources/AngouriMath/Core/Antlr/AngouriMath.interp‎

Lines changed: 3 additions & 1 deletion
Large diffs are not rendered by default.

‎Sources/AngouriMath/Core/Antlr/AngouriMath.tokens‎

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,15 @@ T__178=179
180180
T__179=180
181181
T__180=181
182182
T__181=182
183-
NEWLINE=183
184-
NUMBER=184
185-
SPECIALSET=185
186-
BOOLEAN=186
187-
NAN=187
188-
VARIABLE=188
189-
COMMENT=189
190-
WS=190
183+
T__182=183
184+
NEWLINE=184
185+
NUMBER=185
186+
SPECIALSET=186
187+
BOOLEAN=187
188+
NAN=188
189+
VARIABLE=189
190+
COMMENT=190
191+
WS=191
191192
'!'=1
192193
'^'=2
193194
'-'=3
@@ -355,19 +356,20 @@ WS=190
355356
'lcm('=165
356357
'binomial('=166
357358
'iverson('=167
358-
'erf('=168
359-
'erfc('=169
360-
'erfi('=170
361-
'Ei('=171
362-
'li('=172
363-
'Si('=173
364-
'Ci('=174
365-
'Shi('=175
366-
'Chi('=176
367-
'trunc('=177
368-
'conjugate('=178
369-
'domain('=179
370-
'piecewise('=180
371-
'apply('=181
372-
'lambda('=182
373-
'NaN'=187
359+
'aleph('=168
360+
'erf('=169
361+
'erfc('=170
362+
'erfi('=171
363+
'Ei('=172
364+
'li('=173
365+
'Si('=174
366+
'Ci('=175
367+
'Shi('=176
368+
'Chi('=177
369+
'trunc('=178
370+
'conjugate('=179
371+
'domain('=180
372+
'piecewise('=181
373+
'apply('=182
374+
'lambda('=183
375+
'NaN'=188

0 commit comments

Comments
 (0)