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.
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;
Supported operators
| Operator | Applies to | Example |
|---|---|---|
== | number, string, enum | status == "active" |
!= | number, string, enum | country != "banned" |
< | number | age < 18 |
<= | number | score <= 100 |
> | number | balance > 0 |
>= | number | age >= 18 |
in | enum, string | region in {CA, US, UK} |
not-in | enum, string | country not-in {IR, KP} |
Variable types
The Predicate Variables section in the left panel shows each predicate variable with a type badge. Click + to declare a type. Until you do, the badge can show UNTYPED. Available declarations include:
- number — numeric values and optional display bounds
- enum — a declared list of values
- string — text values
- UNTYPED — no type has been declared
These annotations describe value buckets in the Predicate Variables controls. Write required integer bounds in the expression itself.
Buckets
For a typed variable, Logic Studio generates buckets — mutually exclusive, collectively exhaustive value ranges that make each predicate constant. The Predicate Variables controls use buckets to describe values. The standard Truth Table still enumerates independent Boolean predicate columns.
For a numeric variable with predicates age < 18 and age >= 21, the buckets are:
age < 18—age < 18is true,age >= 21is falseage = 18— both false18 < age < 21— both falseage = 21—age >= 21is trueage > 21—age >= 21is true
Enum variables enumerate each value in the declared value list plus an "other" bucket.
Contradictions & subsumption
Two common integer-predicate relationships are:
- Contradiction:
age < 18ANDage >= 18— always false; the expression is unsatisfiable for that combination. - Subsumption:
age < 18ANDage < 21— the first implies the second; the conjunction equals the stricter predicate.
Use SMT/Z3 to check integer contradictions, or compare the original and reduced rules in Equiv Diff.
Limitations
SMT reasoning uses integer comparisons and integer-literal sets. String and enum predicates remain independent Boolean inputs. Decimal real-number reasoning is outside this model.
The standard Truth Table and QM simplifier use independent predicate columns. For a numeric relationship such as age < 18 and age >= 18, use SMT/Z3.