All tools

Tool

Logic Symbols & Translator

Every logic symbol in one place, a translator from plain sentences to logic, and a truth table builder.

Sentence → logic

Write a statement in plain English. Each simple statement becomes a letter, and words like and, or, not, if…then, unless, only if, all and some become symbols.

Try an example

Works best with one idea per clause. English can be ambiguous — if a result looks wrong, try rephrasing (for example “if A then B” instead of “B when A”).

In logic

—

ASCII
LaTeX
Code

Key

    Logic → English & truth table

    Type a formula with symbols or plain keys: ~ ! not, & && and, | || or, xor, -> =>, <-> <=> iff, nand nor, T F.

    Reads as

    Result

    Normalised
    Disjunctive normal form (DNF)
    Conjunctive normal form (CNF)
    LaTeX

    Truth table

    All logic symbols

    Meaning, how to read it, and how to type it in HTML, LaTeX and code.

    Comparison

    Relations between values.

    =

    Equal

    “is equal to”

    Both sides have the same value.

    x = 5

    Unicode
    U+003D
    HTML
    &equals;
    LaTeX
    =
    Code
    == / ===
    ≠

    Not equal

    “is not equal to”

    The two sides have different values.

    x ≠ 0

    Unicode
    U+2260
    HTML
    &ne;
    LaTeX
    \neq
    Code
    != / !==
    <

    Less than

    “is less than”

    The left side is strictly smaller.

    3 < 7

    Unicode
    U+003C
    HTML
    &lt;
    LaTeX
    <
    Code
    <
    >

    Greater than

    “is greater than”

    The left side is strictly larger.

    age > 18

    Unicode
    U+003E
    HTML
    &gt;
    LaTeX
    >
    Code
    >
    ≤

    Less than or equal

    “is at most”

    Smaller than, or equal to, the right side.

    x ≤ 10

    Unicode
    U+2264
    HTML
    &le;
    LaTeX
    \leq
    Code
    <=
    ≥

    Greater than or equal

    “is at least”

    Larger than, or equal to, the right side.

    age ≥ 18

    Unicode
    U+2265
    HTML
    &ge;
    LaTeX
    \geq
    Code
    >=
    ≈

    Approximately equal

    “is approximately”

    Close enough to be treated as equal.

    π ≈ 3.14

    Unicode
    U+2248
    HTML
    &asymp;
    LaTeX
    \approx
    Code
    Math.abs(a - b) < ε
    ≡

    Equivalent / identical

    “is equivalent to”

    Always has the same value (logical equivalence, or congruence in modular arithmetic).

    P ∨ Q ≡ Q ∨ P

    Unicode
    U+2261
    HTML
    &equiv;
    LaTeX
    \equiv
    Code
    —

    Connectives

    Combine statements into bigger statements (propositional logic).

    ¬

    Not (negation)

    “not P”

    True when P is false. Also written ~P or !P.

    ¬(x > 5)

    Unicode
    U+00AC
    HTML
    &not;
    LaTeX
    \neg
    Code
    !p / not p
    ∧

    And (conjunction)

    “P and Q”

    True only when both P and Q are true.

    P ∧ Q

    Unicode
    U+2227
    HTML
    &and;
    LaTeX
    \land
    Code
    && / and
    ∨

    Or (disjunction)

    “P or Q”

    True when at least one is true (inclusive or).

    P ∨ Q

    Unicode
    U+2228
    HTML
    &or;
    LaTeX
    \lor
    Code
    || / or
    ⊕

    Exclusive or (XOR)

    “either P or Q, not both”

    True when exactly one is true.

    P ⊕ Q

    Unicode
    U+2295
    HTML
    &oplus;
    LaTeX
    \oplus
    Code
    p !== q / p ^ q
    →

    Implies (conditional)

    “if P then Q”

    False only when P is true and Q is false.

    Rain → Wet

    Unicode
    U+2192
    HTML
    &rarr;
    LaTeX
    \to
    Code
    !p || q
    ↔

    If and only if

    “P if and only if Q”

    True when P and Q have the same truth value.

    P ↔ Q

    Unicode
    U+2194
    HTML
    &harr;
    LaTeX
    \leftrightarrow
    Code
    p === q
    ⇒

    Logically implies

    “P entails Q”

    Used between statements: whenever the left holds, the right must hold.

    x > 3 ⇒ x > 1

    Unicode
    U+21D2
    HTML
    &rArr;
    LaTeX
    \Rightarrow
    Code
    —
    ⇔

    Logically equivalent

    “P is equivalent to Q”

    Each statement implies the other.

    ¬¬P ⇔ P

    Unicode
    U+21D4
    HTML
    &hArr;
    LaTeX
    \Leftrightarrow
    Code
    —
    ↑

    NAND (Sheffer stroke)

    “not both P and Q”

    False only when both are true.

    P ↑ Q

    Unicode
    U+2191
    HTML
    &uarr;
    LaTeX
    \uparrow
    Code
    !(p && q)
    ↓

    NOR (Peirce arrow)

    “neither P nor Q”

    True only when both are false.

    P ↓ Q

    Unicode
    U+2193
    HTML
    &darr;
    LaTeX
    \downarrow
    Code
    !(p || q)
    ⊤

    True (tautology)

    “top / true”

    A statement that is always true.

    P ∨ ¬P ≡ ⊤

    Unicode
    U+22A4
    HTML
    &top;
    LaTeX
    \top
    Code
    true
    ⊥

    False (contradiction)

    “bottom / false”

    A statement that is always false.

    P ∧ ¬P ≡ ⊥

    Unicode
    U+22A5
    HTML
    &perp;
    LaTeX
    \bot
    Code
    false

    Quantifiers

    Talk about all or some things (predicate logic).

    ∀

    For all

    “for every x”

    The statement holds for every member of the domain.

    ∀x (Cat(x) → Mammal(x))

    Unicode
    U+2200
    HTML
    &forall;
    LaTeX
    \forall
    Code
    list.every(…)
    ∃

    There exists

    “there is at least one x”

    The statement holds for at least one member.

    ∃x (x > 5)

    Unicode
    U+2203
    HTML
    &exist;
    LaTeX
    \exists
    Code
    list.some(…)
    ∄

    There does not exist

    “there is no x”

    No member satisfies the statement.

    ∄x (x < 0)

    Unicode
    U+2204
    HTML
    &nexist;
    LaTeX
    \nexists
    Code
    !list.some(…)
    ∃!

    There exists exactly one

    “there is exactly one x”

    Exactly one member satisfies the statement.

    ∃!x (x + 2 = 5)

    Unicode
    U+2203 U+0021
    HTML
    &exist;!
    LaTeX
    \exists!
    Code
    list.filter(…).length === 1

    Sets

    Membership and operations on collections.

    ∈

    Element of

    “x is in A”

    x is a member of the set A.

    3 ∈ {1, 2, 3}

    Unicode
    U+2208
    HTML
    &isin;
    LaTeX
    \in
    Code
    A.has(x) / x in A
    ∉

    Not an element of

    “x is not in A”

    x is not a member of A.

    4 ∉ {1, 2, 3}

    Unicode
    U+2209
    HTML
    &notin;
    LaTeX
    \notin
    Code
    !A.has(x)
    ⊆

    Subset

    “A is a subset of B”

    Every member of A is also in B (A may equal B).

    {1} ⊆ {1, 2}

    Unicode
    U+2286
    HTML
    &sube;
    LaTeX
    \subseteq
    Code
    a <= b (Python sets)
    ⊂

    Proper subset

    “A is a proper subset of B”

    A ⊆ B and A ≠ B.

    {1} ⊂ {1, 2}

    Unicode
    U+2282
    HTML
    &sub;
    LaTeX
    \subset
    Code
    a < b (Python sets)
    ⊄

    Not a subset

    “A is not a subset of B”

    Some member of A is not in B.

    {3} ⊄ {1, 2}

    Unicode
    U+2284
    HTML
    &nsub;
    LaTeX
    \not\subset
    Code
    !(a <= b)
    ⊇

    Superset

    “A is a superset of B”

    A contains every member of B.

    {1, 2} ⊇ {2}

    Unicode
    U+2287
    HTML
    &supe;
    LaTeX
    \supseteq
    Code
    a >= b (Python sets)
    ∪

    Union

    “A union B”

    Everything in A, in B, or in both.

    {1} ∪ {2} = {1, 2}

    Unicode
    U+222A
    HTML
    &cup;
    LaTeX
    \cup
    Code
    a | b (Python sets)
    ∩

    Intersection

    “A intersect B”

    Only what is in both A and B.

    {1, 2} ∩ {2, 3} = {2}

    Unicode
    U+2229
    HTML
    &cap;
    LaTeX
    \cap
    Code
    a & b (Python sets)
    ∖

    Set difference

    “A minus B”

    What is in A but not in B.

    {1, 2} ∖ {2} = {1}

    Unicode
    U+2216
    HTML
    &setminus;
    LaTeX
    \setminus
    Code
    a - b (Python sets)
    ∅

    Empty set

    “the empty set”

    The set with no members.

    A ∩ ∅ = ∅

    Unicode
    U+2205
    HTML
    &empty;
    LaTeX
    \emptyset
    Code
    set() / new Set()
    ×

    Cartesian product

    “A cross B”

    All ordered pairs (a, b) with a in A and b in B.

    {1} × {x, y}

    Unicode
    U+00D7
    HTML
    &times;
    LaTeX
    \times
    Code
    itertools.product(a, b)
    𝒫

    Power set

    “the power set of A”

    The set of all subsets of A.

    𝒫({1}) = {∅, {1}}

    Unicode
    U+1D4AB
    HTML
    &Pscr;
    LaTeX
    \mathcal{P}
    Code
    —

    Proof & meta

    Reasoning about statements.

    ∴

    Therefore

    “therefore”

    Introduces a conclusion.

    P, P → Q ∴ Q

    Unicode
    U+2234
    HTML
    &there4;
    LaTeX
    \therefore
    Code
    —
    ∵

    Because

    “because”

    Introduces a reason.

    Q ∵ P

    Unicode
    U+2235
    HTML
    &because;
    LaTeX
    \because
    Code
    —
    ⊢

    Proves

    “P proves Q”

    Q can be derived from P using the rules of a proof system.

    P ∧ Q ⊢ P

    Unicode
    U+22A2
    HTML
    &vdash;
    LaTeX
    \vdash
    Code
    —
    ⊨

    Entails / models

    “P entails Q”

    Q is true in every case where P is true.

    P ⊨ P ∨ Q

    Unicode
    U+22A8
    HTML
    &vDash;
    LaTeX
    \models
    Code
    —
    ≔

    Is defined as

    “is defined as”

    The left side is defined to mean the right side.

    f(x) ≔ x²

    Unicode
    U+2254
    HTML
    &coloneq;
    LaTeX
    \coloneqq
    Code
    const f = …
    □

    Necessarily

    “necessarily P”

    Modal logic: P is true in every possible world.

    □P → P

    Unicode
    U+25A1
    HTML
    &#9633;
    LaTeX
    \Box
    Code
    —
    ◇

    Possibly

    “possibly P”

    Modal logic: P is true in some possible world.

    P → ◇P

    Unicode
    U+25C7
    HTML
    &#9671;
    LaTeX
    \Diamond
    Code
    —
    ∎

    End of proof (QED)

    “which was to be shown”

    Marks the end of a proof.

    … ∎

    Unicode
    U+220E
    HTML
    &#8718;
    LaTeX
    \blacksquare
    Code
    —

    Connective cheat sheet

    How each connective behaves for every combination of P and Q (T = true, F = false).

    P Q ¬P P ∧ Q P ∨ Q P ⊕ Q P → Q P ↔ Q P ↑ Q P ↓ Q
    T T F T T F T T F F
    T F F F T T F F T F
    F T T F T T T F T F
    F F T F F F T T T T

    Keep exploring

    More tools

    All tools →