Link Search Menu Expand Document

Funcons-beta : Booleans.cbs | PRETTY | PDF


Booleans

[
  Datatype booleans      Alias bools
  Funcon   true
  Funcon   false
  Funcon   not
  Funcon   implies
  Funcon   and
  Funcon   or
  Funcon   exclusive-or  Alias xor
]
Datatype
  booleans ::= true | false
Alias
  bools = booleans
Funcon
  not(_:booleans) : =>booleans

not(B) is logical negation.

Rule
  not(false) ~> true
Rule
  not(true) ~> false
Funcon
  implies(_:booleans, _:booleans) : =>booleans

implies(B1, B2) is logical implication.

Rule
  implies(false, false) ~> true
Rule
  implies(false, true) ~> true
Rule
  implies(true, true) ~> true
Rule
  implies(true, false) ~> false
Funcon
  and(_:booleans*) : =>booleans

and(B, ...) is logical conjunction of any number of Boolean values.

Rule
  and( ) ~> true
Rule
  and(false, _*:booleans*) ~> false  
Rule
  and(true, B*:booleans*) ~> and(B*)
Funcon
  or(_:booleans*) : =>booleans

or(B, ...) is logical disjunction of any number of Boolean values.

Rule
  or( ) ~> false
Rule
  or(true, _*:booleans*) ~> true
Rule
  or(false, B*:booleans*) ~> or(B*)
Funcon
  exclusive-or(_:booleans, _:booleans) : =>booleans
Alias
  xor = exclusive-or

exclusive-or(B1, B2) is exclusive disjunction.