المنطق الشرطي

الضرورة والإمكانية والمنطق الزمني ودلالات كريبكي.

Modal logic symbols in LaTeX: box, diamond and Kripke semantics

The two core modal logic symbols in LaTeX are \Box for necessity (□) and \Diamond for possibility (◇), both from amssymb; \Box p reads it is necessary that p and \Diamond p it is possible that p. Kripke semantics uses \models (built in) or \Vdash, as in \mathcal{M}, w \models p, with an accessibility relation wRv. Epistemic logic writes knowledge as K_a p, and temporal logic adds \bigcirc p for next and p \mathbin{\mathcal{U}} q for until. The table lists the modal logic symbols people use most, with the package each one needs; the full list follows below.

Quick reference: modal, epistemic and temporal operators

SymbolCommandUsePackageCopy
□p\Box p
\Box pNecessarily pamssymb
◊p\Diamond p
\Diamond pPossibly pamssymb
□(p→q)\Box(p \to q)
\Box(p \to q)Necessity of an implication (axiom K)amssymb
¬□¬p\neg\Box\neg p
\neg\Box\neg pNot necessarily not p, same as \Diamond pamssymb
M,w⊨p\mathcal{M}, w \models p
\mathcal{M}, w \models pp is true at world wbuilt in
w⊩pw \Vdash p
w \Vdash pForcing, satisfactionamssymb
wRvwRv
wRvAccessibility relationbuilt in
KapK_a p
K_a pAgent a knows pbuilt in
BapB_a p
B_a pAgent a believes pbuilt in
CGpC_G p
C_G pCommon knowledge in group Gbuilt in
◯p\bigcirc p
\bigcirc pNext (temporal logic)built in
pUqp \mathbin{\mathcal{U}} q
p \mathbin{\mathcal{U}} qUntil (temporal logic)built in

Propositional connectives and quantifiers are on the logic symbols and quantifiers pages.

Frequently asked questions about modal logic in LaTeX

How do I write the box and diamond symbols in LaTeX?
Load \usepackage{amssymb} and write \Box p for necessity and \Diamond p for possibility. The latexsym package provides the same two commands. Note that the built-in \diamond is a small binary operator, not the modal diamond.
How do I write the models (double turnstile) symbol in LaTeX?
\models is built in and prints ⊨, as in $\mathcal{M}, w \models \varphi$. amssymb adds \vDash (⊨), \Vdash (⊩) for forcing and \nvDash for does not model; \vdash (⊢) for provability is built in.
How do I write until and next in temporal logic in LaTeX?
Use \bigcirc p for next, and wrap the calligraphic U as a binary operator for until: p \mathbin{\mathcal{U}} q, which gives the correct spacing. Always and eventually are usually \Box p and \Diamond p, or \mathbf{G} p and \mathbf{F} p.
□\Box
◊\Diamond

Possibly

\Diamond
¬□\neg\Box
¬◊\neg\Diamond

Not Possible

\neg\Diamond
□(p→q)\Box(p \to q)
◊(p∧q)\Diamond(p \land q)

Possible Conjunction

\Diamond(p \land q)
KapK_a p

Knows

K_a p
BapB_a p
CGpC_G p
□p\Box p
◊p\Diamond p
pUqp \mathcal{U} q

Until

p \mathcal{U} q
◯p\bigcirc p

Next

\bigcirc p
wRvw R v
M,w⊨p\mathcal{M}, w \models p

Kripke Model

\mathcal{M}, w \models p
OpO p