Optionalvalue: stringASCIIMath rendering of the current state (terminal output, not chainable).
The expression in reverse Polish notation, as the tokens produced by the parser.
LaTeX rendering of the current state (terminal output, not chainable).
The names of the sets used in the expression, without duplicates, in order of appearance.
Full duplicate of this instance, including display state (selected form
and options set via as*** / with***). Distinct from copy.
Copy the mathematical state of another instance into this (display
state is NOT transferred — the receiver keeps its own formatting). Entry
point used when constructing/parsing from a same-type input. Distinct from
clone. Classes without a real implementation throw
NotImplementedError.
Evaluates the expression as a predicate: given boolean membership values
for each variable, returns whether the set expression holds. Missing keys
default to false (not a member). The values argument is not mutated.
The - operator (set difference) is supported: A - B is true iff the
element is in A and not in B. Malformed RPN (underflowed stack) returns
false rather than throwing.
Returns the Venn diagram zones for n sets that satisfy the expression.
Each variable must be a single character; zone names are sorted
concatenations of those characters (e.g. 'AB' = A∩B only). The exterior
zone is labelled by withUniverse() (default 'E'). Variables in the
expression but absent from variables are treated as ∅.
Shortcut for venn('A', 'B'). Zone names: 'A', 'B', 'AB', plus
the exterior label (default 'E', configurable via withUniverse()).
Shortcut for venn('A', 'B', 'C'). Zone names: 'A', 'B', 'C',
'AB', 'AC', 'BC', 'ABC', plus the exterior label (default 'E',
configurable via withUniverse()).
Sets the label used for the exterior (universal complement) zone in Venn output. Default: 'E'.
StaticfromBuild a set expression from a string such as "A&B|!C" (& intersection, | union, ! complement,
- difference).
Represents a logical set expression (e.g.
A & B | !C), stored internally as a Reverse Polish Notation sequence. Supports LaTeX and AsciiMath rendering, boolean evaluation, and Venn diagram zone computation.Operator precedence (set by the
piexpressionparser, not by this class):!binds first, then&and|at the same level, applied from left to right, then-(set difference, also left to right). SoA|B&Cis(A|B)&C, notA|(B&C), andA-B&CisA-(B&C). Use parentheses to write any other grouping.