Logic and Proof Methods
Logic and Proof Methods
Logic and Proof Methods
methods.
1
List of contents
• First-order logic.
• Laws of first-order logic.
• Prenex normal form.
• Logical inference in sentential logic.
• Rules of logical inference applying in sentential logic.
• Resolution method.
• Rules of inference for predicate calculus.
• Methods of theorem proving.
2
First-order logic
х + 1 = 3;
x<7;
Sentences with variables are not propositional formulas, but they can
become propositional formulas as long as their variables are given
certain values.
First-order logic 3
Р(х1 х2, ..., хn) і is called an n-place predicate which contains n subject
variables х1, х2, ..., хn.
Set D and its values are called subject area of the variable x.
Instead of word „predicate" „proposition function“ is used.
First-order logic 4
To record atomic sentences of first-order logic these types of symbols are used:
• Individual symbols, or constants are the name of the objects with the first
capital letter and the constants, e.g.: Discrete_math, Т, F, 2, 5;
• Subject symbols, subject variables, or just variables are the names to mark
variables. They are written with lowercase letters (indexes are possible), e.g.: х, у,
z;
• Predicate symbols are the names to indicate predicates written with uppercase
letters (e.g.: Р, Q, R) or meaningful words written with uppercase letters (e.g.:
MORE, LOVE).
First-order logic 5
Example 1:
x<4
x is a subject variable ;
4 is a constant, individual;
<, less, Р are predicate variable, attribute of a sentence;
P(x) is a predicate
x < y, x is less than у, P(x,y), LESS(x,y) is a predicate
then LESS(x,4) is a predicate
First-order logic 6
Example 2:
x +y=10
Q(x,y) is a predicate
Q(4,6) = T;
Q(3,5) = F.
First-order logic 7
Quantification
Universal quantification ∀,
Existential quantification ∃,
where х ∈ D,
P(x) comes to ∀xP(x) or ∃xP(x) by connection,
The variable х is connected variable.
P(x,y)
∃xP(x,y), where x is a connected variable while y is free as P(x) does not
belong to operation area of quantification with the variable y.
First-order logic 8
Example 3.
Let’s mark the sentence
х is a prime number as Р(х),
х is a rational number as Q(x),
х is a real number as R(x) and
х<y, х is less than у as LESS(х, у).
First-order logic 9
Example 4.
Every student had passed the mathematic exam.
x is a student, у is the math exam, В means “had passed”
∀𝑥𝐵 𝑥, 𝑦
Every ICSIT student had passed the mathematic exam
x is a student, у is mathematics, В means “had passed”, S is an ICSIT student
∀𝑥 𝑆 𝑥 → 𝐵 𝑥, 𝑦
Is it correct to use this formula?
∀𝑥 𝑆 𝑥 ∧ 𝐵 𝑥, 𝑦
Example 5.
∀𝑥 𝑀 𝑥 ∧ 𝑃 𝑥 → ∃𝑦 𝐹 𝑥, 𝑦 ,
where М(х) is a man, Р(х) is a parent, F(x,y) means that he has a child.
10
Laws of first-order logic
11
Laws of first-order logic
If D = {а1,а2,а3,…, аn} is a finite subject area
of the variable х in predicate Р(х) then
12
Prenex normal form
First order logic formula is written in prenex normal form if it looks like
𝑄1 𝑥 1 𝑄2 𝑥 2 𝑄3 𝑥 3 … 𝑄𝑛 𝑥 𝑛 M,
13
14
Algorism of arbitrary first-order logic formula into prenex normal form.
Step 1.
Remove logical operations "~" and "->“ from formula by using equivalent formulas
Р~ 𝑄 = 𝑃 −> 𝑄 ∧ 𝑄 → 𝑃 ; Р −> 𝑄 = 𝑃 ∨ 𝑄;
Step 2.
Include the negation in the middle of formula directly into atomic sentence using these
laws:
• Double negation Р = Р;
• De Morgan’s 𝑃 ∨ 𝑄 = 𝑃 ∧ 𝑄 та 𝑃 ∧ 𝑄 = 𝑃 ∨ 𝑄,
15
Algorism of arbitrary first-order logic formula into prenex normal form.
Example 6.
16
Logical inference in sentential logic
• There is a statement that formula g is a logical consequence of
formulas f1,f2, ..., fn or that g is resulted by f1,f2, ..., fn if in every
interpretation (in which formula f1∧f2 ∧ ... ∧ fn is being
implemented) formula g is being implemented as well.
• Formulas f1,f2, ..., fn are called hypotheses {axioms, postulates} of
formula g.
• The fact that formula g is resulted by f1,f2, ..., fn, is written as
f1,f2, ..., fn ⊢ g.
Hypotheses are written on the left from connective ⊢
while the consequence is on the right; the connective ⊢ itself means “thus or so”.
17
Theorem 1.
Formula g is a logical consequence of formulas f1,f2, ..., fn only in cases
when formula 𝑓1 ∧ 𝑓2 ∧ … ∧ 𝑓𝑛 — > 𝑔 is tautology.
In this case it is stated that formula g can be inferred from formulas f1,f2, ..., fn and
g is an inference formula (conclusion formula).
18
19
Example 7.
Let’s check the formulas 𝑓1 = (𝑝 → 𝑞), 𝑓2 = 𝑞, 𝑔 = 𝑝
Let’s prove that formula g is a logical consequence of formulas f1 and f2 according
to theorem 1.
Example 8.
Let’s check the formulas 𝑓1 = (𝑝 → 𝑞), 𝑓2 = 𝑞, 𝑔 = 𝑝
Let’s prove that formula g is a logical consequence of formulas f1 and f2 according
to theorem 2.
20
Rules of logical inference applying in
sentential logic
• These rules reason the steps of logical theorem proving which
contains checking if the conclusion is a logical consequence of the
hypotheses set.
Rules of inference Tautology Rule of inference name
Disjunction inclusion
Conjunction exclusion
Conjunction inclusion
Modus ponens
Modus tollens
Hypothetical syllogism
Disjunction syllogism
Resolution
21
Example 9.
Let’s prove that the hypotheses
1. „Today is not sunny and it is colder than yesterday",
2. „If we will go swimming then it is sunny",
3. „If we won’t go swimming we will go sailing"
4. „If we will go sailing we will return late at night"
lead to a conclusion
5. „We will return late at night". hypothesis
Let it be The rule of conjunction exclusion for 1
р: „It is sunny today", hypothesis
q: „Today it is colder than yesterday", Modus Tollens for 2 and 3
hypothesis
r: „We are going swimming",
Modus ponens for 4 and 5
s: „We are going sailing", hypothesis
t: „We will return late at night". Modus ponens for 6 and 7
Hypotheses: Conclusion is proven
22
Resolution method
There are a lot of computer programs for automatization of the statements
made by proving the logical theorems.
The rule of proving (known as resolution) is applied in a lot of these programs.
The rule of resolution is written like
р ∨ 𝑞, 𝑞 ∨ 𝑟 ⊢ 𝑝 ∨ 𝑟.
The proposed resolution method for automatic proving of logical theorems was is
based on this rule.
The main idea of the resolution method can be described by checking if the set S of
elementary disjunctions contains disjunction d. If S contains d then the set S is
insufficient. If S does not contain d then it requires checking if it is possible to infer
d out of S. Inference of d out of S is called the prove of non-execution of set S or
contradiction of set S.
23
Resolution method
Formula f is written in CNF
𝑓 = 𝑑1 ∧ 𝑑2 ∧ … 𝑑𝑚 ,
Every formula di (і =1, 2,...,m) here is literal or disjunction of literals.
Formula di is called elementary disjunction, disjunct or clause.
The amount of literals in di formula is called the rank of elementary
disjunction.
Resulted elementary disjunction is called resolvent.
24
Resolution method algorithm
The set of hypotheses f1,f2, ..., fn and conclusion g are given.
Algorithm allows to determine if formula g is a logical conclusion of the set of hypotheses.
Step 1. Build a conjunction hypotheses set f1,f2, ..., fn and the negation of conclusion g:
(𝑓1 ∧ 𝑓2 ∧ … ∧ 𝑓𝑛 ∧ 𝑔)
Converse the resulted function into CNF and write down the set S of its elementary disjunctiond.
Step 2. Write down each elementary disjunction of the set S in a separated row.
Step 3. Choose two elementary disjunction which contain two contrary literals, build their resolvent. Write down the
resulted resolvent in a new row if previous rows do not have such elementary disjunction yet.
Step 4. Step 3 is to be done until you get the disjunction with rank 0. Getting the elementary disjunction with rank 0
means that formula g can be inferred from f1,f2, ..., fn. If it is impossible to get the resolvent which doesn’t
equal the elements of the set S as well as resolvents already built means that set S is non-repudiative. The
end.
Elementary disjunction with rank 0 which is marked as d; disjunction like this does not contain any literals.
Elementary disjunction with rank 0 is considered equal to F by its defenition.
25
Rules of inference for predicate calculus
• Universal instantiation is a valid inference rule which states that ∀хР(х) is true if
Р(с) is true for element C of subject area. This rule is used when judging by the
fact that Р(с) is truth for every subject field element it is stated that ∀хР(х) is
true. Chosen element C has to be arbitrary and has not to be instantiated.
• Universal generalization is a valid rule if inference stating that Р(с) is true for
arbitrary element of subject area in condition that formula ∀хР х is true.
• Existential instantiation is rule which allows to come to a given conclusion:
according to the fact that ∃хР(х) is true it can be stated that there is an element
C in subject area for which Р(с) is true. Usually the only thing known about
element C is it’s existence. It states that we can mark it and get back to
judgements.
• Existential generalization is a rule of inference used for coming to conclusion
(according to the fact that P(c) is true at arbitrary element C of subject area) that
∃хР(х) is true.
26
Rules of inference for predicate calculus
Rule of inference Name
Universal instantiation
Universal generalization
Existential instantiation
Existential generalisation
In rules 1 and 2 the subject area element is arbitrary while in rules 3 and 4
subject field must have at least one element like this.
27
Methods of theorem proving
Direct proof
• Tautological implication p—> q can be proven by making sure that when hypothesis
of implication р is true, which means that conclusion q is true as well.
Proof by contradiction
• Let’s take as an example implication 𝑞 −> 𝑝. In case when 𝑞 is true the truth of 𝑝 is
need to be proven. This is the simplest way of proving theorem p —> q by
contradiction: we premise the contradiction for the subject to prove and get the
antilogies with what is given.
Proof by cases
• Sometimes for proving the tautological implication р -> q it is suitable to ise
disjunction (рі V р2 V ... V рn) as a hypothesis of implication instead of p if р equals
(pivp2v ...v pn).
28