逻辑是一切思考的基础。

# Propositional logic(zeroth order logic)

Propositional logic does NOT deal with non-logical objects, predicates or quantifiers.

For example, the following simple axiom system is an instance of propositional logic:

L(A,Ω,Z,I)\mathcal{L}(A,\Omega,Z,I):

  • A={p,q,r,s,t,...}A=\{p,q,r,s,t,...\} serves to represent logic propositions.

  • Ω={¬,}\Omega=\{\neg,\rightarrow\} is the set of logic operators.

  • ZZ is the set of transformation rule. Here it contains only one rule named modus ponens:

    pq,pqp\rightarrow q,p\vdash q

  • II is the set of axioms. The axioms are all substitution instances of:

    p(qp)(p(qr))((pq)(pr))(¬p¬q)(qp)\begin{aligned} &\vdash p\rightarrow(q\rightarrow p)\\ &\vdash (p\rightarrow(q\rightarrow r))\rightarrow((p\rightarrow q)\rightarrow(p\rightarrow r))\\ &\vdash (\neg p\rightarrow\neg q)\rightarrow(q\rightarrow p) \end{aligned}

Example: the proof of ¬¬pp\neg\neg p\vdash p:

  • Lemma 1. pp\vdash p\rightarrow p.

    Proof.

    (1) By axiom 1, substitute qq with ppp\rightarrow p, we have

    p((pp)p)p\rightarrow((p\rightarrow p)\rightarrow p)

    (2) By axiom 2, substitute qq with ppp\rightarrow p and substitute rr with pp:

    (p((pp)p)((p(pp))(pp))(p\rightarrow((p\rightarrow p)\rightarrow p)\rightarrow((p\rightarrow(p\rightarrow p))\rightarrow (p\rightarrow p))

    (3) By Modus ponens and (1), (2):

    (p(pp))(pp)(p\rightarrow(p\rightarrow p))\rightarrow(p\rightarrow p)

    (4) By axiom 1, substitute qq with pp:

    p(pp)p\rightarrow(p\rightarrow p)

    (5) By Modus ponens and (3), (4):

    ppp\rightarrow p

  • Lemma 2. pq,qrprp\rightarrow q,q\rightarrow r\vdash p\rightarrow r.

    Proof.

    (1) pqp\rightarrow q premise

    (2) qrq\rightarrow r premise

    (3) By axiom 1,

    (qr)(p(qr))(q\rightarrow r)\rightarrow(p\rightarrow(q\rightarrow r))

    (4) By Modus ponens and (2), (3):

    p(qr)p\rightarrow (q\rightarrow r)

    (5) By axiom 2,

    (p(qr))((pq)(pr))(p\rightarrow(q\rightarrow r))\rightarrow((p\rightarrow q)\rightarrow(p\rightarrow r))

    (6) By Modus ponens and (4), (5):

    (pq)(pr)(p\rightarrow q)\rightarrow(p\rightarrow r)

    (7) By Modus ponens and (1), (6):

    prp\rightarrow r

  • Lemma 3. (qr)((pq)(pr))(q\rightarrow r)\rightarrow((p\rightarrow q)\rightarrow(p\rightarrow r)).

    Proof.

    (1) By axiom 1, substitute pp with (p(qr))((pq)(pr))(p\rightarrow (q\rightarrow r))\rightarrow ((p\rightarrow q)\rightarrow (p\rightarrow r)),

    ((p(qr))((pq)(pr)))([qr]((p(qr))((pq)(pr))))((p\rightarrow (q\rightarrow r))\rightarrow ((p\rightarrow q)\rightarrow (p\rightarrow r)))\rightarrow ([q\rightarrow r]\rightarrow ((p\rightarrow (q\rightarrow r))\rightarrow ((p\rightarrow q)\rightarrow (p\rightarrow r))))

    (2) By axiom 2,

    (p(qr))((pq)(pr))(p\rightarrow (q\rightarrow r))\rightarrow ((p\rightarrow q)\rightarrow (p\rightarrow r))

    (3) By Modus ponens and (1), (2),

    (qr)((p(qr))((pq)(pr)))(q\rightarrow r)\rightarrow ((p\rightarrow (q\rightarrow r))\rightarrow ((p\rightarrow q)\rightarrow (p\rightarrow r)))

    (4) By axiom 2,

    [(qr)((p(qr))((pq)(pr)))][(qr)(p(qr))((qr)((pq)(pr)))][(q\rightarrow r)\rightarrow ((p\rightarrow (q\rightarrow r))\rightarrow ((p\rightarrow q)\rightarrow (p\rightarrow r)))]\rightarrow[(q\rightarrow r)\rightarrow(p\rightarrow(q\rightarrow r))\rightarrow ((q\rightarrow r)\rightarrow ((p\rightarrow q)\rightarrow(p\rightarrow r)))]

    (5) By Modus ponens and (3) (4),

    [(qr)(p(qr))]((qr)((pq)(pr)))[(q\rightarrow r)\rightarrow (p\rightarrow(q\rightarrow r))]\rightarrow ((q\rightarrow r)\rightarrow((p\rightarrow q)\rightarrow(p\rightarrow r)))

    (6) By axiom 1,

    (qr)(p(qr))(q\rightarrow r)\rightarrow(p\rightarrow(q\rightarrow r))

    (7) By Modus ponens and (5), (6),

    (qr)((pq)(pr))(q\rightarrow r)\rightarrow((p\rightarrow q)\rightarrow(p\rightarrow r))

  • Lemma 4. p((pq)q)\vdash p\rightarrow((p\rightarrow q)\rightarrow q).

    Proof.

    (1) By axiom 3,

    ((pq)(pq))(((pq)p)((pq)q))((p\rightarrow q)\rightarrow(p\rightarrow q))\rightarrow(((p\rightarrow q)\rightarrow p)\rightarrow((p\rightarrow q)\rightarrow q))

    (2) By Lemma 1,

    (pq)(pq)(p\rightarrow q)\rightarrow(p\rightarrow q)

    (3) By Modus ponens and (1) (2),

    ((pq)p)((pq)q)((p\rightarrow q)\rightarrow p)\rightarrow((p\rightarrow q)\rightarrow q)

    (4) By Lemma 3,

    (((pq)p)((pq)q))((p((pq)p))(p((pq)q)))(((p\rightarrow q)\rightarrow p)\rightarrow((p\rightarrow q)\rightarrow q))\rightarrow ((p\rightarrow ((p\rightarrow q)\rightarrow p))\rightarrow (p\rightarrow ((p\rightarrow q)\rightarrow q)))

    (5) By Modus ponens and (3) (4),

    (p((pq)p))(p((pq)q))(p\rightarrow((p\rightarrow q)\rightarrow p))\rightarrow (p\rightarrow ((p\rightarrow q)\rightarrow q))

    (6) By axiom 1,

    p((pq)p)p\rightarrow ((p\rightarrow q)\rightarrow p)

    (7) By Modus ponens, (5) (6),

    p((pq)q)p\rightarrow((p\rightarrow q)\rightarrow q)

  • Proposition ¬¬pp\vdash \neg\neg p\rightarrow p.

    Proof.

    (1) By axiom 1, ϕ::=(r(st))\phi::=(r\rightarrow (s\rightarrow t)).

    (2) By axiom 3,

    (¬¬ϕ¬¬p)(¬p¬ϕ)(\neg\neg\phi\rightarrow \neg\neg p)\rightarrow(\neg p\rightarrow \neg \phi)

    (3) By axiom 3,

    (¬p¬ϕ)(ϕp)(\neg p\rightarrow\neg \phi)\rightarrow(\phi\rightarrow p)

    (4) By axiom 1,

    ¬¬p(¬¬ϕ¬¬p)\neg\neg p\rightarrow(\neg\neg\phi\rightarrow\neg\neg p)

    (5) By Modus ponens, (3)(4),

    ¬¬p(ϕp)\neg\neg p\rightarrow(\phi\rightarrow p)

    (6) By Lemma 4,

    ϕ((ϕp)p)\phi\rightarrow((\phi\rightarrow p)\rightarrow p)

    (7) By axiom 1,

    ϕ\phi

    (8) By Modus ponens, (6), (7),

    (ϕp)p(\phi\rightarrow p)\rightarrow p

    (9) By Lemma 2, (5), (8),

    ¬¬pp\neg\neg p\rightarrow p

\square.

# First-order logic

Consider such an example, there are two propositions:

  1. John is male.
  2. Mike is male.

In propositional logic, we could only to describe with two symbols, that is:

p=John is maleq=Mike is malep=\text{John is male}\\ q=\text{Mike is male}

But “is male” seems to be duplicated part, so we develop a new logic system with predicate and variables.

Let P(x)=x is maleP(x)=\text{x is male}, and the two propositions could be interpreted as P(John)P(\text{John}) and P(Mike)P(\text{Mike}).


First-order logic uses quantified variables over non-logical objects, and allows the use of sentences that contain variables, so that rather than propositions such as “Socrates is a man”, one can have expressions in the form “there exists x such that x is Socrates and x is a man”, where “there exists*”* is a quantifier, while x is a variable.[1] This distinguishes it from propositional logic, which does not use quantifiers or relations;[2] in this sense, propositional logic is the foundation of first-order logic.

For example, the following formula is a proposition of first order logic

xy(P(f(x)))¬(P(x)Q(f(x),x,z)))\forall x\forall y(P(f(x)))\rightarrow\neg(P(x)\rightarrow Q(f(x),x,z)))

# Second/Higher order logic

First-order logic can quantify over individuals, but not over properties. But in Higher order logic, the following proposition is legitimate:

xP(P(x))\forall x\forall P(P(x))

while it’s forbidden in first order logic to P\forall P since PP is a predicate.

In higher order logic, you could almost quantifier over any thing, that is

f,f\forall f,\exists f

where ff is a function, or predicate, or variables…

Edited on Views times