IMPLIES
Logical implication operator. "A IMPLIES B" is TRUE unless A is TRUE and B is FALSE.
Syntax
expression1 IMPLIES expression2
expression1 => expression2
Truth Table
| A | B | A IMPLIES B |
|---|---|---|
| TRUE | TRUE | TRUE |
| TRUE | FALSE | FALSE |
| FALSE | TRUE | TRUE |
| FALSE | FALSE | TRUE |
Semantics
A IMPLIES B is logically equivalent to NOT A OR B.
In legal terms: "If A, then B" - the rule is violated only when A is true but B is false.
Examples
Example file:
-- IMPLIES keyword examples
-- Basic IMPLIES Operations
#EVAL TRUE IMPLIES TRUE
#EVAL TRUE IMPLIES FALSE
#EVAL FALSE IMPLIES TRUE
#EVAL FALSE IMPLIES FALSE
-- Symbolic Alternative (=>)
#EVAL TRUE => TRUE
#EVAL TRUE => FALSE
#EVAL FALSE => TRUE
-- Equivalence to NOT A OR B
GIVEN a IS A BOOLEAN
b IS A BOOLEAN
-- These are logically equivalent
impliesVersion a b MEANS a IMPLIES b
orVersion a b MEANS NOT a OR b
-- Test equivalence
#EVAL impliesVersion TRUE TRUE
#EVAL orVersion TRUE TRUE
#EVAL impliesVersion TRUE FALSE
#EVAL orVersion TRUE FALSE
#EVAL impliesVersion FALSE TRUE
#EVAL orVersion FALSE TRUE
-- Legal Rule Examples
-- "If you are an employee, you must have a badge"
ASSUME isEmployee IS A BOOLEAN
ASSUME hasBadge IS A BOOLEAN
DECIDE badgeRule IS isEmployee IMPLIES hasBadge
#CHECK badgeRule
-- "A minor must have parental consent"
ASSUME personAge IS A NUMBER
ASSUME hasParentalConsent IS A BOOLEAN
DECIDE consentRule IS (personAge < 18) IMPLIES hasParentalConsent
#CHECK consentRule
-- Chained Implications
-- Implication is right-associative: A => B => C means A => (B => C)
GIVEN x IS A BOOLEAN
y IS A BOOLEAN
z IS A BOOLEAN
chainedImpl x y z MEANS x => y => z
#EVAL chainedImpl TRUE TRUE TRUE
#EVAL chainedImpl TRUE TRUE FALSE
#EVAL chainedImpl FALSE FALSE FALSE
-- Combined with AND/OR
GIVEN p IS A BOOLEAN
q IS A BOOLEAN
r IS A BOOLEAN
-- "(P AND Q) implies R"
conjunctionImplies p q r MEANS (p AND q) IMPLIES r
-- "P implies (Q OR R)"
impliesDisjunction p q r MEANS p IMPLIES (q OR r)
#EVAL conjunctionImplies TRUE TRUE TRUE
#EVAL conjunctionImplies TRUE TRUE FALSE
#EVAL impliesDisjunction TRUE FALSE TRUE
#EVAL impliesDisjunction TRUE FALSE FALSE
Basic Usage
#EVAL TRUE IMPLIES TRUE -- TRUE
#EVAL TRUE IMPLIES FALSE -- FALSE
#EVAL FALSE IMPLIES TRUE -- TRUE
#EVAL FALSE IMPLIES FALSE -- TRUE
Symbolic Alternative
#EVAL TRUE => TRUE -- TRUE
#EVAL TRUE => FALSE -- FALSE
Legal Rule Example
GIVEN isEmployee IS A BOOLEAN
GIVEN hasBadge IS A BOOLEAN
-- "If you are an employee, you must have a badge"
DECIDE badgeRule IS isEmployee IMPLIES hasBadge
Chaining Implications
-- A => B => C means A => (B => C)
DECIDE chainedImpl IS TRUE => (TRUE => FALSE)
Use in Legal Logic
Implication is common in legal rules:
-- "A minor must have parental consent"
GIVEN age IS A NUMBER
GIVEN hasParentalConsent IS A BOOLEAN
DECIDE consentRule IS (age < 18) IMPLIES hasParentalConsent
Related Keywords
See Also
- Logical Operators - All logical operators