Logic Deduction System

Logic Deduction System
Casey Schu
Write a program to make deductions
using first order predicate logic.
Symbolic Logic
 List
of given statements with single goal
statement







v
~t
pq
s /\ r
e \/ o
(~n \/ (g  d))  (h /\ (m  k)
((u /\ l) \/ (w  ~y)) /\ (b \/ ~(w  y))
Symbolic Logic
 Prove
goal statement by making
deductions or arguments
pq
p
Therefore q
Premise 1
Premise 2
Conclusion
Valid Argument Forms
Modus Ponens
pq
p
Therefore q
Conjunctive Addition
p
q
Therefore p /\ q
Hypothetical Syllogism
pq
qr
Therefore p  r
Modus Tollens
pq
~q
Therefore ~p
Disjunctive Syllogism
p \/ q
~q
Therefore p
Conjunctive Simplification
p /\ q
Therefore p
Disjunctive Addition
p
Therefore p \/ q
q
Therefore p \/ q
p \/ q
~p
Therefore q
p /\ q
Therefore q
Symbolic Logic Example







My glasses are on the kitchen table
I saw my glasses at breakfast
I was reading the newspaper in the living room
I was reading the newspaper in the kitchen
My glasses are on the coffee table
I was reading my book in bed
My glasses are on the bed table
Symbolic Logic Example







p = My glasses are on the kitchen table
q = I saw my glasses at breakfast
r = I was reading the newspaper in the living room
s = I was reading the newspaper in the kitchen
t = My glasses are on the coffee table
u = I was reading my book in bed
v = My glasses are on the bed table
Symbolic Logic Example

If my glasses are on the kitchen
table, then I saw them at breakfast

pq

I was reading the newspaper in the
living room or I was reading the
newspaper in the kitchen

r \/ s

~q

I did not see my glasses at
breakfast
Symbolic Logic Example
 Complete






pq
r \/ s
rt
~q
uv
sp
 Goal

list of given statements
t
statement
Symbolic Logic Example
Proof:
1. p  q
Given
~q
Given
Therefore ~ p
By Modus Tollens
2. s  p
Given
~p
By Conclusion of 1
Therefore ~ s
By Modus Tollens
3. r \/ s
Given
~s
By Conclusion of 2
Therefore r
By Disjunctive Syllogism
4. r  t
Given
r
By Conclusion of 3
Therefore t
By Modus Ponens
Input Format
 C(p)
 N(p)
 I(p,q)
 A(p&q)
 O(p|q)
The variable p is true
The statement is not true
If p, then q
Both p and q are true
p, q, or both are true
Input Format


pq
r \/ s
rt
~q
uv
sp

I(C(p),C(q))
O(C(r)|C(s))
I(C(r),C(t))
N(C(q))
I(C(u),C(v))
I(C(s),C(p))

t (goal)

C(t)









Classes
 Deducer
 Statement





Implies
And
Or
Not
Constant
 Variable
 Deduction
Statements as Objects

I(C(p),C(q))

Implies(Constant(Variable(“p”)),
Constant(Variable(“q”)))

O(C(r)|C(s))

Or(Constant(Variable(“r”))|
Constant(Variable(“s”)))

N(C(q))

Not(Constant(Variable(“q”)))

C(t)

Constant(Variable(“t”))
Proof Strategy
 Examine
one statement
 Perform searches throughout the list of
statements based on the type of the
examined statement
 Add appropriate statements
 Check to see if goal statement is in the list
 DeducerDemo
Optimizing Output


1.
2.
Irrelevant deductions should be omitted
Recursively find all relevant deductions
Look at final deduction
If one or more premises is not given
a. Trace deductions back until both premises are
given statements
b. Show only deductions that were traced