`SymmetricDifference(a, b)` = elements in `a` or `b` but not both. Only * reduced to a literal `Set` when both operands are finite; otherwise stays * symbolic (the `collection` handlers above provide membership/iteration * semantics for the unevaluated form).
(
ops: ReadonlyArray<Expression>,
{ engine: ce }: { engine: ComputeEngine }
)
| 1400 | { |
| 1401 | description: |
| 1402 | 'The ring; only `Integers` gives a finite collection, another ring stays inert.', |
| 1403 | sample: 'integers', |
| 1404 | }, |
| 1405 | { |
| 1406 | description: |
| 1407 | 'The generator of the ideal, the modulus `n` for `Integers`.', |
| 1408 | sample: '5', |
| 1409 | }, |
| 1410 | ], |
| 1411 | type: (ops, context) => |
| 1412 | BoxedType.forResult(quotientRingType(ops), context.engine._typeResolver), |
| 1413 | collection: { |
| 1414 | // Any other base, or a symbolic modulus, is not a collection: the |
| 1415 | // head stays inert. |
| 1416 | isCollection: (expr) => integerQuotientModulus(expr) !== undefined, |
| 1417 | count: (expr) => integerQuotientModulus(expr), |
| 1418 | isEmpty: (expr) => |
| 1419 | integerQuotientModulus(expr) === undefined ? undefined : false, |
| 1420 | isFinite: (expr) => |
| 1421 | integerQuotientModulus(expr) === undefined ? undefined : true, |
| 1422 | // A ring whose count is not a safe integer (more than 2^53 elements) |
| 1423 | // is not enumerable, and its iterator yields nothing: a walk of it |