Rewrite rules for Booleans
Boolean expressions b can be composed oftrue false // Constants
!b // Negation
b && b // Conjunction
b || b // Disjunction
and of the usual comparison operations:
e <= e, e >= e, e < e, e > e, e == e, e != e
Here are reduction rules for Boolean expressions (e is an arbitrary
expression):
!true --> false
!false --> true
true && e --> e
false && e --> false
true || e --> true
false || e --> e
Note that && and || do not always need their right operand to be
evaluated.We say, these expressions use “short-circuit evaluation”.
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать