Skip to content
Symi Docs
Swift
On this page

Sets

Sets are ordinary Expression values; constructors route through auto-simplification (degenerate intervals collapse, unions splice and deduplicate, etc.). Take results apart with the structural accessors on the expressions page.

interval#

Explicit context

func interval(
    lower: UniffiExpression,
    upper: UniffiExpression,
    lowerInclusive: Bool,
    upperInclusive: Bool,
) -> UniffiExpression

Real-line interval. Closed by default; endpoints at infinity are forced open. Degenerate shapes collapse (empty interval →\to empty set, single point →\to finite set, (−∞,∞)→(-\infty, \infty)\to real line).

real_line#

Explicit context

func realLine() -> UniffiExpression

The set R\mathbb{R}.

complex_plane#

Explicit context

func complexPlane() -> UniffiExpression

The set C\mathbb{C} — the ambient universe, and the domain a variable ranges over when it carries no realness assumption.

integer_set#

Explicit context

func integerSet() -> UniffiExpression

The set Z\mathbb{Z}.

empty_set#

Explicit context

func emptySet() -> UniffiExpression

The empty set ∅\varnothing.

finite_set#

Explicit context

func finiteSet(elements: [UniffiExpression]) -> UniffiExpression

Finite set; elements are deduplicated and canonically ordered. An empty list gives the empty set.

set_union#

Explicit context

func setUnion(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiExpression

Union, computed eagerly where the structural rules allow (overlapping or touching interval pairs merge; nested unions splice, ∅\varnothing drops, R\mathbb{R} absorbs); otherwise the structural set_union node.

set_intersection#

Explicit context

func setIntersection(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiExpression

Intersection, computed eagerly where the structural rules allow (interval pairs, finite-set membership filtering; R\mathbb{R} drops, ∅\varnothing absorbs); otherwise the structural set_intersection node.

set_complement#

Explicit context

func setComplement(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiExpression

The relative complement a∖ba \setminus b.

image_set#

Explicit context

func imageSet(
    lambdaExpression: UniffiExpression,
    variable: String,
    domain: UniffiExpression,
) -> UniffiExpression

The set {lambda_expression⁡:variable⁡∈domain⁡}\{\operatorname{lambda\_expression} : \operatorname{variable} \in \operatorname{domain}\}; variable is a binder over lambda_expression. Finite domains are enumerated element-wise at construction.

condition_set#

Explicit context

func conditionSet(
    variable: String,
    condition: UniffiExpression,
    domain: UniffiExpression,
) -> UniffiExpression

The set {variable⁡∈domain⁡:condition⁡}\{\operatorname{variable} \in \operatorname{domain} : \operatorname{condition}\}. This is also solveset's honest "unsolved" residue shape.

is_member#

Explicit context

func isMember(
    element: UniffiExpression,
    set: UniffiExpression,
) -> UniffiTruthValue

Three-valued membership: True only on structural proof, False only on a structural counterexample, None otherwise. Covers ∅\varnothing, R\mathbb{R}, finite sets, intervals, unions, intersections, complements.

is_subset#

Explicit context

func isSubset(
    smaller: UniffiExpression,
    larger: UniffiExpression,
) -> UniffiTruthValue

Three-valued subset query: ∅⊆\varnothing \subseteq anything, structural equality, finite-set element checks, interval-in-interval endpoint tests; None otherwise.

enumerate_set_in_interval#

Explicit context

func enumerateSetInInterval(
    set: UniffiExpression,
    lower: UniffiExpression,
    upper: UniffiExpression,
    lowerInclusive: Bool,
    upperInclusive: Bool,
    limit: UInt64?,
) -> UniffiSetEnumeration

Exact elements of a set inside [lower⁡,upper⁡][\operatorname{lower}, \operatorname{upper}], in increasing order, as {"outcome": str, "elements": list[Expression]}. outcome is "complete" when those are exactly the elements in the interval, "truncated" when limit cut the list short (the family is still solved), and "declined" when the set's shape is not enumerable — never a licence to approximate. Handles finite sets, affine image sets over Z\mathbb{Z}, unions, complements, and the unevaluated set_intersection(interval, image_set) shape solveset_in_domain returns for a lattice too wide to materialize. limit defaults to 64. WASM returns a SetEnumeration object with outcome and elements getters.

Example#

Additional API#

length#

Expression method

func length() -> UInt64

Number of elements of a finite-set expression.

SetEnumeration#

SetEnumeration.elements#

UniffiSetEnumeration method

func elements() -> [UniffiExpression]

The exact elements produced, in increasing order.

SetEnumeration.outcome#

UniffiSetEnumeration method

func outcome() -> UniffiEnumerationVerdict

"complete", "truncated", or "declined".

Symi documentation · Swift