λ Tony's blog λ
The weblog of Tony Morris

It’s just logic

Posted on February 1, 2008, in Programming
*Don't do this*
**Do this**

conjunction (∧)

if(p) q else false

p && q

p ∧ q

conditional/implication (→)

if(p) q else true !p || q ¬p ∨ q

negation of conditional/implication

if(p) !q else false

p && !q

p ∧ ¬q

negation of conjunction

if(p) !q else true

!p || !q

¬p ∨ ¬q

disjunction (∨)

if(p) true else q p || q p ∨ q

negation of inverse conditional/implication

if(p) false else q !p && q ¬p ∧ q

inverse conditional/implication

if(p) true else !q p || !q p ∨ ¬q

negation of disjunction

if(p) false else !q !p && !q ¬p ∧ ¬q

if(p) true else false p

if(p) false else true !p