Syntax Guide
Comprehensive reference for Marina SAT Solver boolean formula syntax
BNF Grammar
Formal definition of valid formulas
<prop> ::= T (true)
| F (false)
| <atom> (variable)
| ~ <prop> (negation)
| <prop> & <prop> (conjunction)
| <prop> | <prop> (disjunction)
| <prop> -> <prop> (implication)
| <prop> <-> <prop> (equivalence)
| ( <prop> ) (parentheses)
<atom> ::= [a-z][a-z0-9_]* (lowercase letters, numbers, underscore)Operator Precedence
Variable Rules
ab1var_namex_123Avar-name1var_varOperators Reference
Logical conjunction - both operands must be true
a & btrue only if both a AND b are true
Logical disjunction - at least one operand must be true
a | btrue if a OR b (or both) are true
Logical negation - inverts the truth value
~atrue if a is false, false if a is true
Material implication - if a then b
a -> bfalse only if a is true and b is false
Logical equivalence - a if and only if b
a <-> btrue if a and b have the same truth value
Common Examples
Simple Expression
a & (b | c)a must be true AND (b OR c must be true)
Implication Chain
(a -> b) & (b -> c)If a then b, and if b then c
De Morgan's Law
~(a & b) <-> (~a | ~b)The negation of a conjunction is equivalent to the disjunction of negations
Distributive Law
a & (b | c) <-> (a & b) | (a & c)AND distributes over OR
Contradiction
a & ~aAlways false (unsatisfiable)
Tautology
a | ~aAlways true (valid)
Common Mistakes
Missing parentheses
Errora & b | c(a & b) | c or a & (b | c)Reason: Operator precedence is ambiguous without parentheses
Invalid variable names
ErrorA1 or var-namea1 or var_nameReason: Only lowercase, underscores, and numbers allowed
Missing operator
Errora ba & b or a | bReason: Need an operator between variables
Double negation error
Error~~a (if expecting a)aReason: Double negation cancels out (~ ~a is equivalent to a)
Quick Tips
- Always use parentheses for complex expressions
- Use T for true and F for false constants
- Variables must start with a lowercase letter
- White spaces are ignored during parsing
- Use the solver page to test your formulas