Skip to content
Symi Docs
WASM / JavaScript

Signatures in the WASM / JavaScript view are TypeScript. Where the JavaScript facade wraps an operation its form is listed first; the other calling forms are the raw wasm-bindgen exports.

On this page

Boolean algebra and logic

See Evaluation and constants for the distinction between symbolic relations, execute, logical simplification, and the exact three-valued host query.

Logical formulas are built from the connective heads logical_and, logical_or, logical_not, implies, equivalent (the n-ary "all arguments equal" biconditional), and exclusive_or (n-ary parity), applied through parse or call/function_call over the relational atoms (equal, less_than, …) and ordinary symbols treated as Boolean variables. The associative-commutative connectives auto-simplify to a flat, sorted, deduplicated, constant- and complement-folded canonical form. The two Boolean constants are logical_true and logical_false.

Normal forms and Boolean simplification are documented in logical transforms.

logical_true#

Not exposed by the WASM / JavaScript bindings. Available as Context.logical_true in Python, UniffiSession.logicalTrue in Kotlin, UniffiSession.logicalTrue in Swift, api::Session::logical_true in Rust.

The Boolean constant true (⊤\top).

logical_false#

Not exposed by the WASM / JavaScript bindings. Available as Context.logical_false in Python, UniffiSession.logicalFalse in Kotlin, UniffiSession.logicalFalse in Swift, api::Session::logical_false in Rust.

The Boolean constant false (⊥\bot).

evaluate_truth#

Raw WebAssembly: Default context

evaluateTruth(input_expression: Expression): boolean | undefined
Calling forms

Explicit context: Context.evaluateTruth

evaluateTruth(predicate: ExpressionLike): boolean | null

Raw WebAssembly: Explicit context: Context.evaluateTruth

evaluateTruth(input_expression: Expression): boolean | undefined

SymiFacade method: SymiFacade.evaluateTruth

evaluateTruth(predicate: ExpressionLike): boolean | null

Expression method: Expression.evaluateTruth

evaluateTruth(): boolean | null

Raw WebAssembly: Expression method: Expression.evaluateTruth

evaluateTruth(): boolean | undefined

evaluate_truth(predicate) uses exact three-valued logic. Python returns True, False, or None; JavaScript returns true, false, or null; Rust returns TruthValue. Non-logical numeric expressions are rejected.

The third value means undecided, never false. A None / null / unknown result says the procedure could not prove either verdict — not that the predicate is false. This distinction is load-bearing at the call site, because a host-language if treats None and null as falsy: a test written if evaluate_truth(...) silently reads every undecided relation as false. Compare against True / False (or true / false) explicitly whenever the undecided case matters.

Order, equality and sign relations are decided exactly, by rational and polynomial arithmetic only — no floating point ever enters the decision. The decided class is the closed-form real constants: integer and rational literals, pi, real algebraic numbers, sums, products, integer powers, and rational powers of a positive base (so sqrt and nested radicals), together with abs and signum over those. Within that class a comparison is decided in full, including values that need term collection to become constant at all, such as x + sqrt(5) < x + 3.

Outside it the answer is unknown by design, not by accident: comparisons whose difference involves e, log 2 or a special-function value, order between unassumed symbols, and any relation with a provably non-real operand — sqrt(-4) is 2i, about which no order verdict is meaningful — all decline rather than guess.

Example#

Logical expressions carry a three-valued outcome.

JavaScript
const x = symi.symbol("x");

console.log(symi.evaluateTruth(symi.lessThan(symi.rational(1n, 3n), 1)));
console.log(symi.evaluateTruth(symi.lessThan(x, 1)));

Additional API#

logicalFalse#

Raw WebAssembly: Default context

logicalFalse(): Expression

The Boolean constant false (⊥\bot).

Calling forms

Explicit context: Context.logicalFalse

readonly logicalFalse: Expression

Raw WebAssembly: Explicit context: Context.logicalFalse

logicalFalse(): Expression

SymiFacade property: SymiFacade.logicalFalse

readonly logicalFalse: Expression

logicalTrue#

Raw WebAssembly: Default context

logicalTrue(): Expression

The Boolean constant true (⊤\top).

Calling forms

Explicit context: Context.logicalTrue

readonly logicalTrue: Expression

Raw WebAssembly: Explicit context: Context.logicalTrue

logicalTrue(): Expression

SymiFacade property: SymiFacade.logicalTrue

readonly logicalTrue: Expression

Symi documentation · WASM / JavaScript