Sheffer stroke

From MediaWiki
Jump to navigation Jump to search

Sheffer stroke

The Sheffer stroke (also called NAND) is a logical operation that returns true unless both propositions are true. It is functionally complete, meaning all other logical operations can be built from it.

Symbols

  • p ↑ q (mathematical notation)
  • p NAND q (common name)
  • NOT (p ∧ q) (definition)

Definition

The Sheffer stroke produces the negation of conjunction.

Truth Table

p q p ↑ q
T T F
T F T
F T T
F F T

Examples

  • If p = "The switch is on" and q = "The light is on",
 then p ↑ q = "It is not the case that the switch and the light are both on".
  • In digital logic, NAND gates are fundamental building blocks for circuits.
  • In Python: not (p and q)
  • In Java: !(p && q)