Skip to content

Commit 1e42e76

Browse files
committed
Merge origin/master into signed-zero-branch
2 parents 65e7b65 + a645b91 commit 1e42e76

29 files changed

Lines changed: 2917 additions & 1908 deletions

‎BREAKING-CHANGES.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,33 @@ the downcasting on.
593593
|---|---|---|
594594
| `"(2*1.44*(1/sqrt(-5.286))^2-1)^(-1/2)".ToEntity().Evaled` | `5.5500952471953097…` | `-0.804560841963042…i`, as with the downcasting on |
595595
| `"((1/sqrt(-5.286))*(2*1.44*(1/sqrt(-5.286))^2-1)^(-1/2))^(-3)".ToEntity().Evaled` | `23.335336258472899…` | `-23.335336258472899…`, as with the downcasting on |
596+
### `subset` is a statement between sets, sets are equal by double containment, and `powerset` is a function
597+
598+
`A subset B` — also `A ⊆ B`, and `B superset A` / `B ⊇ A` for the same node — is the statement,
599+
`Entity.Set.Subsetf`, that every member of `A` is a member of `B`: the relation between sets that
600+
`in` is between an element and a set. It is decided from the shapes of the two sets — member by
601+
member for a listed set, along `ZZ+ ⊂ ZZ* ⊂ ZZ ⊂ QQ ⊂ RR ⊂ CC` for the special sets, by the ends for
602+
two intervals, by the set algebra for symbolic sets, and through the solver for a set builder —
603+
and is `NaN` with a number or a truth value on a side. **`=` between two sets is decided by
604+
double containment**, so a pair of sets that are not the same node no longer stays written when
605+
one is inside the other or one is not. `powerset(A)`, `Entity.Set.Powersetf`, is the set of all
606+
subsets of `A`: listed for a finite `A`, and for an infinite one an object whose membership is the
607+
subset test; `card` counts it as `2^card(A)`, and counts a listed set whose members are listed sets
608+
too ([#1409](https://github.com/asc-community/AngouriMath/issues/1409)). `subset`, `superset` and
609+
`powerset` are keywords now, and were names.
610+
611+
| Input | Was (2.5.0) | Now |
612+
|---|---|---|
613+
| `{1, 2} subset {1, 2, 3}` | `subset` was a variable, and the input a juxtaposition | `True` |
614+
| `{ x in RR : x^2 = 5 } subset ZZ` | — | `False` |
615+
| `A /\ B subset A` | — | `True` |
616+
| `{ x in ZZ : x >= 1 } = ZZ` | `{ x in ZZ : x >= 1 } = ZZ` — left as written (`ZZ+` did not parse in 2.5.0; `= ZZ+` is `True` now) | `False` |
617+
| `[0; 1] = [0; 2]` | `[0; 1] = [0; 2]` — left as written | `False` |
618+
| `{1, 2} = {1, 2, 3}` | `{ True, False }` — the comparison distributed over the members | `False` |
619+
| `{1, x} = {1, 2}` | `{ True, False, x = 1, x = 2 }` | `{ 1, x } = { 1, 2 }` — one statement, left as written |
620+
| `powerset({1, 2})` | `UnrecognizedFunctionParseException` | `{ { }, { 2 }, { 1 }, { 1, 2 } }` |
621+
| `{1, 3} in powerset(ZZ)` | `UnrecognizedFunctionParseException` | `True` |
622+
| `card({1, {}})` | `#{ 1, { } }` — left as written | `2` |
596623

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

‎Sources/.editorconfig‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed
294294
[Tests/UnitTests/Core/SignedZeroBranchTest.cs]
295295
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
296296

297+
[AngouriMath/Core/Entity/Omni/Sets/SetOperators.Subset.cs]
298+
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
299+
300+
[Tests/UnitTests/Core/Sets/SubsetTest.cs]
301+
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
302+
297303
[Tests/UnitTests/Core/ResidueClassTest.cs]
298304
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
299305

‎Sources/AngouriMath/Convenience/MathS.cs‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6227,6 +6227,41 @@ public static class Sets
62276227
/// </example>
62286228
public static Entity Card(Entity set) => new Cardf(set);
62296229

6230+
/// <summary>
6231+
/// The set of all subsets of a set, written <c>powerset(S)</c>. Listed for a finite
6232+
/// set, with the empty set and the set itself among the members; an object with a
6233+
/// membership test for an infinite one.
6234+
/// </summary>
6235+
/// <example>
6236+
/// <code>
6237+
/// Console.WriteLine(MathS.Sets.PowerSet(MathS.Sets.Finite(1, 2)).Evaled);
6238+
/// Console.WriteLine(MathS.Sets.Finite(1, 3).In(MathS.Sets.PowerSet(MathS.Sets.Z)).Evaled);
6239+
/// </code>
6240+
/// Prints
6241+
/// <code>
6242+
/// { { }, { 2 }, { 1 }, { 1, 2 } }
6243+
/// True
6244+
/// </code>
6245+
/// </example>
6246+
public static Set PowerSet(Entity set) => new Powersetf(set);
6247+
6248+
/// <summary>
6249+
/// The statement that <paramref name="sub"/> is a subset of <paramref name="super"/>,
6250+
/// written <c>A subset B</c>: every member of the first is a member of the second.
6251+
/// </summary>
6252+
/// <example>
6253+
/// <code>
6254+
/// Console.WriteLine(MathS.Sets.Subset(MathS.Sets.Finite(1, 2), MathS.Sets.Z).Evaled);
6255+
/// Console.WriteLine(MathS.Sets.Subset(MathS.Sets.Q, MathS.Sets.Z).Evaled);
6256+
/// </code>
6257+
/// Prints
6258+
/// <code>
6259+
/// True
6260+
/// False
6261+
/// </code>
6262+
/// </example>
6263+
public static Entity Subset(Entity sub, Entity super) => new Subsetf(sub, super);
6264+
62306265
/// <returns>A set of all Complexes/>s</returns>
62316266
public static Set C => SpecialSet.Create(Domain.Complex);
62326267

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ set_operator_union_setsubtraction returns[Entity value]
145145
in_operator returns[Entity value]
146146
: m1 = set_operator_union_setsubtraction { $value = $m1.value; }
147147
( 'in' m2 = set_operator_union_setsubtraction { $value = $value.In($m2.value); }
148+
| 'subset' m2 = set_operator_union_setsubtraction { $value = $value.SubsetOf($m2.value); }
149+
| '⊆' m2 = set_operator_union_setsubtraction { $value = $value.SubsetOf($m2.value); }
150+
| 'superset' m2 = set_operator_union_setsubtraction { $value = $m2.value.SubsetOf($value); }
151+
| '⊇' m2 = set_operator_union_setsubtraction { $value = $m2.value.SubsetOf($value); }
148152
| 'divides' m2 = set_operator_union_setsubtraction { $value = $value.Divides($m2.value); }
149153
| '|' m2 = set_operator_union_setsubtraction { $value = $value.Divides($m2.value); })*
150154
;
@@ -545,6 +549,7 @@ atom returns[Entity value]
545549
| 'abs(' args = function_arguments ')' { Assert("abs", 1, $args.list.Count); $value = MathS.Abs($args.list[0]); }
546550
| 'phi(' args = function_arguments ')' { Assert("phi", 1, $args.list.Count); $value = MathS.NumberTheory.Phi($args.list[0]); }
547551
| 'card(' args = function_arguments ')' { Assert("card", 1, $args.list.Count); $value = MathS.Sets.Card($args.list[0]); }
552+
| 'powerset(' args = function_arguments ')' { Assert("powerset", 1, $args.list.Count); $value = MathS.Sets.PowerSet($args.list[0]); }
548553
| 'floor(' args = function_arguments ')' { Assert("floor", 1, $args.list.Count); $value = MathS.Floor($args.list[0]); }
549554
| 'ceil(' args = function_arguments ')' { Assert("ceil", 1, $args.list.Count); $value = MathS.Ceil($args.list[0]); }
550555
/* SymPy's spelling, accepted so that an expression copied from there parses. Stringize

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

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

0 commit comments

Comments
 (0)