Skip to content

Instantly share code, notes, and snippets.

@sdiehl
Created November 21, 2010 17:57
Show Gist options
  • Save sdiehl/708960 to your computer and use it in GitHub Desktop.
Save sdiehl/708960 to your computer and use it in GitHub Desktop.
logic definitions
infixl (and) ∧;
infixl (or) ∨;
infixl (or) xor;
infixl (and) nand;
infixl (or) xnor;
infixl (or) iff;
infixl (or) implies;
infixl (or) ⊕;
infixl (or) →;
prefix (~) ¬;
def ¬ p = ~p;
def p ∧ q = p and q;
def p ∨ q = p or q;
// Definitions are in conjunctive normal form
def p xor q = ((~p) or (~q)) and (p or q);
def p xnor q = ((~p) or q) and (p or (~q));
def p iff q = p xnor q;
def p implies q = (~p) or q;
def p → q = p implies q;
def p nand q = (~p) or (~q);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment