What is inference? Applications and a quick example.
(Hypotheses, facts, and results are logical formulas.)
In English: if $A$ and $A\rightarrow B$ are both true then $B$ must be true.
We write this rule as $\rule{A ; A\rightarrow B}{B}$
Suppose that we are given the following propositions:
By modus ponens, we infer that
Show that $r$ follows from $p$, $p\rightarrow q$, and $q\rightarrow r$.
1. | $p$ | Given |
2. | $p\rightarrow q$ | Given |
3. | $q\rightarrow r$ | Given |
4. | $q$ | MP: 1, 2 |
5. | $r$ | MP: 3, 4 |
Modus Ponens $\rule{A ; A\rightarrow B}{B}$
Show that $\neg p$ follows from $p \rightarrow q$ and $\neg q$.
1. | $p \rightarrow q$ | Given |
2. | $\neg q$ | Given |
3. | $\neg q\rightarrow \neg p$ | Contrapositive: 1 |
4. | $\neg p$ | MP: 2, 3 |
Modus Ponens $\rule{A ; A\rightarrow B}{B}$
Inference rules for propositional logic.
$\rule{A;B}{C, D}$
$\rule{}{C, D}$
Two rules per binary connective: to introduce and eliminate it.
Intro $\wedge$ $\rule{A; B}{A \wedge B}$
Elim $\wedge$ $\rule{A\wedge B}{A,B}$
Intro $\vee$ $\rule{A}{A\vee B, B\vee A}$
Elim $\vee$ $\rule{A\vee B; \neg A}{B}$
Direct Proof Rule $\rule{A\implies B}{A\rightarrow B}$
Modus Ponens $\rule{A ; A\rightarrow B}{B}$
Direct Proof Rule is special: not like the other rules.
If your formula is in conjunctive normal form (CNF), then you need just one rule to construct proofs!
Resolution $\rule{(p_1 \vee \ldots \vee p_n \vee k);(q_1 \vee \ldots \vee q_m \vee \neg k )}{(p_1 \vee \ldots \vee p_n \vee q_1 \vee \ldots \vee q_m)}$
Automated theorem provers for propositional logic (a.k.a. SAT solvers) use resolution to construct proofs for CNF formulas with millions of variables and clauses (maxterms).
From hypotheses and facts to results, one rule at a time.
Intro $\wedge$ $\rule{A; B}{A \wedge B}$
Elim $\wedge$ $\rule{A\wedge B}{A,B}$
Intro $\vee$ $\rule{A}{A\vee B, B\vee A}$
Elim $\vee$ $\rule{A\vee B; \neg A}{B}$
Direct Proof Rule $\rule{A\implies B}{A\rightarrow B}$
Modus Ponens $\rule{A ; A\rightarrow B}{B}$
Show that $r$ follows from $p$, $p \rightarrow q$ and $(p \wedge q) \rightarrow r$.
1. | $p$ | Given |
2. | $p\rightarrow q$ | Given |
3. | $(p \wedge q) \rightarrow r$ | Given |
4. | $q$ | MP: 1, 2 |
5. | $p\wedge q$ | Intro $\wedge$: 1, 4 |
6. | $r$ | MP: 3, 5 |
Intro $\wedge$ $\rule{A; B}{A \wedge B}$
Elim $\wedge$ $\rule{A\wedge B}{A,B}$
Intro $\vee$ $\rule{A}{A\vee B, B\vee A}$
Elim $\vee$ $\rule{A\vee B; \neg A}{B}$
Direct Proof Rule $\rule{A\implies B}{A\rightarrow B}$
Modus Ponens $\rule{A ; A\rightarrow B}{B}$
2 does not follow from 1!
E.g, $p=\mathsf{F}, q=\mathsf{T}, r=\mathsf{F}$.
Prove that $\neg r$ follows from $p \wedge s$, $q \rightarrow \neg r$, and $\neg s \vee q$.
1. | $p\wedge s$ | Given |
2. | $q \rightarrow \neg r$ | Given |
3. | $\neg s \vee q$ | Given |
4. | $s$ | Elim $\wedge$: 1 |
5. | $\neg\neg s$ | Double Negation: 4 |
6. | $q$ | Elim $\vee$: 3, 5 |
7. | $\neg r$ | MP: 2, 6 |
Intro $\wedge$ $\rule{A; B}{A \wedge B}$
Elim $\wedge$ $\rule{A\wedge B}{A,B}$
Intro $\vee$ $\rule{A}{A\vee B, B\vee A}$
Elim $\vee$ $\rule{A\vee B; \neg A}{B}$
Direct Proof Rule $\rule{A\implies B}{A\rightarrow B}$
Modus Ponens $\rule{A ; A\rightarrow B}{B}$
Direct Proof Rule $\rule{A\implies B}{A\rightarrow B}$
The premise $A\implies B$ means “Given $A$, we can prove $B$.”
So the direct proof rule says that if we have such a proof, then we can conclude that $A\rightarrow B$ is true.
Example: prove $ p \rightarrow (p \vee q)$.
1.1. | $p$ | Assumption |
1.2. | $p \vee q$ | Intro $\vee$: 1 |
2. | $ p \rightarrow (p \vee q)$ | Direct Proof Rule |
Indent the proof subroutine.
Prove $(p\wedge q)\rightarrow(p\vee q)$.
There must be an application of the Direct Proof Rule (or an equivalence) to prove this implication.
1.1. | $p\wedge q$ | Assumption |
1.2. | $p$ | Elim $\wedge$: 1.1 |
1.3. | $p\vee q$ | Intro $\vee$: 1.2 |
2. | $(p\wedge q) \rightarrow (p \vee q)$ | Direct Proof Rule |
Prove $((p\rightarrow q)\wedge(q\rightarrow r))\rightarrow(p\rightarrow r)$.
1.1. | $(p\rightarrow q)\wedge(q\rightarrow r)$ | Assumption |
1.2. | $p\rightarrow q$ | Elim $\wedge$: 1.1 |
1.3. | $q\rightarrow r$ | Elim $\wedge$: 1.1 |
1.4.1. | $p$ | Assumption |
1.4.2. | $q$ | MP: 1.2, 1.4.1 |
1.4.3. | $r$ | MP: 1.3, 1.4.2 |
1.5. | $p\rightarrow r$ | Direct Proof Rule |
2. | $((p\rightarrow q)\wedge(q\rightarrow r))\rightarrow(p\rightarrow r)$ | Direct Proof Rule |
Look at the rules for introducing connectives to see how you would build up the formula you want to prove from pieces of what is given.
Use the rules for eliminating connectives to break down the given formulas so that you get the pieces need for 1
Write the proof beginning with what you figured out for 2 followed by 1.
Intro $\wedge$ $\rule{A; B}{A \wedge B}$
Elim $\wedge$ $\rule{A\wedge B}{A,B}$
Intro $\vee$ $\rule{A}{A\vee B, B\vee A}$
Elim $\vee$ $\rule{A\vee B; \neg A}{B}$
Direct Proof Rule $\rule{A\implies B}{A\rightarrow B}$
Modus Ponens $\rule{A ; A\rightarrow B}{B}$