CS245 course notes: https://www.student.cs.uwaterloo.ca/~cs245/CS245-Lecture-Notes.pdf

Table of Contents

lec 1. 9.10

definition. a proposition is a statement that is either true or false.

definition. a compound proposition is formed by means of logical connectives.

definition.

unary connective

binary connectives

definition. propositional language LpL^p

definition. atom(Lp)\textrm{atom}(L^p) is the set of expressions of LpL^p consisting of a proposition symbol only.

definition.(well-formed propositional formula) an expression of LpL^p is a member of form(Lp)\textrm{form}(L^p) iff:

eg. pp is a prop. variable, then which of p,(,¬p, (, \neg can appear in a well-formed formula?

lec 3.

definition. given a set YXY\subseteq X and set PP of operations (functions from Xn1XX^{n\geq1}\rightarrow X), YY is closed under PP if for every fPf\in P, say ff is an nn-ary function and every y1,...,ynYy_1,...,y_n\in Y we have f(y1,...,yn)Yf(y_1,...,y_n)\in Y.

definition. YY is a minimal set with respect to a property RR if YY satisfies RR, and for every set Y0Y_0 that satisfies R,YY0R,Y\subseteq Y_0.

definition. I(X,A,P)I(X,A,P) is the minimal subset of XX that contains AA and is closed under the operations in PP.

eg. the natural numbers.

X={R},A={0}P={f(x)=x+1}N={X,A,P}X=\{\mathbb{R}\}^* \,, A=\{0\} \\ P=\{f(x)=x+1\} \\ \mathbb{N} = \{X,A,P\}

definition. Given X,A,PX,A,P and an element xXx\in X, a generation sequence from xx is α1,α2,...αm\alpha_1,\alpha_2,...\alpha_m from XX such that αn=x\alpha_n=x and for every imi\leq m αi\alpha_i is either in AA or is the result of applying some fPf\in P to some αj,αj\alpha_j,\alpha_{j'} such that j,j<ij,j' < i.

eg. let X={a,b},A={aa,aba},P={xxx,x,yxy}X=\{a,b\}^*,A=\{aa,aba\},P=\{\frac{x}{xx}, \frac{x,y}{xy}\}. we have α1=aa,α2=aba\alpha_1=aa,\alpha_2=aba and then α3=aaaba\alpha_3=aaaba (applied from α1,α2\alpha_1,\alpha_2), ......

technique. to show a property RR holds for every element of a set inductively defined:

natural induction structural induction
domain N\mathbb{N} I(X,A,P)I(X,A,P)
basis n=0n=0 every member of AA
step assume holds for nn, show n+1n+1 for every fPf\in P, assume all inputs for ff hold, show outputs hold
conclusion property holds for all nn property holds for all members in I(X,A,P)I(X,A,P)

propositions

X={finite sequences of symbols}A={English letters}P={¬,,    }X=\{\textrm{finite sequences of symbols}\}^* \\ A=\{\textrm{English letters}\} \\ P=\{\neg,\land,\lor\implies\}

claim.(1) pppp is not a legal proposition.
interpret. we have property RR and propositions are I=(X,A,P)I=(X,A,P).
proof. base: show the property holds for for all members of AA. This is clear since every member of AA is a single letter.
inductive step: for every operation fPf\in \mathcal{P} and every x,yXx,y\in X, if RR holds for XX and yy then RR holds for f(x,y)f(x,y). Here P={x(¬x),x,y(xy),x,yxy,x,y(xy)}P=\{\frac{x}{(\neg x)},\frac{x,y}{(x\land y)},\frac{x,y}{x\lor y},\frac{x,y}{(x\rightarrow y)}\} we have no repeating two letters. \square

property.(2) every proposition is either an atomic proposition or it starts with "((" or ends with "))".
proof. trivial structural induction \square

property.(3) the number of left brackets in a proposition is always equal to the number of right brackets in the proposition.
proof. base: if xAx\in A, then op(x)=0,cl(x)=0\mathrm{op}(x)=0,\mathrm{cl}(x)=0 hence equal.
inductive: Assume x,yx,y satisfy this property. Want to show so do they for four operations.
Then op((¬x))=op(x)+1,cl((¬x))=cl(x)+1\mathrm{op}((\neg x))=\mathrm{op}(x)+1,\mathrm{cl}((\neg x))=\mathrm{cl}(x)+1, given that op(x)=cl(x)\mathrm{op}(x)=\mathrm{cl}(x) by inductive hypothesis we have equality. For op((xy))=op(x)+op(y)+1\mathrm{op}((x\rightarrow y))=\mathrm{op}(x)+\mathrm{op}(y)+1 and cl((xy))=cl(x)+cl(y)+1\mathrm{cl}((x\rightarrow y))=\mathrm{cl}(x)+\mathrm{cl}(y)+1. Invoke inductive hypothesis for op(x)=cl(x),op(y)=cl(y)\mathrm{op}(x)=\mathrm{cl}(x),\mathrm{op}(y)=\mathrm{cl}(y) we have equality. Same argument applies to other two. \square

definition. given any sequence x=α1α2...αnx=\alpha_1\alpha_2...\alpha_n a proper initial segment of xx is any sequence α1...αk\alpha_1...\alpha_k for k<nk<n.
property.(4) every non empty proper initial segment of a proposition has more left bracket than right brackets.
proof. base: there is no proper initial segments hence the property holds vacuously.
inductive: Assume the property holds for xx we want to show it holds for four operations. do permutations. \square

tut 2. 9.13

eg. let φ\varphi be a well-formed formula of propositional logic. let mφm_\varphi be the number of propositional variables in φ\varphi. let nφn_\varphi be the number of occurrences of binary connections in φ\varphi (which are ,,,    \land,\lor,\rightarrow,\iff), show that mφ=nφ+1m_\varphi=n_\varphi+1.
proof. we define this property as R(φ)R(\varphi).
base: let φ=p\varphi=p for some propositional variable pp, hence mφ=1m_\varphi=1 and nφ=0n_\varphi=0. Hence R(φ)R(\varphi) holds.
inductive: assume we have mα=nα+1m_\alpha=n_\alpha+1 (a) let φ=(¬α)\varphi=(\neg \alpha) for some well-formed formula α\alpha. Then mφ=mα=nα+1=nφ+1m_\varphi=m_\alpha=n_\alpha+1=n_\varphi+1. (b) let φ=αβ\varphi=\alpha * \beta for some well-formed formulas α,β\alpha,\beta and a binary connective *. Then mφ=mα+mβ=(nα+1)+(nβ+1)=(nα+1+nβ)+1=nφ+1m_\varphi=m_\alpha+m_\beta=(n_\alpha+1)+(n_\beta+1)=(n_\alpha+1+n_\beta)+1=n_\varphi+1. By the principle of structural induction we showed that R(φ)R(\varphi) holds for all well-formed propositional formula. \square

lec 4. 9.17

theorem.(unique readability) for every proposition α\alpha exactly one of the following holds:

  1. α\alpha is a propositional variable.
  2. α\alpha is (¬β)(\neg \beta) for some proposition β\beta.
  3. α\alpha is βγ\beta * \gamma for some propositions β,γ\beta,\gamma where * is one of ,,\lor,\land,\rightarrow.

Furthermore, these β,γ\beta,\gamma are uniquely determined.

proof. by counting brackets in α\alpha.
if there are no brackets, then it falls in option 1 and α\alpha is a propositional variable.
If α\alpha starts with a left bracket: If this next symbol is ¬\neg then α=(¬β)\alpha=(\neg \beta) and the rest of α\alpha is β)\beta)
otherwise starting counting r and l brackets from left to right and stop when the counts are equal for the first time. by property 3 at this point we finished scanning β\beta and the next symbol should be a connective followed by γ\gamma. eg.

(p(qr))\sout{(}p\rightarrow (q\land r))

here stop at pp as this time we have zero left/right brackets, and followed with a binary connective then followed by another proposition. \square

eg. parse ((p(¬q))((¬a)(bc)))((p\rightarrow(\neg q))\lor((\neg a)\land(b\rightarrow c)))
img

eg. draw a parse tree of ((pq)((¬p)    (qr)))((p\lor q)\rightarrow ((\neg p)\iff(q\land r))) using def'n of well-formed prop. formulas.
img

eg. draw a tree for (((¬p)q)(p(q(¬r)))(((\neg p)\lor q)\rightarrow(p\land (q \lor (\neg r)))
img

definition. a parse tree for a formula α\alpha is a finite tree with formulas written on its nodes. α\alpha is its root and the formula βi\beta_i at every leaf is a propositional formula.

remark. the unique readability theorem tells the parse tree is unique.

theorem. a sequence of symbols in X has a parse tree iff it is a proposition.
proof. if α\alpha is a proposition then it has a parse tree by definition. if α\alpha is a parse tree then by definition α\alpha is a member of I(X,A,P)I(X,A,P) since going from the leaves to the root every formula is either a prop. variable or generated by applying operations in PP to its children that are propositions. \square

remark. we define an order of precedence among ¬,,,    \neg,\land,\lor\rightarrow,\iff and use brackets only if we want to violate this order.

definition. precedence rules:

eg.

lec 5. 9.19

definition. a truth valuation tt is a function from propositional variables to {0,1}\{0,1\}:

t:P{0,1}t:P\rightarrow\{0,1\}

where PP denotes the set of available prop. variables.

definition. ptp^t denotes the value of pp under tt.

remark. pq¬pqp\rightarrow q\equiv\neg p \lor q

theorem. the truth value AtA^t for a given well-formed formula under truth valuation tt is uniquely determined.
proof. let tt be any truth valuation and AA any well-formed formula.
base: let AA be atomic, then At=t(A)A^t=t(A). as t(A)t(A) is uniquely determined, so is AtA^t.
step: let AA be some well-formed non-atomic formula. by uniquely readability theorem, we have that the precedences of AA and the connectives are uniquely determined. hence we have only one of the following situations:

  1. A=(¬B)A=(\neg B) for some uniquely determined well-formed formula BB. invoking inductive hypothesis we have the truth value of BB is uniquely determined. but AtA^t is given by At=1 if Bt=0 else 0A^t=1\text{ if } B^t=0\text{ else } 0 so the truth value AtA^t is uniquely determined.
  2. A=(BC)A=(B*C) for some uniquely determined well-formed formula B,CB,C and a binary connective {,,,    }*\in \{\land,\lor,\rightarrow,\iff\}. Invoking IH we have Bt,CtB^t,C^t are uniquely determined in their truth values. but as * is uniquely determined (...) and so the truth value of (BC)t(B*C)^t is uniquely determined.

by induction, all AtA^t is uniquely determined. \square

eg. evaluate ((AB)(A(¬B)))t((A\lor B)\rightarrow(A\land(\neg B)))^t under:

t:{A,B}{0,1}t:\{A,B\}\rightarrow\{0,1\}

t(A)=1,t(B)=0t(A)=1,t(B)=0

then (AB)=1(A\lor B)=1, (¬B)=1(\neg B)=1, (A(¬B))=1(A\land(\neg B))=1, original=11.

definition. a formula AA is satisfiable if there exists a truth valuation tt such that t(A)=1t(A)=1.

definition. a formula AA is tautology (valid formula) if for all truth valuations tt we have t(A)=1t(A)=1.

definition. a formula AA is unsatisfiable (contradiction) if for all truth valuations tt we have t(A)=0t(A)=0.

eg. (AB)(BA)(A\rightarrow B)\lor(B\rightarrow A) is tautology.

AA BB ABA\rightarrow B BAB\rightarrow A (AB)(BA)(A\rightarrow B)\lor(B\rightarrow A)
1 1 1 1 1
1 0 0 1 1
0 1 1 0 1
0 0 1 1 1

eg. AA is a contradiction iff ¬A\neg A is a tautology.
proof. let tt be a truth valuation. (1) let AA be a contradiction, we know that At=0A^t=0 so (¬A)t=1(\neg A)^t=1 by definition. hence (¬A)t=1(\neg A)^t=1 holds for all truth variables so ¬A\neg A is a tautology. (2) let ¬A\neg A be a tautology. we know that (¬A)t=1(\neg A)^t=1 then by definition we have At=0A^t=0 for all truth variables and so AA is a contradiction. \square

remark.

  1. satisfiable is the negation of contradiction.
  2. tautology is not the negation of contradiction.
  3. every tautology is satisfiable.

tut 3. 9.20

eg. show A=(pq)((pr)(rp))A=(p\rightarrow q)\lor((p\rightarrow r)\lor(r\rightarrow p)) is a tautology. (method 2)
proof.

lec 6. 9.24

remark. AA is a tautology iff ¬A\neg A is a contradiction.
remark. AA is satisfiable iff AA is not a contradiction iff ¬A\neg A is not a tautology.

eg. application
code for chip design -> a propositional formula AA specifications -> a propositional formula B3B_3. is A¬B3A\land \neg B_3 satisfiable?
is there an 'efficient' algorithm for checking satisfiability?

tautological consequences

definition. we write AA tautologically implies BB, ABA\models B, if for every truth assignment tt we have At=1Bt=1A^t=1\rightarrow B^t=1.
eg.

claim & exer.

  1. ABA\models B iff ABA\rightarrow B is a tautology.
  2. ABA\nvDash B iff A¬BA\land \neg B is satisfiable.
  3. if A,BA,B are tautologies, then ABA\land B is a tautology.
  4. if A,BA,B are satisfiable, then ABA\land B is satisfiable?
  5. if ABA\land B is a tautology, then AA is a tautology?

definition. let Σ\Sigma denote a set of propositions. ΣA\Sigma \models A if every truth assignment tt for which Bt=1B^t=1 for all BΣB\in\Sigma, it also gives At=1A^t=1 (if tt makes members of Σ\Sigma be 1, then it also makes AA 1).

eg. Σ={p1p2,p2p3,...,pmpm+1,...:mN}\Sigma=\{p_1\rightarrow p_2,p_2\rightarrow p_3,...,p_m\rightarrow p_{m+1},...:m\in \mathbb{N}\}, does Σ(p4p24)\Sigma\models(p_4\rightarrow p_{24})?
note (p4p24)t=0(p_4\rightarrow p_{24})^t=0 iff p4t=1,p24t=0p_4^t=1,p_{24}^t=0. if for every pmΣp_m\in\Sigma, pmt=1p_m^t=1, then
(p4p5)t=1(p_4\rightarrow p_5)^t=1 so p5t=1p_5^t=1
(p5p6)t=1(p_5\rightarrow p_6)^t=1 so p6t=1p_6^t=1
(p23p24)t=1(p_{23}\rightarrow p_{24})^t=1 so p24t=1p_{24}^t=1
a contradiction, so this is true.

definition. Σ\Sigma is satisfiable if there exists tt such that for all BΣB\in\Sigma we have Bt=1B^t=1.

eg. is Σ={p1¬p2,p2¬p3,...,pm¬pm+1,...:mN}\Sigma=\{p_1\leftrightarrow\neg p_2,p_2\leftrightarrow\neg p_3,...,p_m\leftrightarrow\neg p_{m+1},...:m\in \mathbb{N}\} satisfiable?
no.

definition. Σ1Σ2\Sigma_1\models\Sigma_2 if whenever tt is such that every AΣ1,At=1A\in\Sigma_1,A^t=1, then for every BΣ2,Bt=1B\in\Sigma_2,B^t=1 (ie every tt that satisfies members of Σ1\Sigma_1 also satisfies members of Σ2\Sigma_2).

eg. Σ1={p1,p1p2}\Sigma_1=\{p_1,p_1\rightarrow p_2\}, Σ2={p2}\Sigma_2=\{p_2\}
see first row

p1p_1 p2p_2 p1p2p_1\rightarrow p_2
1 1 1
1 0 0
0 1 1
0 0 1

lec 7. 9.26

eg. is Σ={p1¬p2,p2¬p3,p3¬p4}\Sigma=\{p_1\rightarrow\neg p_2,p_2\rightarrow\neg p_3,p_3\rightarrow\neg p_4\} satisfiable?
yes. put p1t=p2t=p3t=0p_1^t=p_2^t=p_3^t=0 or p1t=p3t=1,p2t=p4t=0p_1^t=p_3^t=1,p_2^t=p_4^t=0.

eg. is Σ={p1,¬p2,p1p2}\Sigma=\{p_1,\neg p_2,p_1\rightarrow p_2\} satisfiable?
no. can't find a row with all 1's for these three:

p1p_1 p2p_2 ¬p2\neg p_2 p1p2p_1\rightarrow p_2
1 1 0 1
1 0 1 0
0 1 0 1
0 0 1 1

claim.

  1. if Σ\Sigma ia not satisfiable then for every proposition formula AA we have ΣA\Sigma\models A vacuously.
  2. Σ\Sigma is satisfied by every truth assignment, let AA be a propositional formula, then ΣA\Sigma\models A iff AA is a tautology.

claim.

  1. if Σ2Σ1\Sigma_2\subseteq\Sigma_1, then Σ1Σ2\Sigma_1\models\Sigma_2.
  2. if Σ1Σ2\Sigma_1\models\Sigma_2 then, for every AA, if Σ2A\Sigma_2\models A then Σ1A\Sigma_1\models A.

eg. let Σ1={p1p2}\Sigma_1=\{p_1\rightarrow p_2\}, and {A:Σ1A}={p1p2,p1p2p2,p1p1,...}\{A:\Sigma_1\models A\}=\{p_1\rightarrow p_2,p_1\rightarrow p_2\land p_2,p_1\rightarrow p_1,...\}

eg. assume Σ1Σ2\Sigma_1\models\Sigma_2, which is true?

  1. if Σ1\Sigma_1 satisfiable then so is Σ2\Sigma_2. (true, by definition)
  2. if Σ1\Sigma_1 satisfiable then so is Σ2\Sigma_2. (false)

corollary.(monotonicity of logic) let Σ1Σ2\Sigma_1\subseteq\Sigma_2, if Σ1A\Sigma_1\models A then Σ2A\Sigma_2\models A.

eg. for any wWw\in\mathbb{W} and sSs\in\mathbb{S} pick a propositional variable pwsp_{ws}. given a truth assignment tt

pw1,s1p_{w_1,s_1} pw1,s2p_{w_1,s_2} pw2,s1p_{w_2,s_1} ...
1 0 1

give a map f(w)=sf(w)=s iff pwst=1p_{ws}^t=1, else nothing. find functions Σ\Sigma satisfying ff's requirements

Σfuncs={pw,s1pw,s2:s1,s2S,wW}\Sigma_{\text{funcs}}=\{p_{w,s_1}\rightarrow p_{w,s_2}:s_1,s_2\in\mathbb{S},w\in\mathbb{W}\} Σbijections={pw1,s¬pw2,s:w1,w2W,sS}\Sigma_{\text{bijections}}=\{p_{w_1,s}\rightarrow \neg p_{w_2,s}:w_1,w_2\in\mathbb{W},s\in\mathbb{S}\}
take ΣfuncsΣbijections\Sigma_{\text{funcs}}\cup\Sigma_{\text{bijections}}.

propositional logic only cares about the truth value of the assignment.
on the positive side, and connective whose truth is fully determined by the truth values of its components can be expressed in propositional logic.

tut 3. 9.27

eg. let P={pn:nN}P=\{p_n:n\in\mathbb{N}\} be a finite set of prop. variables. are they satisfiable?

  1. Σ0={pnpn+1:nN}\Sigma_0=\{p_n\rightarrow p_{n+1}:n\in\mathbb{N}\}
  2. Σ1={pn¬pn+1:nN}\Sigma_1=\{p_n\rightarrow\neg p_{n+1}:n\in\mathbb{N}\}
  3. Σ2=Σ0Σ1\Sigma_2=\Sigma_0\cup\Sigma_1
  4. Σ3=P\Sigma_3=P
  5. Σ4=Σ1Σ3\Sigma_4=\Sigma_1\cup\Sigma_3

Ans:

  1. true. let t0:P{0,1}t_0:P\rightarrow\{0,1\} with t0(pn)=0nNt_0(p_n)=0\,\forall n\in\mathbb{N}, then Σ0t=1\Sigma_0^t=1 since every element in Σ0\Sigma_0 has the form pnpn+1p_n\rightarrow p_{n+1} while pnt=0p_n^t=0.
  2. true. use the above t0t_0.
  3. true. still use the same t0t_0.
  4. true. let t3:P{0,1}t_3:P\rightarrow\{0,1\} with t3(pn)=1nNt_3(p_n)=1\,\forall n\in\mathbb{N}
  5. false. assume Σ4\Sigma_4 is satisfiable, then we must have Σ3t=1\Sigma_3^t=1 and then pn=1nNp_n=1\,\forall n\in\mathbb{N}. now consider pn¬pn+1Σ1p_n\rightarrow\neg p_{n+1}\in\Sigma_1 then this cannot be true.

eg. prove or disprove the tautological consequence.

  1. {AB,BC}AC\{A\rightarrow B,B\rightarrow C\}\models A\rightarrow C
  2. {(A¬B)C,B¬C,AC}¬A(BC)\{(A\rightarrow\neg B)\lor C,B\land\neg C,A\leftrightarrow C\}\models \neg A\land(B\rightarrow C)

Ans:

  1. true. let tt be any truth valuation such that {AB,BC}t=1\{A\rightarrow B,B\rightarrow C\}^t=1.
    case 1. t(A)=1t(A)=1: since (AB)t=1(A\rightarrow B)^t=1 we know Bt=1B^t=1. since (BC)t=1(B\rightarrow C)^t=1 we know Ct=1C^t=1 and so (AC)t=1(A\rightarrow C)^t=1.
    case 2. t(A)=0t(A)=0: then (AC)t=1(A\rightarrow C)^t=1 by the definition of \rightarrow.
  2. false. first look at B¬CB\land\neg C to decide Bt,CtB^t,C^t, we can then decide AtA^t from iff.
    let At=Ct=0,Bt=1A^t=C^t=0,B^t=1.

lec 8. 10.1

proofs: verify the validity of arguments

definition. proofs satisfy

  1. soundness: if AA has a proof, then AA is a "true statement", ΣAΣA\Sigma\vdash A\rightarrow\Sigma\models A.
  2. given an object that claims to be a proof, one can verify it.
  3. completeness: if AA is a true statement, then AA can be proved. ΣAΣA\Sigma\models A\rightarrow\Sigma\vdash A.

eg. propositional proof for propositional logic:
A proof of a proposition AA will be a truth table for AA that has 1 in every row.

definition. proof system for propositional logic: let

  1. core set (axioms)
  2. operation (deduction rules)

then A\vdash A iff AI(propositions, axioms, rules)=I(X,A,P)A\in I(\text{propositions, axioms, rules})=I(X,A,P).

a formal proof of AA will be a sequence of propositions B1,B2,...BnB_1,B_2,...B_n for every imi\leq m, BiB_i is either in AA or the result of applying operations from PP to previous B1,...,Bi1B_1,...,B_{i-1}.

axioms. axioms of proof system for propositional logic

I. A(BA)A\rightarrow(B\rightarrow A)
II. [A(BC)][(AB)(AC)][A\rightarrow(B\rightarrow C)]\rightarrow [(A\rightarrow B)\rightarrow(A\rightarrow C)]
III. (¬\neg) (¬AB)[(¬A¬B)A](\neg A\rightarrow B)\rightarrow [(\neg A\rightarrow\neg B)\rightarrow A]
IV. (\land) (AB)A,(AB)B(A\land B)\rightarrow A, (A\land B)\rightarrow B
V. (\land) A(BAB)A\rightarrow(B\rightarrow A\land B)
VI. (\lor) A(AB),B(AB)A\rightarrow (A\lor B), B\rightarrow (A\lor B)
VII. (\lor) (AC)[(BC)(ABC)](A\rightarrow C)\rightarrow[(B\rightarrow C)\rightarrow(A\lor B\rightarrow C)]

rule. (modus ponens) P={A,ABB}P=\{\frac{A,A\rightarrow B}{B}\} (if we have AA true, ABA\rightarrow B true, then BB true)

eg. (AA)\vdash(A\rightarrow A)
proof.

1. A((AA)A)A\rightarrow((A\rightarrow A)\rightarrow A) by Ax1
2. [A((AA)A)][(A(AA))(AA)][A\rightarrow((A\rightarrow A)\rightarrow A)]\rightarrow[(A\rightarrow(A\rightarrow A))\rightarrow(A\rightarrow A)] by Ax2
3. (A(AA))(AA)(A\rightarrow(A\rightarrow A))\rightarrow(A\rightarrow A) by MP to l1, 2
4. A(AA)A\rightarrow(A\rightarrow A) by Ax1
5. AAA\rightarrow A by MP to l3, 4

definition. (proof from assumptions) ΣA\Sigma\vdash A if AI(axioms A,M,P)A\in I(\text{axioms }\cup A,M,P)

eg. {¬¬A}A\{\neg\neg A\}\vdash A
proof.

1. ¬A¬A\neg A\rightarrow\neg A by last eg
2. ¬¬A(¬A¬¬A)\neg\neg A\rightarrow(\neg A\rightarrow\neg\neg A) by Ax1
3. ¬¬A\neg\neg A by assumption
4. ¬A¬¬A\neg A\rightarrow\neg\neg A by MP to l2, 3
5. (¬A¬A)[(¬A¬¬A)A](\neg A\rightarrow\neg A)\rightarrow[(\neg A\rightarrow\neg\neg A)\rightarrow A] by Ax3
6. ¬A¬¬AA\neg A\rightarrow\neg\neg A\rightarrow A by MP to l1, 5
7. AA by MP to l4, 6

theorem. (deduction) for every Σ\Sigma and every A,BA,B, we have Σ(AB)\Sigma\vdash(A\rightarrow B) iff Σ{A}B\Sigma\cup \{A\}\vdash B.
proof. forward:

1. Σ\Sigma assumption
2. ABA\rightarrow B assumption
3. AA assumption
4. BB by MP to l2, 3

backward: pass

eg. to show {AB,BC}(AC)\{A\rightarrow B,B\rightarrow C\}\vdash(A\rightarrow C), it suffices to show {AB,BC,A}C\{A\rightarrow B,B\rightarrow C,A\}\vdash C.
proof.

1. AA assumption
2. ABA\rightarrow B assumption
3. BB MP to l1, 2
4. BCB\rightarrow C assumption
5. CC MP to l3, 4

eg. show (¬A¬B)(BA)\vdash(\neg A\rightarrow\neg B)\rightarrow(B\rightarrow A).
proof. by the deduction, it suffices to show {¬A¬B,B}A\{\neg A\rightarrow\neg B,B\}\vdash A.

1. ¬A¬B\neg A\rightarrow \neg B assumption
2. B(¬AB)B\rightarrow(\neg A\rightarrow B) Ax1
3. BB assumption
4. ¬AB\neg A\rightarrow B MP to l2, 3
5. (¬AB)[(¬A¬B)A](\neg A\rightarrow B)\rightarrow[(\neg A\rightarrow\neg B)\rightarrow A] Ax3
6. (¬A¬B)A(\neg A\rightarrow\neg B)\rightarrow A MP to l4, 5
7. AA MP to l1, 6

lec 9. 10.3

eg. is [(p¬q)((¬pq)p)][(p\rightarrow\neg q)\rightarrow((\neg p\rightarrow q)\rightarrow p)] an axiom?
no. comparing with Ax3 the parse trees are different (not symbol-by-symbol).

remark \vdash is formal proof (syntax), \models is tautologically implies (semantics).

theorem. (soundness) for every proposition AA and every set of propositions Σ\Sigma, if ΣA\Sigma\vdash A then ΣA\Sigma\models A.
remark. same as AI(axiomsΣ,{MP})ΣAA\in I(\text{axioms}\cup\Sigma,\{\text{MP}\})\rightarrow \Sigma\models A.
proof.
base: (i) AA is an axiom. check that every axiom is a tautology, so every Σ\Sigma implies every tautology:

  1. by contradiction, if A(BA)A\rightarrow(B\rightarrow A) gives 00, then AA gives 11, BAB\rightarrow A gives 00. now BB must be 11 and AA must be 00.
  2. by contradiction, if [A(BC)][(AB)(AC)][A\rightarrow(B\rightarrow C)]\rightarrow [(A\rightarrow B)\rightarrow(A\rightarrow C)] gives 00, then A(BC)A\rightarrow(B\rightarrow C) gives 11 and (AB)(AC)(A\rightarrow B)\rightarrow(A\rightarrow C) gives 00. then ABA\rightarrow B gives 11 and ACA\rightarrow C gives 00. then AA gives 11, CC gives 00. substitute BB by either 11 or 00 to axiom we get contradiction.
  3. ...

(ii) if AΣA\in\Sigma. by the definition of ΣA\Sigma\models A, every tt satisfying Σ\Sigma should satisfy AA since AΣA\in\Sigma.

inductive: (under MP) we assume ΣA\Sigma\models A and Σ(AB)\Sigma\models(A\rightarrow B), we want to show ΣB\Sigma\models B. let tt satisfy Σ\Sigma, need to show Bt=1B^t=1. by IH, At=1,(AB)t=1A^t=1, (A\rightarrow B)^t=1, then by truth table Bt=1B^t=1. \square

corollary. for every prop. variable pp, p\nvdash p (pp can't be proved).
proof. assume that p\vdash p, then by soundness, p\models p. but prop. variable can't be tautology since it can be either 11 or 00. \square

prop. Σ:={p1p2,p2p3,...,pmpm+1,...:mN}p3\Sigma:=\{p_1\rightarrow p_2,p_2\rightarrow p_3,...,p_m\rightarrow p_{m+1},...:m\in\mathbb{N}\}\nvdash p_3.
proof. assume Σp3\Sigma\vdash p_3 then by soundness Σp3\Sigma\models p_3. counter example: all pnp_n has (pn)t=0(p_n)^t=0. \square

remark.

syntax semantics
A\vdash A AA is tautology \rightarrow soundness
ΣA\Sigma\vdash A ΣA\Sigma\models A \rightarrow soundness
A:ΣA\exists A:\Sigma\nvdash A
(consistent)
Σ\Sigma satisfiable \leftarrow

prop. for every satisfiable Σ\Sigma there exists a proposition AA such that ΣA\Sigma\nvdash A.
proof. let tt be a truth valuation that satisfies Σ\Sigma. consider p1tp_1^t such that if p1t=1p_1^t=1 then Σ¬p1\Sigma\nvdash\neg p_1 and if p1t=0p_1^t=0 then Σp1\Sigma\nvdash p_1. by soundness Σ¬p1\Sigma\vdash\neg p_1 implies (¬p1)t=1(\neg p_1)^t=1, Σp1\Sigma\vdash p_1 implies pt=1p^t=1. a contradiction.
alternate proof. consider a contradiction AA, since Σ\Sigma is satisfiable, we have ΣA\Sigma\nvDash A, by soundness ΣA\Sigma\nvdash A. \square

tut 4. 10.4

another definition of formal proofs

redef. deduction rules in formal proofs

if then
1. axiom (\in) AΣA\in\Sigma ΣA\Sigma\vdash A
2. (ref) AAA\vdash A
3. (++) ΣA\Sigma\vdash A Σ,ΣA\Sigma,\Sigma'\vdash A
4. (¬\neg -) Σ,¬AB\Sigma,\neg A\vdash B
Σ,¬A¬B\Sigma,\neg A\vdash \neg B
ΣA\Sigma\vdash A
5. (¬+\neg +) Σ,AB\Sigma,A\vdash B
Σ,A¬B\Sigma,A\vdash \neg B
Σ¬A\Sigma\vdash\neg A reductio ad absurdum (RAA)
6. (\rightarrow -) ΣAB\Sigma\vdash A\rightarrow B
ΣA\Sigma\vdash A
ΣB\Sigma\vdash B
7. (+\rightarrow+) Σ,AB\Sigma,A\vdash B ΣAB\Sigma\vdash A\rightarrow B
8. (\land-) ΣAB\Sigma\vdash A\land B ΣA\Sigma\vdash A
ΣB\Sigma\vdash B
9. (+\land+) ΣA\Sigma \vdash A
ΣB\Sigma\vdash B
ΣAB\Sigma\vdash A\land B
10. (\lor-) Σ,AC\Sigma,A\vdash C
Σ,BC\Sigma,B\vdash C
Σ,ABC\Sigma,A\lor B\vdash C
11. (+\lor+) ΣA\Sigma\vdash A ΣAB\Sigma\vdash A\lor B
ΣBA\Sigma\vdash B\lor A
12. (\leftrightarrow-) ΣAB\Sigma\vdash A\leftrightarrow B
ΣA\Sigma\vdash A
ΣB\Sigma\vdash B
13. (\leftrightarrow-) ΣAB\Sigma\vdash A\leftrightarrow B
ΣB\Sigma\vdash B
ΣA\Sigma\vdash A
14. (+\leftrightarrow+) Σ,AB\Sigma,A\vdash B
Σ,BA\Sigma,B\vdash A
ΣAB\Sigma\vdash A\leftrightarrow B

eg. show pq,¬pqp\lor q,\neg p\vdash q.

1. ¬p,p,¬q¬p\neg p,p,\neg q\vdash \neg p by ()(\in)
2. ¬p,p,¬qp\neg p,p,\neg q\vdash p by ()(\in)
3. p,¬pqp,\neg p\vdash q by (¬)(\neg -) to l1, 2
4. q,¬pqq,\neg p\vdash q by ()(\in)
5. pq,¬pqp\lor q,\neg p\vdash q by ()(\lor -) to l3, 4

eg. show ¬p¬qqp\neg p\rightarrow\neg q \vdash q\rightarrow p.

1. ¬p¬q,q,¬p¬p\neg p\rightarrow\neg q,q,\neg p\vdash \neg p by (\in)
2. ¬p¬q,q,¬pq\neg p\rightarrow\neg q,q,\neg p\vdash q by (\in)
3. ¬p¬q,q,¬p¬p¬q\neg p\rightarrow\neg q,q,\neg p\vdash \neg p\rightarrow\neg q by (\in)
4. ¬p¬q,q,¬p¬q\neg p\rightarrow\neg q,q,\neg p\vdash \neg q by (\rightarrow-) to l1, 3
5. ¬p¬q,qp\neg p\rightarrow \neg q,q\vdash p by (¬\neg-) to l2, 4
6. ¬p¬qqp\neg p\rightarrow\neg q\vdash q\rightarrow p by (+\rightarrow+) to l5

eg. show there is no deduction {pq,sr}pr\{p\lor q,s\rightarrow r\}\vdash p\land r.
by soundness Σϕ\Sigma\vdash\phi implies Σϕ\Sigma\models\phi, and hence Σϕ\Sigma\nvDash\phi implies Σϕ\Sigma\nvdash\phi. it is thus sufficient to find a valuation tt such that {pq,sr}pr\{p\lor q,s\rightarrow r\}\nvDash p\land r.
let pt=0,qt=1,st=1,tt=1.p^t=0,q^t=1,s^t=1,t^t=1.

lec 10. 10.8

definition. a set of proposition Σ\Sigma is consistent if we have one of

  1. for every AA, ΣA\Sigma\vdash A implies Σ¬A\Sigma\nvdash \neg A.
  2. there exists some AA such that ΣA\Sigma\nvdash A.

prop. above two definitions are equivalent.

proof. (\rightarrow) suppose def'n 2 fails, then for every AA we have ΣA\Sigma\vdash A. in particular, we have both ΣA,Σ¬A\Sigma\vdash A,\Sigma\vdash\neg A, failing def'n 1.

(\leftarrow) suppose def'n 1 fails. then let AA be such that ΣA,Σ¬A\Sigma\vdash A,\Sigma\vdash\neg A, and let BB be any proposition.

... ...
a. AA
b. ¬A\neg A
1. (¬BA)[(¬B¬A)B](\neg B\rightarrow A)\rightarrow[(\neg B\rightarrow\neg A)\rightarrow B] Ax3
2. A(¬BA)A\rightarrow(\neg B\rightarrow A) Ax1
3. ¬A(¬B¬A)\neg A\rightarrow(\neg B\rightarrow\neg A) Ax2
4. ¬BA\neg B\rightarrow A MP to la, 2
5. ¬B¬A\neg B\rightarrow\neg A MP to lb, 3
6. (¬B¬A)B(\neg B\rightarrow\neg A)\rightarrow B MP to l1, 4
7. BB MP to l5, 6

hence for any BB we also have ΣB\Sigma\vdash B, failing def'n 2. \square

corollary. every satisfiable Σ\Sigma is consistent.
proof. we showed that Σ\Sigma satisfiable implies there exists AA such that ΣA\Sigma\nvdash A. \square

remark. (ΣA    ΣA(\Sigma\vdash A\implies\Sigma\vDash A)    (Σ)\implies(\Sigma satisfiable     \implies Σ\Sigma consistent))

corollary. (Σ(\Sigma satisfiable     \implies Σ\Sigma consistent)    ()\implies(ΣA    ΣA)\Sigma\vdash A\implies\Sigma\vDash A)
proof. assume for some AA we have ΣA\Sigma\vdash A but ΣA\Sigma\nvDash A, implying for some truth valuation tt such that tt satisfies Σ\Sigma but At=0A^t=0. therefore tt satisfies Π:=Σ{¬A}\Pi:=\Sigma\cup\{\neg A\} so Π\Pi is satisfiable. so if satisfiable implies consistent, we get Π\Pi is consistent.
On the other hand, Π¬A\Pi\vdash \neg A due to inclusion, Π=Σ{¬A}A\Pi=\Sigma\cup\{\neg A\}\vdash A by assumption, this contradicts the definition of consistent. \square

theorem. (completeness) for every Σ\Sigma and AA, if ΣA\Sigma\vDash A then ΣA\Sigma\vdash A.
remark. every tautology has a formal proof by completeness.

definition. Σ\Sigma is maximally consistent if Σ\Sigma is consistent and for every AA, ΣA\Sigma\nvdash A implies Σ{A}\Sigma\cup\{A\} is not consistent.
remark. reached up to the limit so everything is implied or negatively implied.

prop. Σ\Sigma is maximally consistent iff for every AA, we have ΣA\Sigma\vdash A xor Σ¬A\Sigma\vdash\neg A.

remark.

syntax semantics
Σ\Sigma consistent     \iff Σ\Sigma satisfiable
ΣA\Sigma\vdash A     \iff ΣA\Sigma\vDash A

proof of completeness.
we claim if every consistent Σ\Sigma is satisfiable then completeness holds. we assume consistent implies satisfiable. we have some Σ,A\Sigma,A such that ΣA\Sigma\vDash A, want to show ΣA\Sigma\vdash A.
proceed by contradiction, assume that ΣA\Sigma\vDash A but ΣA\Sigma\nvdash A. (exer.) then Π:=Σ{¬A}A\Pi:=\Sigma\cup\{\neg A\}\vdash A hence Π\Pi is consistent by defn2, a contradiction.

We have done proving completeness after these 2 claims:

  1. for every consistent Σ\Sigma there exists a maximally consistent ΣΣ\Sigma'\supseteq\Sigma.
  2. if Σ\Sigma' is maximally consistent then the truth valuation tΣt_{\Sigma'} defined by (for every prop. variable pp, pt=1p^t=1 iff Σp\Sigma'\vdash p) satisfies every propositions in Σ\Sigma.

lec 11. 10.10

theorem. for every consistent Σ\Sigma there exists a maximally consistent ΣΣ\Sigma'\supseteq\Sigma.
proof. let all propositional formulas A1,A2,...,Am,...A_1,A_2,...,A_m,.... construct a set Σm,mN,ΣmΣm+1,Σ0=Σ\Sigma_m,m\in\mathbb{N},\Sigma_m\subseteq\Sigma_{m+1},\Sigma_0=\Sigma. assume we have defined Σm\Sigma_m, we define Σm+1\Sigma_{m+1} by

Σm+1={Σm,ΣmAmΣm{¬An},ΣmAm\Sigma_{m+1}=\left\{\begin{matrix} \Sigma_m, &\Sigma_m\vdash A_m\\ \Sigma_m\cup\{\neg A_n\}, & \Sigma_m\nvdash A_m \end{matrix}\right.

then we claim 1. each Σm\Sigma_m is consistent 2. Σ=mΣm\Sigma'=\bigcup_m\Sigma_m is maximally consistent.

  1. by induction on mm, we show that each Σm\Sigma_m is consistent.
    base: we already have Σ0=Σ\Sigma_0=\Sigma is consistent.
    inductive: assume Σm\Sigma_m is consistent, show Σm+1\Sigma_{m+1}. if Σm+1=Σm\Sigma_{m+1}=\Sigma_m then we are done. otherwise we will get Σm+1Am,Σm+1=Σm{¬An}\Sigma_{m+1}\nvdash A_m,\Sigma_{m+1}=\Sigma_m\cup\{\neg A_n\}.
    lemma. for every AA and every Σ\Sigma, if ΣA\Sigma\nvdash A then Σ{¬A}A\Sigma\cup\{\neg A\}\nvdash A. in other words Σ{¬A}A\Sigma\cup\{\neg A\}\vdash A implies ΣA\Sigma\vdash A. proof is exercise.
    we hence get Σm+1\Sigma_{m+1} is consistent by lemma.

  2. first for every AA we have either ΣA\Sigma'\vdash A or Σ¬A\Sigma'\vdash\neg A, then we show it never produces both. given AA, then it must belong to the list A1,...,Am,...A_1,...,A_m,.... say A=AkA=A_k, then Σk+1A\Sigma_{k+1}\vdash A or Σk+1¬A\Sigma_{k+1}\vdash\neg A, and Σk+1Σ\Sigma_{k+1}\subseteq\Sigma'. because each formal proof is finite:
    B1B2...Bm=AB_1B_2...B_m=A
    B1B2...Bl=¬AB'_1B'_2...B'_l=\neg A
    each of these BiB_i's are from some Σm\Sigma_m. pick Σm\Sigma_m such that all these proof steps are from Σm\Sigma_m, then ΣmA,Σm¬A\Sigma_m\vdash A,\Sigma_m\vdash\neg A and so Σm\Sigma_m is not consistent, a contradiction to claim 1. hence it can't produce both. \square

theorem. given one maximally consistent Σ\Sigma', define a truth assignment tΣt_{\Sigma'} by:

pi:pitΣ=1    Σp\forall p_i:\quad p_i^{t_{\Sigma'}}=1 \iff \Sigma'\vdash p

then for every proposition AA, ΣA\Sigma'\vdash A iff AtΣ=1A^{t_{\Sigma'}}=1.
proof. use structural induction.
base: for a variable AA, this is done by definition of tΣt_{\Sigma'}.
inductive: assume for every proposition A,BA,B we have ΣA\Sigma'\vdash A iff ttΣ=1t^{t_{\Sigma'}}=1, ΣB\Sigma'\vdash B iff BtΣ=1B^{t_{\Sigma'}}=1. we want to show this is the case after operations.
case 1: if Σ¬A\Sigma'\vdash\neg A, then because Σ\Sigma' is consistent, we have ΣA\Sigma'\nvdash A, so by IH we get AtΣ=0A^{t_{\Sigma'}}=0 so (¬A)tΣ=1(\neg A)^{t_{\Sigma'}}=1. if Σ¬A\Sigma\nvdash\neg A, then ΣA\Sigma'\vdash A since Σ\Sigma' is maximally consistent. so by IH we get AtΣ=1A^{t_{\Sigma'}}=1 so (¬A)tΣ=0(\neg A)^{t_{\Sigma'}}=0.
case 2: if ΣAB\Sigma'\vdash A\land B, ...

tut 5. 10.11

eg. let Σ1,Σ2\Sigma_1,\Sigma_2 be sets of pro. formulas such that Σ1Σ2\Sigma_1\subseteq\Sigma_2 and AA be a prop. formula such that Σ1A\Sigma_1\nvDash A, does it follow that Σ2A\Sigma_2\nvDash A?
no. consider Σ2=Σ1{A},Σ1={pq},A=p\Sigma_2=\Sigma_1\cup\{A\},\Sigma_1=\{p\rightarrow q\}, A=p.

eg. define

coseqΣ={A:ΣA}\text{coseq}_\Sigma=\{A:\Sigma\vdash A\}

is it true that Σ\Sigma is consistent iff coseqΣ\text{coseq}_\Sigma is consistent?
true. assume coseqΣ\text{coseq}_\Sigma is consistent, then Σ\Sigma is consistent. assume coseqΣ\text{coseq}_\Sigma is not consistent. then take any BB we have coseqΣB\text{coseq}_\Sigma\vdash B, hence there is a finite set {C1,...,Cn}conseqΣ\{C_1,...,C_n\}\subseteq\text{conseq}_\Sigma such that {C1,...,Cn}B\{C_1,...,C_n\}\vdash B, since for any CiC_i we have ΣCi\Sigma\vdash C_i by transitivity we have ΣB\Sigma\vdash B and so Σ\Sigma is not consistent.

eg. determine soundness, completeness of following proof system: all rules in FD plus this new rule:

ΣA    Σ¬A(¬+)\Sigma\vdash A\implies\Sigma\vdash\neg A \quad(\neg+*)

this is not sound. we need to show there exist Σ,B\Sigma,B such that ΣB\Sigma\vdash B but ΣB\Sigma\nvDash B. ie there exist such a valuation tt that Σt=1,Bt=0\Sigma^t=1,B^t=0. let Σ={p},B=¬p\Sigma=\{p\},B=\neg p, then

1. ppp\vdash p (\in)
2. p¬pp\vdash \neg p (¬+\neg+*) to 1

is a valid proof. but clearly Σ={p}¬p\Sigma=\{p\}\nvDash\neg p.
this is complete because it is a superset of FD, which is complete.

eg. determine soundness, completeness of following proof system: (+),(),()(\land+),(\land-),(\rightarrow-) from FD.
this is sound because this is is a subset of FD, which is sound.
this is not complete.

lec 12. 10.22

predicate logic

eg.

  1. yx(R(x,y))    xy(R(x,y))\exists y\forall x (R(x,y))\implies\forall x\exists y(R(x,y)) is true
  2. xy(R(x,y))    yx(R(x,y))\forall x \exists y (R(x,y))\implies\exists y\forall x (R(x,y)) is false

definition. logical characters appear in every language in predicate logic: (,),¬,,,,,,x,y,...(,),\neg,\rightarrow,\land,\lor,\forall,\exists,x,y,...
definition. variables: x,y,x0,...x,y,x_0,...

definition. vocabulary are characters depending on language
definition. equality: \approx
definition. constant symbols: a,b,c,a0,...a,b,c,a_0,...
definition. relation symbols: R(),M(),...R(),M(),... (given arity)
definition. function symbols: F,G,...F,G,... (given arity)

definition. (define pred. language) given predicate vocabulary

a,b,...,F1,F2,...,R1,R2,...\langle a,b,...,F_1,F_2,...,R_1,R_2,...\rangle

step 1: define the set of objects 'terms':
step 2: define the set of formulas

terms=I(X,A,P)\text{terms}=I(X,A,P)

A=variables, constant symbolsA=\text{variables, constant symbols}

P=application of function symbolsP=\text{application of function symbols}

x,y,zx,y,z (variables) are terms in any predicate language.

eg. empty vocabulary: there no more terms

eg. vocabulary of natural numbers:

terms: x,y,z,...,a,b,F(a,b),F(x,a),F(x,b),G(a,b)...x,y,z,...,a,b,F(a,b),F(x,a),F(x,b),G(a,b)...

definition. atomic formulas are variables, constants, or that generated by using function symbols

remark.

eg. 3x+2y3x+2y is a term, 3x2y3x\approx 2y is a formula (either true of false)

eg. formulas in the empty language: xyx\approx y, xy(xy)\forall x\forall y(x\approx y), (xy)(yz)(x\approx y)\land(y\approx z), ...

eg. formulas in natural number language: xy(R(x,y)¬R(y,z))\forall x\forall y(R(x,y)\rightarrow\neg R(y,z)), ...

eg. a parse tree

img

eg. a language for sets

lec 13. 10.24

syntax semantics
defining words wff defining truth values

eg. a language with two-place function symbols F,GF,G, a relation symbol RR.

img

remark. terms denote objects. formulas denote statements

remark. function symbols composable, relation symbols not

definition. a valuation vv for a given language consists of three components

  1. the domain of the objects DvD^v
  2. meaning for every symbol in the vocabulary Fv,Rv,av,...F^v,R^v,a^v,...
  3. assignment to variables xv,yv,...x^v,y^v,...

eg. for natural number language L={F(),G(),R(),a,b}L=\{F(),G(),R(),a,b\}:

under vv, Fv=+,Gv=,Rv=<,av=0,bv=1,Dv=NF^v=+,G^v=\cdot,R^v=<,a^v=0,b^v=1,D^v=\mathbb{N}:
then [xyz(F(x,z)y)]v=0[\forall x\forall y\exists z(F(x,z)\approx y)]^v=0 (for every two nats x,y there exists nat z such that x+z=y, false).

under tt, Ft=+,Gt=,Rt=<,at=0,bt=1,Dt=ZF^t=+,G^t=\cdot,R^t=<,a^t=0,b^t=1,D^t=\mathbb{Z}:
then [xyz(F(x,z)y)]t=1[\forall x\forall y\exists z(F(x,z)\approx y)]^t=1.

definition. precisely defining the truth value of a formula α\alpha under a valuation vv.

  1. for every term tt, define its meaning under vv, tvt^v.
    recall terms = I(vars, consts, funcs).
    base step: xv,avx^v,a^v are defined by vv
    inductive: for every func symbols FF, F(t1,t2)v=Fv(t1v,t2v)F(t_1,t_2)^v=F^v(t_1^v,t_2^v)
  2. define truth values for formulas
    recall formulas = I(atomic formulas, ¬, &, |, →, ∀, ∃)
    base step: [t1t2]v=1 if t1v=t2v else 0[t_1\approx t_2]^v=1 \text{ if }t_1^v=t_2^v \text{ else } 0, [R(t1,t2)]v=1 if Rv(t1v,t2v) else 0[R(t_1,t_2)]^v=1 \text{ if }R^v(t_1^v,t_2^v) \text{ else } 0
    inductive: knowing if αv,βv\alpha^v,\beta^v are 11 or 00, use truth table of ¬,,,\neg,\land,\lor,\rightarrow over αv,βv\alpha^v,\beta^v

tut 6. 10.25

eg. let

  1. only one student speaks German
    (x(G(x)(y((x≉y)¬G(y)))))(\exists x(G(x)\land(\forall y((x\not\approx y)\rightarrow\neg G(y)))))
  2. not all students speak German
    (¬(xG(x)))(\neg(\forall xG(x))) or (x(¬G(x)))(\exists x(\neg G(x)))
  3. some students use Python
    (x(A(x)))(\exists x(A(x))) or (¬(x(¬A(x))))(\neg(\forall x(\neg A(x))))
    plural?: (x(y((x≉y)A(x))A(y)))(\exists x(\exists y((x\not\approx y)\land A(x))\land A(y)))
  4. if a student speaks German then they use Python
    (x(G(x)A(x)))(\forall x(G(x)\rightarrow A(x)))

eg. let AA be a value for the formula F(f(u),w)F(f(u),w). determine AvA^v.

  1. vv is defined by D=N,uv=2,wv=5,fv=double,Fv=<D=\mathbb{N},u^v=2,w^v=5,f^v=\text{double},F^v=<
    F(f(u),w)v=Fv(fv(uv),wv)=Fv(4,5)=(4<5)=1F(f(u),w)^v=F^v(f^v(u^v),w^v)=F^v(4,5)=(4<5)=1

prop. let tt be any wff, let vv be any valuation with domain DD, then tvDt^v\in D.

lec 14. 10.29

about defining (xα)v(\forall x\alpha)^v and (xα)v(\exists x\alpha)^v?
notation. with a variable xx, and wDvw\in D^v, define

v(xw)(y)=v(y) if yx else wv(\frac{x}{w})(y)=v(y)\text{ if } y\ne x \text{ else } w

eg.

x1x_1 x2x_2 x3x_3 ...
5 2 7 ...
v(x3/5)v(x_3/5) 5 2 5 ...

then we can define:

definition. α\alpha is a logical truth (valid) if for every valuation vv we have αv=1\alpha^v=1.

if AA is a propositional tautology and α\alpha is obtained by substituting a formula for every propositional variable in AA, then α\alpha is a logical truth.

eg. a logical truth: (xyR(x,y))¬(xyR(x,y))(\forall x\exists y R(x,y))\lor\neg(\forall x\exists y R(x,y))

eg. 'if all men are mortal, and socrates are men, then socrates are mortal.'

x(H(x)M(x))H(a)M(a)\forall x(H(x)\rightarrow M(x))\land H(a)\rightarrow M(a) is a logical truth.
it suffices to show if M(a)v=0M(a)^v=0 then (x(H(x)M(x))H(a))v=0(\forall x(H(x)\rightarrow M(x))\land H(a))^v=0. consider any vv, if M(a)v=0M(a)^v=0 then the 'and' must be false. so only consider case when M(a)v=1M(a)^v=1. then can ensure (x(H(x)M(x)))v(\forall x(H(x)\rightarrow M(x)))^v is 0. it is to show (H(x)M(x))v(a/x)(H(x)\rightarrow M(x))^{v(a/x)} is 0.

eg. let AA be x(F(x)G(x))\exists x(F(x)\rightarrow G(x)), D={a,b}\mathcal{D}=\{a,b\}. create vv such that Av=1A^v=1.
define vv to select Fv={a},Gv={a,b}F^v=\{a\},G^v=\{a,b\}. then we have (F(u)G(u))v(u/a)=1(F(u)\rightarrow G(u))^{v(u/a)}=1 so Av=1A^v=1.

lec 15. 10.31

eg. in a language with relation symbol PP,

consider x(P(x)xP(x))\exists x(P(x)\rightarrow\forall xP(x)) is a logical truth

case 1: there is an element wDvw\in D^v s.t. P(w)v=0P(w)^v=0. consider (P(x)xP(x))v(x/w)(P(x)\rightarrow\forall xP(x))^{v(x/w)}, substituting ww in then P(x)P(x) is false, so implication is true.

case 2: for all wDvw\in D^v we have P(w)v=1P(w)^v=1, substitute ww in now (P(x))v(x/w)=1(P(x))^{v(x/w)}=1 and so (P(x)xP(x))v(x/w)=1(P(x)\rightarrow\forall xP(x))^{v(x/w)}=1.

when we apply a quantifier x\forall x (or x\exists x), its range are all the tree (free, not yet quantified) members of α\alpha.
eg. in x(P(x)xP(x))\exists x(P(x)\rightarrow\forall xP(x)), the first x\exists x does not bound the later xP(x)\forall xP(x).

definition. α\alpha is satisfiable if for some vv we have αv=1\alpha^v=1.

definition. Σ\Sigma is satisfiable if for some vv for avery αΣ\alpha\in\Sigma we have αv=1\alpha^v=1.

definition. α\alpha is a contradiction if it is not satisfiable.

eg. P(x)xP(x)P(x)\rightarrow\forall xP(x) is satisfiable but not a logical truth.
let tt be such that Dv={7},Pv={7},xv=7D^v=\{7\},P^v=\{7\},x^v=7. then (P(x)xP(x))v11=1(P(x)\rightarrow\forall xP(x))^v\Rightarrow1\rightarrow 1=1.
let vv be such that Dv={7,10},Pv={7},xv=7D^v=\{7,10\},P^v=\{7\},x^v=7. then (P(x)xP(x))v10=0(P(x)\rightarrow\forall xP(x))^v\Rightarrow1\rightarrow 0=0.

a valuation verifies 3 things:

  1. our domain DvD^v (range of \forall, \exists)
  2. meaning of the special symbols of the language (like Rv,Pv,F(,),av,...R^v,P^v,F(,),a^v,...)
  3. variables (like xv=7,...x^v=7,...)

definition. (definablity) given a set of formulas Σ\Sigma in some language L=(P1,...,Pn,F1,...,Fm,a1,...,ak)L=(P_1,...,P_n,F_1,...,F_m,a_1,...,a_k), Σ\Sigma defines the set of all structures (P1v,...,Pnv,F1v,...,Fmv,a1v,...,akv)(P_1^v,...,P_n^v,F_1^v,...,F_m^v,a_1^v,...,a_k^v) in which αv=1\alpha^v=1 for every αΣ\alpha\in\Sigma.
eg. L=(F()),Σ={xy¬(xy)¬F(x)F(y)}L=(F()),\Sigma=\{\forall x\forall y\neg(x\approx y)\leftrightarrow \neg F(x)\approx F(y)\} defines all vv in which FF is one-to-one.

tut 7. 11.1

eg. show A=xF(x)xF(x)A=\forall x F(x)\rightarrow\exists xF(x) is valid
if xF(x)\forall x F(x) is false, then 0...0\rightarrow ... is true
if xF(x)\forall x F(x) is true, then F(x)v(x/a)=1F(x)^{v(x/a)}=1 for all aDa\in D, so F(x)v(x/a)=1F(x)^{v(x/a)}=1 for some aDa\in D by \exists-satisfaction rule. then 111\rightarrow 1 is true.

eg. show A=(xyF(x,y)zF(z,z))A=(\forall x\forall y F(x,y)\rightarrow\exists z F(z,z)) is valid
if (xyF(x,y))v=0(\forall x\forall y F(x,y))^v=0, then implication is true by \rightarrow-satisfaction.
if xyF(x,y)v=1\forall x\forall y F(x,y)^v=1, then yF(x,y)v(x/a)=1\forall y F(x,y)^{v(x/a)}=1 for all aDa\in D by \forall-satisfaction.
then F(x,y)v(x/a)(y/b)F(x,y)^{v(x/a)(y/b)} for all a,bDa,b\in D by \forall-satisfaction.
in particular, for a fixed aDa\in D we have F(x,y)v(x/a)(y/a)=1F(x,y)^{v(x/a)(y/a)}=1 by \exists-satisfaction.
note xv(x/a)(y/a),yv(x/a)(y/a)Fv(x/a)(y/a)\langle x^{v(x/a)(y/a)},y^{v(x/a)(y/a)}\rangle\in F^{v(x/a)(y/a)}, implying a,aFv\lang a,a\rangle\in F^v. note that Fv(x/a)(y/a)=FvF^{v(x/a)(y/a)}=F^v as remapping only affects free variables, not relation symbols. so 111\rightarrow 1 true by \rightarrow-satisfaction.

eg. show A=x(F(x)G(x,a)G(x,b))A=\forall x(F(x)\land G(x,a)\rightarrow G(x,b)) is satisfiable but not valid.
satisfy: DD arbitrary domain, Fv=F^v=\varnothing.
does not satisfy: D={0,1},av=0,bv=1,Fv=D,Gv={(0,0),(1,0)}D=\{0,1\},a^v=0,b^v=1,F^v=D,G^v=\{(0,0),(1,0)\}.

eg. show A=xy(F(f(a),x)G(g(x,x),y))A=\exists x\forall y(F(f(a),x)\land G(g(x,x),y)) is satisfiable but not valid.
satisfy: Dv={d},Fv=Gv={(d,d)},av=,f(d)=d,g(d,d)=dD^v=\{d\},F^v=G^v=\{(d,d)\},a^v=,f(d)=d,g(d,d)=d.
not satisfy: Dv={d},Fv=Gv=,av=d,f(d)=d,g(d,d)=dD^v=\{d\},F^v=G^v=\varnothing,a^v=d,f(d)=d,g(d,d)=d.

lec 16. 11.05

remark. syntax: clear distinction between terms (objs) and formulas (with true or false).

syntax semantics
what is a proposition truth tables
formal deduction AA tautology, AA satisfiable, AA contradiction,
α\vdash \alpha, Σα\Sigma\vdash\alpha ΣA\Sigma\vDash A soundness & completeness
Σ\Sigma consistent Σ\Sigma satisfiable \leftrightarrow

eg. show Σ1={R(x1,f(x1)),R(x2,f(x2)),...,R(xn,f(xn))}{xy¬R(x,y)}\Sigma_1=\{R(x_1,f(x_1)),R(x_2,f(x_2)),...,R(x_n,f(x_n))\}\cup\{\exists x\exists y\neg R(x,y)\} is satisfiable.
let Dv=N,Rv=x<y,f(x)=x+1,x1v=1,x2v=2,...,xmv=mD^v=\mathbb{N},R^v=x<y,f(x)=x+1,x_1^v=1,x_2^v=2,...,x^v_m=m.

definition. proof system for predicate logic satisfies

  1. soundness ( αα valid\vdash\alpha\rightarrow\alpha\text{ valid} )
  2. completeness ( α validα\alpha\text{ valid}\rightarrow\vdash\alpha )
  3. verifiable

definition. formal proof system for predicate logic

Ax1 if AA is a propositional tautology in variables p1,...,pkp_1,...,p_k and α1,...,αk\alpha_1,...,\alpha_k are formulas, then A(p1,...,pkα1,...,αk)A(\frac{p_1,...,p_k}{\alpha_1,...,\alpha_k}) the formula obtained by replacing each pip_i in AA by αi\alpha_i is an axiom.
Ax2 xαα\forall x \,\alpha\rightarrow\alpha for every formula α\alpha and every variable xx.
Ax3 αxα\alpha\rightarrow\exists x\,\alpha for every formula α\alpha and variable xx.
Ax4 (xαβ)(xαxβ)(\forall x\,\alpha\rightarrow\beta)\rightarrow(\forall x\,\alpha\rightarrow\forall x\,\beta)
Ax5 (xαβ)(xαxβ)(\exists x\,\alpha\rightarrow\beta)\rightarrow(\exists x\,\alpha\rightarrow\exists x\,\beta)
Ax6 (t1t2)(α(t1...)α(t2...))(t_1\rightarrow t_2)\rightarrow(\alpha(t_1...)\rightarrow\alpha(t_2...))

eg. xyR(x,y)xyR(x,y)\forall x\exists yR(x,y)\rightarrow\forall x\exists yR(x,y) is a substitution in ppp\rightarrow p by xyR(x,y)\forall x\exists yR(x,y) for pp.

eg. x(P(x)Q(x,x))(xyx(P(x)Q(x,x)))\forall x(P(x)\rightarrow Q(x,x))\rightarrow(x\approx y\rightarrow \forall x(P(x)\rightarrow Q(x,x))) is an axiom (p1(p2p1)p_1\rightarrow(p_2\rightarrow p_1)).

redef. inference rules for quantified formulas

if then
()(\forall-) ΣxA(x)\Sigma\vdash\forall xA(x) ΣA(t)\Sigma\vdash A(t)
(+)(\forall+) ΣA(u)\Sigma\vdash A(u)
uu not occurring in Σ\Sigma
ΣxA(x)\Sigma\vdash\forall xA(x)
()(\exists-) Σ,A(u)B\Sigma,A(u)\vdash B
uu not occurring in Σ\Sigma or BB
Σ,xA(x)B\Sigma,\exists xA(x)\vdash B
(+)(\exists+) ΣA(t)\Sigma\vdash A(t) ΣxA(x)\Sigma\vdash\exists xA(x)
A(x)A(x) results by replacing
some tt in A(t)A(t) y xx
()(\approx-) ΣA(t1)\Sigma\vdash A(t_1)
Σt1t2\Sigma\vdash t_1\approx t_2
ΣA(t2)\Sigma\vdash A(t_2)
A(t2)A(t_2) results by replacing
some t1t_1 in A(t1)A(t_1) by t2t_2
(+)(\approx+) uu\vdash u\approx u

lec 17. 11.07 (Colin)

eg. show x(F(x)F(x))\vdash \forall x (F(x)\rightarrow F(x))

1. F(u)F(u)F(u)\vdash F(u) ()(\in)
2. F(u)F(u)\vdash F(u)\rightarrow F(u) (+)(\rightarrow+) 1
3. x(F(x)F(x))\vdash\forall x(F(x)\rightarrow F(x)) (+)(\forall+) 2

eg. show xF(x)xF(x)\forall x F(x)\vdash \exists xF(x)

1. xF(x)xF(x)\forall xF(x)\vdash \forall xF(x) ()(\in)
2. xF(x)F(t)\forall xF(x)\vdash F(t) ()(\forall-) 1
3. xF(x)xF(x)\forall xF(x)\vdash \exists xF(x) (+)(\exist+) 2

eg. show yxF(x,y)xyF(x,y)\exists y\forall xF(x,y)\vdash \forall x\exists y F(x,y)

1. xF(x,w)xF(x,w)\forall xF(x,w)\vdash\forall xF(x,w) ()(\in)
2. xF(x,w)F(u,w)\forall xF(x,w)\vdash F(u,w) ()(\forall-) 1
3. xF(x,w)yF(u,y)\forall xF(x,w)\vdash \exists yF(u,y) (+)(\exists+) 2
4. yxF(x,y)yF(u,y)\exists y\forall xF(x,y)\vdash \exists yF(u,y) ()(\exists-) 3
4. yxF(x,y)xyF(x,y)\exists y\forall xF(x,y)\vdash \forall x\exists yF(x,y) (+)(\forall+) 4

remarks.
terms

formulas

eg. can we have have domain D={0,1}D=\{0,1\}?
yes. a domain just needs to be a finite set. (however with such a domian, we essentially throw away the edded power of predicate logic over propositional logic.)

theorem. (soundness) whenever ΣA\Sigma\vdash A we have ΣA\Sigma\vDash A.
use structural induction on ΣA\Sigma\vdash A, since propositional fd is sound, it suffices to verify the 6 new ingredients are sound.

eg. (+)(\forall+) is sound.

suppose ΣA(u)\Sigma\vDash A(u) where uu does not occur in Σ\Sigma. we are done if we derive ΣxA(x)\Sigma\vDash\forall xA(x). let vv be any valuation such that Σv=1\Sigma^v=1, let DD be the domain of vv.

so we get Σv(u/d)=Σv=1\Sigma^{v(u/d)}=\Sigma^v=1. we assumed ΣA(u)\Sigma\vDash A(u), hence A(u)v(u/d)=1A(u)^{v(u/d)}=1. by \forall-satisfaction it follows (xA(x))v=1(\forall xA(x))^v=1, we get ΣxA(x)\Sigma\vDash\forall xA(x). \square

eg. show xF(x)xF(x)\exists x F(x)\nvdash\forall xF(x).
xF(x)xF(x)\exists x F(x)\nvDash\forall xF(x) is shown. by the contrapositive of soundness.

theorem. (completeness) whenever ΣA\Sigma\vDash A we have ΣA\Sigma\vdash A.

lec 18. 11.12

eg. let BB be a predicate formula, let A=xBxBA=\exists xB\rightarrow\forall x B. find BB such that AA is valid.
let BB be valid, let vv be any valuation, we want to show (xB)v=1,(xB)v=1(\exist xB)^v=1,(\forall xB)^v=1. let DD be the domain of vv, let dDd\in D be arbitrary. write B(u)B(u) denote the formula that we get from replacing all xx's by uu's. since BB is valid, it follows B(u)B(u) is valid. thus B(u)v(u/d)=1B(u)^{v(u/d)}=1, then we have (xB)v=1(\exist xB)^v=1. because dDd\in D is arbitrary, giving (xB)v=1(\forall xB)^v=1.

eg. give BB such that AA is satisfiable but not valid.
let BB be F(u)F(u).

eg. add unary function symbol ff, then let B=F(f(x))B=F(f(x)) instead. what notation to use to show satisfaction of BB?
define vv to have D={1,2},Fv={1},fv:DD:12,21D=\{1,2\}, F^v=\{1\}, f^v:D\rightarrow D: 1\mapsto 2, 2\mapsto 1.

eg. let p1,...pnp_1,...p_n be prop. variables for some n1n\geq 1. let Σ\Sigma be a set of prop. formulas such that p1,...,pnΣp_1,...,p_n\in\Sigma. let AA be a prop. formula such that every prop. variables in AA is in {p1,...,pn}\{p_1,...,p_n\}. show either ΣA\Sigma\vdash A or Σ¬A\Sigma\vdash\neg A.
case 1: if we have ΣA\Sigma\vdash A we are done.
case 2: if we have ΣA\Sigma\nvdash A. by the contrapositive of completeness, we get ΣA\Sigma\nvDash A. there exists a valuation tt such that Σt=1\Sigma^t=1 but At=0A^t=0. so (¬A)t=1(\neg A)^t=1 by ¬\neg-rule. since piΣp_i\in\Sigma for all ii, pit=1p_i^t=1. recall AA is constructed only by pip_i's, this says for all valuation tt' such that pit=1p_i^{t'}=1 also makes At=0A^{t'}=0. claim Σ¬A\Sigma\vDash\neg A, if the claim is true, then by completeness Σ¬A\Sigma\vdash\neg A. let tt'' be any valuation such that Σt=1\Sigma^{t''}=1, by the above observation At=0A^{t''}=0, so (¬A)t=1(\neg A)^{t''}=1 so Σ¬A\Sigma\vDash\neg A.

lec 19. 11.14

remark.

eg. determine consistency of Σ={F(u,w),G(f(w),g(u))}\Sigma=\{F(u,w),G(f(w),g(u))\}
this is consistent. by soundness, it suffices to show this is satisfiable. let vv be a valuation with

so F(u,w)v=1F(u,w)^v=1 and G(f(w),g(u))v=1G(f(w),g(u))^v=1.

eg. show Σ={F(u)G(u),F(u)¬G(u)}\Sigma=\{F(u)\rightarrow G(u),F(u)\land\neg G(u)\} is inconsistent.
by the contrapositive of completeness, it suffices to show this is unsatisfiable. let vv be any valuation.

there Σ\Sigma is not satisfiable.

eg. show Σ={F(u)G(u),F(u)¬G(u)}\Sigma=\{F(u)\rightarrow G(u),F(u)\land\neg G(u)\} is inconsistent from definition.

1. F(u)G(u),F(u)¬G(u)F(u)G(u)F(u)\rightarrow G(u),F(u)\land\neg G(u)\vdash F(u)\rightarrow G(u) ()(\in)
2. F(u)G(u),F(u)¬G(u)F(u)¬G(u)F(u)\rightarrow G(u),F(u)\land\neg G(u)\vdash F(u)\land\neg G(u) ()(\in)
3. F(u)G(u),F(u)¬G(u)F(u)F(u)\rightarrow G(u),F(u)\land\neg G(u)\vdash F(u) (+)(\land+) 2
4. F(u)G(u),F(u)¬G(u)¬G(u)F(u)\rightarrow G(u),F(u)\land\neg G(u)\vdash\neg G(u) (+)(\land+) 2
5. F(u)G(u),F(u)¬G(u)G(u)F(u)\rightarrow G(u),F(u)\land\neg G(u)\vdash G(u) ()(\rightarrow-) 1, 3

so it is inconsistent.

eg. assume a language LL with an individual symbol aa, an unary relation symbol FF. let Σ\Sigma be a set of formulas in LL, in which for any AΣA\in\Sigma, it only contains ,,\land,\lor,\rightarrow. claim Σ\Sigma is consistent.
let DD be anything, dDd\in D arbitrary, let vv select DD, av=d,Fv={d}a^v=d,F^v=\{d\}. then F(a)v=1F(a)^v=1 and F(a)F(a) is the only atomic formula possible, we can use structural induction on AA that Av=1A^v=1 so Σv=1\Sigma^v=1. it suffices to show that for any BB such that ΣB\Sigma\vdash B, BB contains no ¬\neg symbols. use structural induction on BB.
base: BΣB\in\Sigma, done by the construction of Σ\Sigma.
step: cases for inference rules:

tut 8. 11.15

what?

lec 20. 11.19

Peano arithmetics

theorem. equality has properties:

  1. reflexivity

    1. uu\vdash u\approx u (+)(\approx+)
    2. x(xx)\vdash \forall x (x\approx x) (+)(\forall+), 1
  2. symmetry

    1. uu\vdash u\approx u (+)(\approx+)
    2. uvuvu\approx v\vdash u\approx v ()(\in)
    3. uvuuu\approx v\vdash u\approx u (+)(+), 1
    4. uvvuu\approx v\vdash v\approx u ()(\approx-), 2, 3
    5. uvvu\vdash u\approx v\rightarrow v\approx u (+)(\rightarrow+), 4
    6. y(uyyu)\vdash \forall y(u\approx y\rightarrow y\rightarrow u) (+)(\forall+), 5
    7. xy(xyyx)\vdash \forall x\forall y(x\approx y\rightarrow y\approx x) (+)(\forall+), 6
  3. transitivity

    1. uvvwuvvwu\approx v\land v\approx w\vdash u\approx v\land v\approx w ()(\in)
    2. uvvwuvu\approx v\land v\approx w\vdash u\approx v ()(\land-), 1
    3. xy(xyyx)\vdash \forall x\forall y(x\approx y\rightarrow y\approx x) symmetry of \approx
    4. y(uyyu)\vdash \forall y(u \approx y \rightarrow y \approx u) ()(\forall-), 3
    5. uvvuu \approx v \rightarrow v \approx u ()(\forall-), 4
    6. uvvwuvvuu\approx v\land v\approx w\vdash u\approx v \rightarrow v \approx u (+)(+), 5
    7. uvvwvuu\approx v\land v\approx w\vdash v \approx u ()(\rightarrow-), 2, 6
    8. uvvwvwu\approx v\land v\approx w\vdash v \approx w ()(\land-), 1
    9. uvvwuwu\approx v\land v\approx w\vdash u \approx w ()(\approx-), 7, 8
    10. (uvvw)uw\vdash (u\approx v\land v\approx w)\rightarrow u \approx w (+)(\rightarrow+), 9
    11. z((uvvz)uz)\forall z((u \approx v \wedge v \approx z) \rightarrow u \approx z) (+)(\forall+), 10
    12. yz((uyyz)uz)\forall y \forall z((u \approx y \wedge y \approx z) \rightarrow u \approx z) (+)(\forall+), 11
    13. xyz((xyyz)xz)\forall x \forall y \forall z((x \approx y \wedge y \approx z) \rightarrow x \approx z) (+)(\forall+), 12

so each natural number can be written as 0,s(0),(ss)(0),(sss)(0),...0,s(0),(s\circ s)(0),(s\circ s\circ s)(0),....

definition. axioms of naturla numbers

PA1. x(¬(s(x)0))\forall x(\neg(s(x) \approx 0)) zero is not a successor
PA2. xy(s(x)s(y)xy)\forall x \forall y(s(x) \approx s(y) \rightarrow x \approx y) nothing has two successors
PA3. x(x+0x)\forall x(x+0 \approx x) adding zero yields same number
PA4. xy(x+s(y)s(x+y))\forall x \forall y(x+s(y) \approx s(x+y)) adding successor yields the successor of adding the number
PA5. x(x×00)\forall x(x \times 0 \approx 0) multiplying zero yields zero
PA6. xy(x×s(y)(x×y)+x)\forall x \forall y(x \times s(y) \approx(x \times y)+x) define multiplication
PA7. (A(0)x(A(x)A(s(x))))xA(x)(A(0) \wedge \forall x(A(x) \rightarrow A(s(x)))) \rightarrow \forall x A(x) induction

remark. to show xA(x)\forall x A(x), need to show

  1. base case A(0)A(0),
  2. inductive case x(A(x)A(s(x)))\forall x(A(x) \rightarrow A(s(x))).

theorem. x(¬(s(x)x))\vdash\forall x(\neg (s(x)\approx x))

proof. the formula is A(u)=¬(s(u)u)A(u)=\neg (s(u)\approx u).
base: show A(0)A(0)

1. x(¬(s(x)0))\vdash\forall x(\neg (s(x) \approx 0)) PA1
2. ¬(s(0)0)\vdash\neg (s(0)\approx 0) ()(\forall-), 1

inductive: show x(A(x)A(s(x)))\forall x(A(x) \rightarrow A(s(x))), in particular x((¬s(x)x)(¬s(s(x))s(x)))\forall x((\neg s(x) \approx x) \rightarrow(\neg s(s(x)) \approx s(x))).

1. ¬s(u)u,s(s(u))s(u)s(s(u))s(u)\neg s(u) \approx u, s(s(u)) \approx s(u) \vdash s(s(u)) \approx s(u) ()(\in)
2. xy(s(x)s(y)xy)\vdash \forall x \forall y(s(x) \approx s(y) \rightarrow x \approx y) PA2
3. y(s(s(u))s(y)s(u)y)\vdash \forall y(s(s(u)) \approx s(y) \rightarrow s(u) \approx y) ()(\forall-), 2
4. (s(s(u))s(u)s(u)u)\vdash(s(s(u)) \approx s(u) \rightarrow s(u) \approx u) ()(\forall-), 3
5. ¬s(u)u,s(s(u))s(u)(s(s(u))s(u)s(u)u)\neg s(u) \approx u, s(s(u)) \approx s(u) \vdash(s(s(u)) \approx s(u) \rightarrow s(u) \approx u) (+)(+)
6. ¬s(u)u,s(s(u))s(u)s(u)u\neg s(u) \approx u, s(s(u)) \approx s(u) \vdash s(u) \approx u ()(\rightarrow-), 1, 5
7. ¬s(u)u,s(s(u))s(u)¬s(u)u\neg s(u) \approx u, s(s(u)) \approx s(u) \vdash\neg s(u) \approx u ()(\in)
8. ¬s(u)u¬s(u))s(u)\neg s(u) \approx u \vdash\neg s(u)) \approx s(u) (¬+)(\neg+), 6, 7
9. (¬s(u)u)(¬s(s(u))s(u))\vdash(\neg s(u) \approx u) \rightarrow(\neg s(s(u)) \approx s(u)) (+)(\rightarrow+), 8
10. x((¬s(x)x)(¬s(s(x))s(x)))\vdash\forall x((\neg s(x) \approx x) \rightarrow(\neg s(s(x)) \approx s(x))) (+)(\forall+), 9

finally:

1. ((¬s(0)0)x((¬s(x)x)(¬s(s(x))))x(¬s(x)x)\vdash((\neg s(0) \approx 0) \wedge \forall x((\neg s(x) \approx x) \rightarrow(\neg s(s(x)))) \rightarrow \forall x(\neg s(x) \approx x) PA7
2. ¬s(0)0\vdash\neg s(0)\approx 0 base
3. x((¬s(x)x)(¬s(s(x))s(x)))\vdash\forall x((\neg s(x) \approx x) \rightarrow(\neg s(s(x)) \approx s(x))) inductive
4. (¬s(0)0)x((¬s(x)x)(¬s(s(x))s(x)))\vdash(\neg s(0) \approx 0) \wedge \forall x((\neg s(x) \approx x) \rightarrow(\neg s(s(x)) \approx s(x))) (+)(\land+), 2, 3
5. x(¬s(x)x)\vdash\forall x(\neg s(x) \approx x) ()(\rightarrow-), 1, 4

\square

lec 21. 11.21

PA is sound

PA is not complete

theorem. PA is commutative: PAxy(x+yy+x)\vdash_{PA}\forall x\forall y(x+y\approx y+x).

proof. shall prove

(y(0+yy+0)xy(x+yy+x)y(s(x)+yy+s(x)))xy(x+yy+x)\begin{array}{l}{(\forall y(0+y \approx y+0) \wedge} \\ {\forall x \forall y(x+y \approx y+x) \rightarrow \forall y(s(x)+y \approx y+s(x))) \rightarrow} \\ {\forall x \forall y(x+y \approx y+x)}\end{array}

  1. lemma/base. PA(y(0+yy+0))\vdash_{PA}(\forall y(0+y \approx y+0))
    use induction on yy.
    base: 0+00+00+0\approx 0+0 is clear.
    inductive: want to show PAy(0+yy+0)(0+s(y)s(y)+0)\vdash_{PA}\forall y(0+y \approx y+0) \rightarrow(0+s(y) \approx s(y)+0)*. note that, pick uu free

    0+s(u)\quad 0+s(u)
    s(0+u)\approx s(0+u) PA4
    s(u+0)\approx s(u+0) assumption
    s(u)\approx s(u) PA3 with ()(\forall-)
    s(u)+0\approx s(u)+0 PA3 with ()(\forall-) with symmetry

    use (+)(\rightarrow+) and (+)(\forall+) we get *.
    then use (+)(\land+), ()(\rightarrow-) and PA7 get the lemma done.

  2. lemma/inductive. y(u+yy+u)PAy(s(u)+yy+s(u))\forall y(u+y \approx y+u) \vdash_{P A} \forall y(s(u)+y \approx y+s(u)) for each free uu.
    use induction on yy.
    base: will show s(u)+00+s(u)s(u)+0\approx 0+s(u). this follows from the base case.
    inductive: show PAz((s(u)+zz+s(u))s(u)+s(z)s(z)+s(u))\vdash_{PA}\forall z((s(u)+z \approx z+s(u)) \rightarrow s(u)+s(z) \approx s(z)+s(u)) **.
    assume s(u)+ww+s(u)s(u)+w\approx w+s(u), then

    s(u)+s(w)\quad s(u)+s(w)
    s(s(u)+w)\approx s(s(u)+w) PA4
    s(w+s(u))\approx s(w+s(u)) assumption
    s(s(w+u))\approx s(s(w+u)) PA4
    s(s(u+w))\approx s(s(u+w)) premise of lemma
    s(u+s(w))\approx s(u+s(w)) PA4, symmetry
    s(s(w)+u)\approx s(s(w)+u) assumption. symmetry
    s(w)+s(u)\approx s(w)+s(u) PA4, symmetry

    use (+)(\rightarrow+) and (+)(\forall+) we get **.
    then use (+)(\land+), ()(\rightarrow-) and PA7 get the lemma done.

then use (+)(\land+), ()(\rightarrow-) and PA7 get the theorem done. \square

lec 22. 11.16

definition. a decision problem is a problem which calls for an answer of yes or no, given some input.

these examples and decidable:

example of undecidable question:

definition. a decision problem DD is decidable if there exists an algorithm such that given an input to the problem, it outputs yes if that input has answer yes, or outputs no if that input has answer no.

remark. an algorithm must finish after finitely many steps. if there is one case where the candidate cannot finish in finitely many steps, it is not an algorithm.

remark. to show decidability, provide an algorithm to decide it. to show undecidability, it is to say no algorithm exists to give the correct yes/no answer for every input.

many nice decisions can bre stated in terms of the question of membership in some set.
lots of non-trivial examples exist for subsets of N\mathbb{N}

definition. let SNS\subseteq\mathbb{N} be any subset, the S-membership problem asks "for an arbitrary xNx\in\mathbb{N}, is xSx\in S?"

definition. a set SNS\subseteq\mathbb{N} is called decidable if the S-membership problem is decidable.

eg. suppose SNS\subseteq N is decidable, show that the complement Sc=NSS^c=\mathbb{N}-S is also decidable.
the following algorithm decides membership in SCS^C:

  1. given xNx\in\mathbb{N}
  2. use the decider to decide whether xSx\in S
  3. if xSx\in S return "no" else "yes"

eg. suppose SNS\subset\mathbb{N} is finite, show is SS decidable.
test each siSs_i\in S one at a time. after finitely many steps, we either find a match (yes) or exhaust the set (no).

eg. suppose SNS\subset\mathbb{N} is infinite, does it follow that SS is not undecidable?
no. eg. 2N2\mathbb{N}

strategy for showing undecidability:

  1. for a contradiction, assume D is decidable
  2. let (P I) be an arbitrary input for the halting problem
  3. use the decider for D to determine whether (P I) halts
  4. this provides a decider for the halting problem
  5. since halting problem is undecidable, this is a contradiction
  6. so D is undecidable.

eg. (halt on every input) "given a program Q, does Q halt for every input?" is undecidable
(assumed all our programs consume/return natural numbers unless specified)

let D be the decider for the halt on every input problem.

  1. for a contradiction, assume the problem is decidable.
  2. let (P I) be any input for the halting problem
  3. construct a new program Q to carry out the following algorithm
    1. given input x
    2. ignore x, and run P with input I
    3. if (P I) halts, then (Q x) should halt
    4. (P I) might not halt, then by construction
      1. if (P I) halts, then Q halts and accepts any input x and
      2. if (P I) runs forever then Q runs forever with every input x
  4. feed Q into D, and return the same answer for whether P halts on input I. this provides a decider for halting problem.
  5. but then we have a contradiction since halting problem is undecidable. \square

lec 23. 11.28

theorem. the halting problem is undecidable.
proof. assume for a contradiction that halting problem is decidable. we have the following decider:

type Program = (...args[]) => any; // determine wheter P halts with input I function halts(P: Program, I: any): bool { ... }

eg.

// halts(loop) returns false => does not end function loop(x: any) { return loop(loop); }

define a new program C:

// if P is inf loop, program does not get stuck // if P is ends, program gets stuck function diagHalts(P: Program) { return halts(P, P) ? loop(loop) : false; } const C = diagHalts;

here any program and any input can be encoded into a natural number.

eg. (halt on zero) "given any program Q, does it run forever with input 0?" is undecidable.

  1. for a contradiction assume this problem is decidable. let D be its decider.
  2. let (P I) be any candidate for the halting problem
  3. construct a new program Q that carries out the following algorithem
    1. given any input x
    2. ignore x and run (P I)
    3. if (P I) halts, then halt and return 0
    4. (P I) might run forever
      1. if this happens, then Q also runs forever
  4. feed Q into D
    1. if D returns yes then (P I) runs forever
    2. if D returns no then (P I) halts
    3. (the negation here is because "yes" indicates a failure to halt, as the problem asks "run forever")
  5. we now have a decider for halting problem, a contradiction. \square