Predicates

Predicates let you embed comparisons, set membership, and typed constraints directly in a boolean expression.

Overview

A predicate is an atomic comparison involving a typed variable: age >= 18, region in {CA, US}, or tier == "gold". Logic Studio treats each unique predicate as a boolean atom — it's either true or false for any given input value.

Predicates are useful for modelling real-world gate logic where the inputs are not simple booleans but scalars, enumerations, or set memberships.

Feature-flag expression with predicates — the left panel shows Predicate Variables for age and region, each with type badges and predicate chips.
The feature-flag example. The Predicate Variables section shows age (with predicate age >= 18) and region (with predicate region in {CA, US, UK}).

Predicate syntax

Write predicates inline in the expression, wrapping in parentheses:

can_buy = (age >= 18) & (tier in {gold, platinum}) & !banned;

Each predicate becomes an atom in the boolean expression. The atom's truth value depends on the actual value of the typed variable at runtime.

Supported operators

OperatorApplies toExample
==number, string, enumstatus == "active"
!=number, string, enumcountry != "banned"
<numberage < 18
<=numberscore <= 100
>numberbalance > 0
>=numberage >= 18
inenum, stringregion in {CA, US, UK}
not-inenum, stringcountry not-in {IR, KP}
Limitation
Cross-variable arithmetic (e.g. a + b > c) is not supported. Each predicate must involve exactly one variable on the left side and a literal on the right. Z3 SMT can handle multi-variable constraints but the predicate UI does not model them.

Variable types

The Predicate Variables section in the left panel shows each predicate variable with a type badge. Types are detected automatically from the predicates used:

Click the + button next to a variable to open the type editor and set the type, value range, or enum values explicitly. This enables richer bucket generation for the truth table and coverage panels.

Buckets

For a typed variable, Logic Studio generates buckets — mutually exclusive, collectively exhaustive value ranges that make each predicate constant. Each bucket becomes a row (or column group) in the truth table.

For a numeric variable with predicates age < 18 and age >= 21, the buckets are:

Enum variables enumerate each value in the declared value list plus an "other" bucket.

Contradictions & subsumption

Logic Studio's predicate theory module detects when two predicates over the same variable are logically contradictory or when one subsumes the other:

The solver and simplify panels will show these detections in their results.

Limitations