The Natural Deduction Logic of Huth and Ryan
Introduction
This is a translation of the natural deduction systems of logic in
[HuthRyan00]
into my own MATHS notation.
Syntax
The following uses XBNF to describe well formed formula.
- wff::=Well Formed Formula.
The book defines wff like this:
- Rough_Syntax::=following,
Net
- atomic_proposition::=given.
- wff::=atomic_proposition | "(" "not" wff ") | "(" wff "and" wff ")" | "(" wff "or" wff ")" | "(" "if" wff "then" wff ")".
.As-is (if (P and Q) then (R and S))
.As-is ((P and Q) or (R and S))
(End of Net)
The book then appeals to using operator priorities to avoid parentheses:
.As-is if P and Q then R and S
.As-is P and Q or R and S
It is possible to express operator priorities directly in the syntax
instead. Here is the result:
- wff::= implication | disjunction | conjunction | negation | atomic_proposition | compound.
- implication::= "if" wff1 "then" disjunction.
if p then q
if p and q then q or p
- disjunction::= conjunction #("or" conjunction).
p or q or not r or s and t
- conjunction::= negation #("and" negation).
p and not q
- negation::= #("not") ( atomic_proposition | compound).
p
not p
not( p or not q)
( p or not q)
- compound::= "(" wff ")".
( p or not q)
- atomic_proposition::=given.
Semantics
- semantic_structure::= atomic | Structure with op:Operators & rands:#Operands.
- Operators::={ and, or, not, if_then ).
- Operands::=semantic_structure.
the semantic_structure(and, p, q).
the semantic_structure(and, p, the semantic_structure(if_then, p, q)).
Parsing
This is a matter of defining a map from syntax to semantics.
- if P and Q then R or S +> the semantic_structure(if_then, the semantic_structure(and, P, Q), the semantic_structure(or, R,S)).
More TBA.
Meaning
Meaning is normally provided by rules evaluating a semantic structure as
either true or false. We therefore would define a function that
evaluates a semantic structure as a boolean. This is very easy using
recursion. For example, to evaluate the_sematic_structure(and, P, Q)
for the two structures P and Q, in C++ we would
return evaluate(P) && evaluate(Q);
Reasoning
Examples of reasoning are given as
[ Proofs of Derived Rules ]
below.
Notation for rules
Inference rule is shown like this:
- (name_of_the_rule): conclusion:-premise, premise,....
It is used in a proof like this:
- (labels_of_premisses_and_ruls) |- (label_of_conclusion): conclusion.
In a MATHS rule a wff like if P then Q often becomes a Let-block like this:
Let
- |- (premise_label): P.
- ...
- Q
(Close Let P)
Rules
The names of the rules have been translated. Instead of "^i" for example
I would use "andi".
- HuthRyan::=following,
Net
Propositions
from page 31.
- |- (andi): P and Q :- P, Q.
- |- (ande1): P:-P and Q.
- |- (ande2): Q:-P and Q.
- |- (ande): repeated use of ande1 and ande2 to extract on part of a conjunction.
- |- (ori1): P or Q:-P.
- |- (ori2): P or Q:-Q.
- |- (ori): repeated applications of ori1 and ore2 to assemble ... or P or ...
from P.
- |- (ore): R :- (P or Q), if P then R, if Q then R
- |- (ife): Q:-P, if P then Q.
- |- (ifi): if P then Q :-
Let- P.
- ...
- Q.
(Close Let P)
- |- (noti): not P :- if P then \bottom.
- |- (note): \bottom :-P, not P.
- |- (bottome): P:-\bottom.
- |- (notnote): P:-not not P.
Derived rules
- (above) |- (MT): not P:-if P then Q, not Q.
- (above) |- (notnoti): not not P :- P.
- (above) |- (RAA): P :- if not P then \bottom.
- (above) |- (LEM): P or not P.
Note
In practice the above rules are very well known. If you
are working with a team of people who know this logic you can
usually omit the names of the rules you are using.
. . . . . . . . . ( end of section Propositions) <<Contents | Index>>
Predicates
Notation
- For t:term, x:variable, P: wff, if free(t,x,P),
- P(t/x)::= P with every free x changed to term t.
- free(t,x,P)::=No free variable in t is bound in a part of P that has a free x, -- no variables will be captured if t is substituted for x.
- |- (eqi): t = t.
- |- (eqe): P(t2/x) :- t1=t2, P(t1/x).
- |- (alle): P(t/x):- for all x(P).
- |- (alli): for all x (P) :-
Let- x.
...
- (above) |- P.
(Close Let )
- |- (somei): for some x(P) :- P(t/x) .
- |- (somee): Q :- for some x(P).
Let- x0, P(x0/x).
...
- (above) |- Q.
(Close Let )
Notice that we could derive several other rules to simplify
proofs. Here is an example. The wff for all x, if P then Q
can always proved by using two nested let-blocks:
Let
- x
Let
- |-P
...
- (above) |- Q.
(Close Let P)
(Close Let x)
and so we can compress this to
Let- x
- |-P
...
- (above) |- Q.
(Close Let x)
. . . . . . . . . ( end of section Predicates) <<Contents | Index>>
(End of Net)
. . . . . . . . . ( end of section Rules) <<Contents | Index>>
. . . . . . . . . ( end of section Reasoning) <<Contents | Index>>
Proofs of Derived Rules
Proof of MT
Given if P then Q, not Q, prove not P.
Let
- |- (MT1): if P then Q.
- |- (MT2): not Q.
Let
- |- (MT2a): P.
- (MT1, MT2a) |- (M2b): Q.
- (M2b, MT2) |- \bottom.
(Close Let P)
- (above) |- not P.
(Close Let MT1 MT2)
Proof of notnoti
Given P prove not not P
Let
- |- (dn1): P.
Let
- |- (dn2): not P.
- (dn1, dn2) |- \bottom.
(Close Let not P)
- (above) |- not not P.
(Close Let P)
Proof of RAA
Given if not P then \bottom, then prove P.
Let
- |- (r1): if not P then \bottom.
Let
- |-(r2) not P.
- (r1, r2, ife) |- \bottom.
(Close Let not P)
- (above) |- P.
(Close Let r1)
Proof of LEM
- Prove P or not P.
Let
- |- (l1): not(P or not P).
Let
- |- (l2): P
- (l2, ori1) |- (l3): P or not P.
- (l3, l1) |- \bottom.
(Close Let P)
- (above) |- (l4): not P.
- (l4, ori2) |- (l5): P or not P.
- (l5, l1, note) |- \bottom.
(Close Let not(P or not P).)
- (above) |- (l6): not not (P or not P).
- (l6, notnote) |- P or not P
. . . . . . . . . ( end of section Proofs of Derived Rules) <<Contents | Index>>
. . . . . . . . . ( end of section The Natural Deduction Logic of Huth and Ryan) <<Contents | Index>>
Glossary
- O::=optional.
- TBA::="To Be Announced".
Links
- LOGIC::= See http://www.csci.csusb.edu/dick/maths/logic_0_Intro.html.
- MATHS::= See http://www.csci.csusb.edu/dick/maths/.
- PROOFS::= See http://www.csci.csusb.edu/dick/maths/logic_2_Proofs.html.
- XBNF::= See http://www.csci.csusb.edu/dick/maths/intro_ebnf.html.
- Structure::=MATHS equivalent of a C/C++ structure -- a class with all parts public.
- with::=Adds new parts to a Structure to derive a new Structure.
. . . . . . . . . ( end of section The Natural Deduction Logic of Huth and Ryan) <<Contents | Index>>