Skip to content
Symi Docs
Swift
On this page

Assumptions

Assumptions are typed, canonical propositions over scalar expressions. They are kept separately from the legacy per-symbol compatibility record, so compound Boolean formulas and immutable local scopes do not lose information.

Queries are three-valued: True means entailed, False means refuted, and None / undefined means that the bounded symbolic engine cannot decide. could_hold is a possibility query and may return true when ask is unknown.

A result keeps the facts it was derived under: the durable assumptions, local scope, or constraint its operation ran against, together with the facts its operands were derived under. Clearing or replacing an assumption later does not change what an earlier result means. Combining results whose facts contradict each other — x refined under x > 0 and -x refined under x < 0, for example — declines with an assumption conflict rather than producing a value no input could satisfy, and so does substituting a value that refutes one of those facts.

The retained facts describe when the returned object is valid, not how it was written: sqrt(x^2) refined under x > 0 returns x, and that x stays qualified by x > 0 even though a freshly built x is the same expression. The facts stay attached when their symbols disappear from the result — signum(x) refined under x > 0 is 1, still qualified by x > 0 — so a value of the result is valid only for inputs that satisfy them. They are conservative: a result may carry facts its derivation never consulted, but never omits one it did. A result whose facts were not recorded — from an operation that does not track them, from deserialization, or from a call during which the session's facts changed — is marked as having unknown provenance, which is never the same as having no conditions. Checking supplied values against retained facts never consults the declared assumptions: a fact still declared in the session is not evidence that a value supplied for its symbol satisfies it.

Proposition builders#

real_assumption#

Explicit context

func realAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is real.

rational_assumption#

Explicit context

func rationalAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is rational.

integer_assumption#

Explicit context

func integerAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is an integer.

natural_assumption#

Explicit context

func naturalAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is a natural number.

positive_integer_assumption#

Explicit context

func positiveIntegerAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is a positive integer.

positive_assumption#

Explicit context

func positiveAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is strictly positive.

negative_assumption#

Explicit context

func negativeAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is strictly negative.

nonzero_assumption#

Explicit context

func nonzeroAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is nonzero.

finite_assumption#

Explicit context

func finiteAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is finite.

complex_assumption#

Explicit context

func complexAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is a finite complex number.

extended_real_assumption#

Explicit context

func extendedRealAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is an extended real, including signed infinity.

infinite_assumption#

Explicit context

func infiniteAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is one of the two signed infinities.

irrational_assumption#

Explicit context

func irrationalAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is real and not rational.

zero_assumption#

Explicit context

func zeroAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is exactly zero.

even_assumption#

Explicit context

func evenAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is an even integer.

odd_assumption#

Explicit context

func oddAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is an odd integer.

prime_assumption#

Explicit context

func primeAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is a proven ordinary prime integer.

composite_assumption#

Explicit context

func compositeAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is a proven ordinary composite integer.

algebraic_assumption#

Explicit context

func algebraicAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is algebraic over the rationals.

transcendental_assumption#

Explicit context

func transcendentalAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression is transcendental over the rationals.

defined_assumption#

Explicit context

func definedAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Build a proposition asserting that an expression denotes one scalar value at the active point. Its negation asserts that the expression is undefined there; definedness alone authorizes no value, finiteness, realness, sign, continuity, or analyticity.

equal_assumption#

Explicit context

func equalAssumption(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiAssumptionProposition

Build a defined scalar equality proposition.

not_equal_assumption#

Explicit context

func notEqualAssumption(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiAssumptionProposition

Build a defined scalar disequality proposition.

less_assumption#

Explicit context

func lessAssumption(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiAssumptionProposition

Build a strict extended-real order proposition.

less_or_equal_assumption#

Explicit context

func lessOrEqualAssumption(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiAssumptionProposition

Build a non-strict extended-real order proposition.

greater_assumption#

Explicit context

func greaterAssumption(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiAssumptionProposition

Build a strict extended-real order proposition by reversing its operands canonically.

greater_or_equal_assumption#

Explicit context

func greaterOrEqualAssumption(
    left: UniffiExpression,
    right: UniffiExpression,
) -> UniffiAssumptionProposition

Build a non-strict extended-real order proposition by reversing its operands canonically.

member_assumption#

Explicit context

func memberAssumption(
    element: UniffiExpression,
    setExpression: UniffiExpression,
) -> UniffiAssumptionProposition

Build a scalar-membership proposition.

congruent_assumption#

Explicit context

func congruentAssumption(
    left: UniffiExpression,
    right: UniffiExpression,
    modulus: UniffiExpression,
) -> UniffiAssumptionProposition

Build an integer-congruence proposition with a positive integer modulus.

assumption_equal#

Not exposed by the Swift bindings. Available as api::Session::assumption_equal in Rust.

Construct an equality proposition over two scalar expressions.

assumption_not_equal#

Not exposed by the Swift bindings. Available as api::Session::assumption_not_equal in Rust.

Construct a disequality proposition over two scalar expressions.

assumption_less#

Not exposed by the Swift bindings. Available as api::Session::assumption_less in Rust.

Construct a strict scalar-order proposition.

assumption_less_or_equal#

Not exposed by the Swift bindings. Available as api::Session::assumption_less_or_equal in Rust.

Construct a non-strict scalar-order proposition.

assumption_greater#

Not exposed by the Swift bindings. Available as api::Session::assumption_greater in Rust.

Construct a strict scalar-order proposition with reversed operands.

assumption_greater_or_equal#

Not exposed by the Swift bindings. Available as api::Session::assumption_greater_or_equal in Rust.

Construct a non-strict scalar-order proposition with reversed operands.

assumption_member#

Not exposed by the Swift bindings. Available as api::Session::assumption_member in Rust.

Construct a scalar-membership proposition.

assumption_congruent#

Not exposed by the Swift bindings. Available as api::Session::assumption_congruent in Rust.

Construct an integer congruence proposition.

assumption_proposition_from_logical_expression#

Explicit context

func assumptionPropositionFromLogicalExpression(logicalExpression: UniffiExpression) -> UniffiAssumptionProposition

Convert a supported Boolean relation expression into a typed assumption proposition.

Matrix proposition builders#

Matrix propositions use an immutable, context-owned snapshot of the matrix. They return the same three-valued results as scalar assumptions and reject matrices from another context or an earlier context generation. matrix_shape additionally records the required dimensions in the canonical formula and serialization.

matrix_shape#

Build a proposition asserting that a matrix has the requested positive row and column counts.

square_matrix#

Build a proposition asserting that a matrix is square.

zero_matrix#

Build a proposition asserting that every matrix entry is zero.

identity_matrix#

Build a proposition asserting that a matrix is an identity matrix.

diagonal_matrix#

Build a proposition asserting that a matrix is diagonal.

upper_triangular_matrix#

Build a proposition asserting that a matrix is upper triangular.

lower_triangular_matrix#

Build a proposition asserting that a matrix is lower triangular.

symmetric_matrix#

Build a proposition asserting that a matrix equals its transpose.

hermitian_matrix#

Build a proposition asserting that a matrix equals its conjugate transpose.

orthogonal_matrix#

Build a proposition asserting that a real square matrix is orthogonal.

unitary_matrix#

Build a proposition asserting that a square matrix is unitary.

normal_matrix#

Build a proposition asserting that a square matrix commutes with its conjugate transpose.

full_rank_matrix#

Build a proposition asserting that a matrix has full rank.

invertible_matrix#

Build a proposition asserting that a matrix is square and invertible.

singular_matrix#

Build a proposition asserting that a matrix is square and singular.

integer_entries#

Build a proposition asserting that every matrix entry is an integer.

real_entries#

Build a proposition asserting that every matrix entry is real.

complex_entries#

Build a proposition asserting that every matrix entry is a finite complex value.

positive_definite_matrix#

Build a proposition asserting that a matrix is positive definite under the engine's exact Hermitian/real-domain convention.

positive_semidefinite_matrix#

Build a proposition asserting that a matrix is positive semidefinite under the engine's exact Hermitian/real-domain convention.

Scalar classification#

natural includes zero. positive and negative include the matching signed infinity; zero is finite zero, and nonzero includes non-real finite complex values and signed infinities. nonnegative and nonpositive are universe-guarded extended-real propositions; a bare negated sign does not establish either one. Prime and composite are not complements: negative integers, zero, and one are neither.

Primality is exact and proof-producing. A probable-prime screening result is deliberately unknown and is never exposed as a symbolic prime fact.

Proposition objects#

assumption_proposition#

An immutable, context-owned Boolean assumption formula.

and#

Conjoin two propositions and return a canonical proposition.

UniffiAssumptionProposition method

func and(other: UniffiAssumptionProposition) -> UniffiAssumptionProposition

Provides the and operation on this mobile object.

or#

Disjoin two propositions and return a canonical proposition.

UniffiAssumptionProposition method

func or(other: UniffiAssumptionProposition) -> UniffiAssumptionProposition

Provides the or operation on this mobile object.

not#

Negate a proposition and return a canonical proposition.

UniffiAssumptionProposition method

func not() -> UniffiAssumptionProposition

Provides the not operation on this mobile object.

relation_kind#

Return the canonical relation kind for a relation atom.

UniffiAssumptionProposition method

func relationKind() -> String?

Provides the relation_kind operation on this mobile object.

left_operand#

Return the left relation or congruence operand when present.

UniffiAssumptionProposition method

func leftOperand() -> UniffiExpression?

Provides the left_operand operation on this mobile object.

right_operand#

Return the right relation or congruence operand when present.

UniffiAssumptionProposition method

func rightOperand() -> UniffiExpression?

Provides the right_operand operation on this mobile object.

membership_element#

Return the membership element when present.

UniffiAssumptionProposition method

func membershipElement() -> UniffiExpression?

Provides the membership_element operation on this mobile object.

membership_set#

Return the membership set expression when present.

UniffiAssumptionProposition method

func membershipSet() -> UniffiExpression?

Provides the membership_set operation on this mobile object.

congruence_modulus#

Return the congruence modulus when present.

UniffiAssumptionProposition method

func congruenceModulus() -> UniffiExpression?

Provides the congruence_modulus operation on this mobile object.

serialize#

Serialize a proposition in the versioned canonical formula grammar.

UniffiAssumptionProposition method

func serialize() -> String

Provides the serialize operation on this mobile object.

deserialize_assumption_proposition#

Explicit context

func deserializeAssumptionProposition(text: String) -> UniffiAssumptionProposition

Parse a versioned canonical assumption proposition in the receiving context.

Durable contexts and scopes#

add_assumptions#

Explicit context

func addAssumptions(proposition: UniffiAssumptionProposition) -> Void

Atomically add a proposition to the durable assumption context. Contradictory updates are rejected without changing the prior state.

clear_all_assumptions#

Explicit context

func clearAllAssumptions() -> Void

Clear both durable formulas and legacy symbol assumptions.

ask#

Explicit context

func ask(proposition: UniffiAssumptionProposition) -> UniffiTruthValue
Calling forms and variants

Variant using local assumptions — UniffiAssumptionScope method: UniffiAssumptionScope.ask

func ask(proposition: UniffiAssumptionProposition) -> UniffiTruthValue

Return whether a proposition is entailed by the current durable context.

could_hold#

Explicit context

func couldHold(proposition: UniffiAssumptionProposition) -> UniffiTruthValue
Calling forms and variants

Variant using local assumptions — UniffiAssumptionScope method: UniffiAssumptionScope.couldHold

func couldHold(proposition: UniffiAssumptionProposition) -> UniffiTruthValue

Return whether the current durable context is compatible with a proposition.

assuming#

Explicit context

func assuming(proposition: UniffiAssumptionProposition) -> UniffiAssumptionScope
Calling forms and variants

Variant using local assumptions — UniffiAssumptionScope method: UniffiAssumptionScope.assuming

func assuming(proposition: UniffiAssumptionProposition) -> UniffiAssumptionScope

Create an immutable local scope by overlaying a proposition. The overlay does not change the owning context.

assumption_scope#

An immutable local assumption scope. Its scope-aware operations—simplify, refine, integrate, integrate_definite, evaluate_limit, taylor_series, laplace_transform, fourier_transform, singularities, and continuous_domain—execute through the captured assumptions without mutating the owning context. Each one asks the same shared assumption session that the durable entry points use, so a compound or relational fact reaches them exactly as a per-symbol declaration does. If an assumption cannot be checked for the requested operation, the operation keeps its ordinary unevaluated or declined result rather than guessing a branch. Each of those operations is documented with its subject — integrate on Calculus, for instance — as an explicitly labelled variant that runs under local assumptions, not as an alias of the durable form.

refine#

Explicit context

func refine(
    target: UniffiExpression,
    assumptions: UniffiAssumptionProposition?,
) -> UniffiExpression
Calling forms and variants

Expression method: UniffiExpression.refine

func refine(assumptions: UniffiAssumptionProposition?) -> UniffiExpression

Variant using local assumptions — UniffiAssumptionScope method: UniffiAssumptionScope.refine

func refine(target: UniffiExpression) -> UniffiExpression

Simplify an expression using durable assumptions or one checked local proposition.

Additional API#

nonnegative_assumption#

Explicit context

func nonnegativeAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Provides the nonnegative_assumption operation on this mobile object.

nonpositive_assumption#

Explicit context

func nonpositiveAssumption(subject: UniffiExpression) -> UniffiAssumptionProposition

Provides the nonpositive_assumption operation on this mobile object.

AssumptionProposition#

AssumptionProposition.plain_text#

UniffiAssumptionProposition method

func plainText() -> String

The canonical plain-text form of this assumption proposition.

Symi documentation · Swift