0% found this document useful (0 votes)
16 views38 pages

Truth Logic and Provability

The document discusses the principles of knowledge representation and reasoning, emphasizing the evolution from traditional logic to formal logic systems used in computing. It outlines key concepts such as entailment, provability, soundness, and completeness, as well as the role of logical connectives and truth tables in formal reasoning. The work also references historical figures like Leibniz and their contributions to the understanding of logic and reasoning.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views38 pages

Truth Logic and Provability

The document discusses the principles of knowledge representation and reasoning, emphasizing the evolution from traditional logic to formal logic systems used in computing. It outlines key concepts such as entailment, provability, soundness, and completeness, as well as the role of logical connectives and truth tables in formal reasoning. The work also references historical figures like Leibniz and their contributions to the understanding of logic and reasoning.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Knowledge Representation

and
Reasoning

Truth, Logic, and Provability

Deepak Khemani
Plaksha University
The Machinery of Deductive Reasoning

Logicians were mainly focused on reasoning much before the


advent of computers

With digital computers the focus shifted to representation

We begin our study with logic and the algorithms for reasoning,
before shifting our focus to representation

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Leibniz: Calculus Ratiocinator http://en.wikipedia.org/wiki/Gottfried_Leibniz

Leibniz believed that much of human reasoning could be reduced to calculations


of a sort, and that such calculations could resolve many differences of opinion:

“The only way to rectify our reasonings is to make them as tangible as


those of the Mathematicians, so that we can find our error at a glance,
and when there are disputes among persons, we can simply say: Let us
calculate [calculemus], without further ado, to see who is right.”

Leibniz’s goal was to find a foolproof mechanism which could be


used to unambiguously decide who was right when people were
arguing.

An approach to the principles of argument, known as Tarka Shastra,


was developed independently in 17th Century India by Annambhatta
in his treatise Tarka-Sangraha.
See https://en.wikipedia.org/wiki/Tarka-Sangraha
Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
Leibniz: An Approach to Logic
The principles of Leibniz's logic and, arguably, of his whole
philosophy, reduce to two:

• All our ideas are compounded from a very small


number of simple ideas, which form the alphabet of
human thought.
• Complex ideas proceed from these simple ideas by a uniform
and symmetrical combination, analogous to arithmetical
multiplication.

• Leibniz’s main aim in logic, however, was to extend the


traditional syllogistic to a “Universal Calculus.”
Leibniz: Logic. https://iep.utm.edu/leib-log/
Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
Natural Languages
Richness
Ambiguity
Verbosity
Impreciseness

John Sowa: Conceptual Structures


Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
The Language of Logic
• Unlike natural languages like English and Hindi, languages in logic are
defined as formal languages
• A language for logic has a well defined alphabet
• There are many logic languages
• A sentence or a statement in classical logic is a symbol system that can
can be assigned a truth value true or false
• A three valued logic may have an additional category indeterminate
• Fuzzy logic has a continuum of truth values
• A sentence in classical logic is something that (usually) has a meaning
• the sentence (usually) denotes something
• Both truth values and meaning are in the human mind
• The machine is an entirely syntactic entity

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Formal Logics
Logics are formal languages with well defined rules for
manipulation of representations.

A knowledge base (KB) is a set of sentences in a given


logic language.
The family of logics varies on expressivity.
More expressivity comes at the cost of increasing
computational complexity.

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Formal Logic: A Syntactic Machine
• The machine is an entirely syntactic entity
• It is only concerned with form, not content.
• Even when meaning is defined formally, it refers to another syntactic structure
• An open and interesting question – can a computer understand what it is
processing?
• So far our way of ascertaining this has been by some variation of the Turing test – can it
answer a question “intelligently and meaningfully”?
• But then comes the Chinese room argument.
• Logic has more modest goals – can we build machines that do something that
is meaningful for us?
• Even when it operates syntactically or mechanically (by applying rules)
• Logics are meant to capture valid forms of reasoning.

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


The Syllogism
The Greek syllogism embodies the notion of reasoning in formal logic.
An argument is valid if it conforms to a valid form

All men are mortal All cities are congested All politicians are honest
Socrates is a man Chennai is a city Sambit is a politician
Socrates is mortal Chennai is congested Sambit is honest

In a valid argument
The Socratic argument IF the premises are true
THEN the conclusions
are necessarily true

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Formal Logic
Logic is a formal system
Logical reasoning is concerned ONLY with the FORM of the
argument, and not with CONTENT.
If the form is valid AND If the antecedents are true
THEN the conclusion is true.

The conclusion is derived if the antecedents are true.


Logic does not concern itself with the truth of the antecedents
OR
what the sentences are talking about (content).

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Logic: A Branch of Mathematics
• Logic is a branch of mathematics
• Mathematically, truth values are just members of a set of arity 2 to which
sentences are mapped
• {true, false}
• {T, F}
• {1, 0}
• When we begin by mapping a set of sentences to true we are interested in
knowing which other sentences map to true
• For humans a true sentence generally has some validation from the domain.
• Different logic languages have different levels of expressivity
which has a tradeoff with complexity
• Logic is concerned with valid arguments
– whatever the language chosen

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Logics Event Calculus /
Situation Calculus
Epistemic Logics
Classical two valued logics Default Logics
Temporal Logics
Second Order Logic
Modal Logics Probabilistic reasoning
First Order Logic
Propositional Logic Horn Clauses

Description Logics
Fuzzy logics Constraint logic programming

Rough sets Qualitative reasoning

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Entailment
• A set of premises or axioms are initially given to be true.
• We will refer to this set as S or KB the knowledge base.
• Axioms are known to be true.
• Premises are given and assumed to be true.
• A KB is true iff all its sentences are true.
• Entailment – given the KB, a subset, possibly empty, of all the sentences
in the language are true or entailed.

A sentence α is said to be entailed by a set of sentences S/KB if the


sentence is necessarily true whenever S/KB is true

KB ⊨ α
We also say that α is true (given the KB)

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


The Set of True Statements

KB

The set of sentences


entailed by the KB

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Provability
• The Logic Machine has Rules of Inference
• A rule of inference is a rule which specifies when another sentence can be added to
the KB.
• A Logic Machine has algorithms for deriving new sentences from old by
repeated application of the rules of inference
• The derivation is a proof.
• Given a KB can a new sentence α be added to the KB by repeated
application of some rules of inference?
If yes, then we say that α is provable.
KB ⊢ α

• The goal of the logic machinery is ideally to mechanically produce


all and only the sentences that are entailed.
Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
A Proof
Goal α

KB

Applications of rules of inference

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Soundness and Completeness The provable statements
….
The set of sentences
entailed by the KB

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Soundness and Completeness
Given a knowledge base and a reasoning algorithm –

Entailment: which other sentences in the language are necessarily true?

Proof: which other sentences in the language can one produce by the
reasoning algorithm?
Soundness (of the reasoning algorithm):

A logic is sound if only true statements in the language


if KB ⊢ α then KB ⊨ α
can be proved

Completeness (of the reasoning algorithm):

A logic is complete if all true statements in the language


if KB ⊨ α then KB ⊢ α
can be proved

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


The set of sentences in a logic language

The set of sentences that constitute the formal language of a logic is


constructed as follows

1. A set of atomic or primitive sentences or formulas is defined

2. A set of logical connectives are used to construct compound sentences


or well formed formulas

The set of sentences in any logic is unbounded or infinite

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Sentences in logic
In the following discussion we use the symbols {𝛼, 𝛽, 𝛾, 𝛿, …} to stand for sentences.
A sentence in classical two valued logic is something which can in principle be true or false.
For example,
𝛼 = There are 37001 spiral galaxies in the universe.
𝛼 = White always wins in chess.
𝛼 = The tomato is a fruit.
𝛼 = The tomato is a vegetable.
Note that we have not specified any specific logic language here. The discussion that
follows applies to any logic language.
The following are not sentences in logic,
• Please explain the AlphaBeta algorithm to me.
• When is the next class?
• Will you come for the get together?
• May I have a glass of water.

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Common logical connectives
• A logical connective takes one or more sentences as input and
constructs a new sentence.
• All logic languages have a common set of connectives.
• Unary connective. Common symbol ¬ or ∼.
If 𝛂 is a sentence then so is (¬𝛂) or (∼𝛂), generally read as not alpha.
We will use the former, also written without the brackets as ¬𝛂.
• Binary connectives
• ∧ usually read as AND. If 𝛂 and 𝛃 are sentences then so is (𝛂 ∧ 𝛃)
• ∨ usually read as OR. If 𝛂 and 𝛃 are sentences then so is (𝛂 ∨ 𝛃)
• ⊃ or → or ⇒ usually read as IMPLIES. We will use the first one.
If 𝛂 and 𝛃 are sentences then so is (𝛂 ⊃ 𝛃)
• … there are 16 binary connectives
• Ternary connectives would connect three sentences.
• But whatever we can express with ternary or higher order connectives
can also be expressed with binary connectives
Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
Semantics of logical connectives
• The semantics of compound sentences is derived from the definition of the
logical connective.
• The semantics of connectives are defined using truth tables.
• This is also known as truth functional semantics.
• The truth table on the left is for the logical not.
Not surprisingly ¬α is true when α is false, ¬α is false when α is true.
• The truth table on the right is for the logical AND.
(α ∧ β) is true only when both α and β are true. Else it is false.

α ¬α α β (α ∧ β)
true false true true true
false true false true false
true false false
false false false

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Some common binary connectives
α Implies β xor: either α or β equivalence of α and β
α β (α ⊃ β) α β (α ⨁ β) α β (α ≡ β)
true true true true true false true true true
false true true false true true false true false
true false false true false true true false false
false false true false false false false false true

α or β nor: neither α nor β


α β (α ∨ β) α β (α ↓ β)
true true true true true false
false true true false true false
true false true true false false
false false false false false true

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Semantics of compound sentences
• The semantics of compound sentences is derived from the definition of the
logical connectives and the constituent sentences
• This is again given by a truth table
• The number of rows in the truth table is 2N for N input sentences.
• The following truth table shows that the sentence ((α⊃β) ≡ (¬α∨β)) is
always true.

α β (α ⊃ β) ¬α (¬α∨β) ((α⊃β) ≡ (¬α∨β))


true true true false true true
false true true true true true
true false false false false true
false false true true true true

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Semantics of compound sentences
• The number of rows in the truth table is 2N for N input sentences.
• A compound sentence with three constituents

α β 𝛅 (α ⊃ β) ¬𝛅 ((α ⊃ β) ∨ ¬𝛅)
true true true true false true
false true true true false true
true false true false false false
false false true true false true
true true false true true true
false true false true true true
true false false false true true
false false false true true true

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Entailment Given that (α ⊃ β) is true
α β (α ⊃ β)
true true true
false true true
true false false
false false true

…and that α is true …and that β is true


α β (α ⊃ β) α β (α ⊃ β)
true true true true true true
false true true false true true
false false true false false true

β is necessarily true α can be true or α can be false


α β (α ⊃ β) α β (α ⊃ β)
true true true true true true
false true true

{(α ⊃ β), α} ⊨ β {(α ⊃ β), β} ⊭ α


Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
Patterns in Arguments … … from semantics to syntax
Given (α ⊃ β) Given (α ⊃ β)
and α and β
Infer β Infer α
Note that α and β are variables and can be substituted by any sentence.

From (α ⊃ β) From (α ⊃ β)
and α and β
Infer β Infer α
Sound rule of inference Not sound
Valid argument Invalid argument
{(α ⊃ β), α} ⊢ β {(α ⊃ β), β} ⊢ α
{(α ⊃ β), α} ⊨ β {(α ⊃ β), β} ⊭ α

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Deduction (α ⊃ β)
α
Most students of logic begin with Modus Ponens. β
We say that Modus Ponens is a sound rule of inference.
It is a valid pattern of deductive reasoning. Modus Ponens
It is entirely syntactic in nature – can be automated.
{(α ⊃ β), α} ⊢ β
It does not refer to truth values at all!

Question:
If we can establish a valid conclusion (entailment) by constructing a truth
table, why should we bother with derivation and proof?
• Because the number of rows in the truth table grows exponentially with
the number of ”variables”.
• And the number of columns grows linearly with the number of
connectives.
• Most importantly the truth table method does not apply to more
expressive logics.

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Abduction From (α ⊃ β) (α ⊃ β)
In contrast, the rule and β is not sound. β
Infer α α
That means that the conclusion is not necessarily true.
{(α ⊃ β), β} ⊬ α

For example, consider the following argument


1. If you water the garden (α), the lawn becomes wet (β).
2. The lawn is wet (β).
3. Therefore, (α) you watered the garden.

However, abductive inferences are commonplace in our lives!


Not least in (medical) diagnosis.
1. If you have Covid (α), then you have cough and fever (β).
2. You have cough and fever (β).
3. Therefore, (α) you have Covid. probabilistically
After making the inference a medic might advise a confirmatory test.

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Valid Rules of Inference
How does one know whether a rule of inference is valid / sound?

A rule {α, β} ⊢ 𝛅 is sound iff ((α ∧ β) ⊃ 𝛅) is true for all values of α, β, and 𝛅.

That is, if and only if ((α ∧ β) ⊃ 𝛅) is a tautology.

For Modus Ponens ((α ∧ (α ⊃ β)) ⊃ β) is a tautology as shown below.

α β (α ⊃ β) (α ∧ (α ⊃ β)) ((α ∧ (α ⊃ β)) ⊃ β)


true true true true true
false true true false true
true false false false true
false false true false true

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Some common valid rules of inference From α∨β
and ∼α .
From α⊃β From α⊃β From α
Infer β
and α . and ¬β . and β .
Disjuncuntive
Infer β Infer ¬α Infer α∧β
Syllogism (DS)
Modus Ponens (MP) Modus Tollens (MT) Conjunction (C)
From α⊃β
From α . From α∧β. and β⊃γ
Infer α∨β Infer α Infer α⊃γ
Addition (A) Simplification (S) Hypothetical
Syllogism (HS)
From (α ⊃ β) ∧ (γ ⊃ δ) From (α ⊃ β) ∧ (γ ⊃ δ)
and α∨γ . and ¬β ∨ ¬δ .
Infer β∨δ Infer ¬α ∨ ¬γ

Constructive Dilemma (CD) Destructive Dilemma (DD)

Exercise: Show that the above rules of inference are sound


Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
Rules of Substitution
A rule of substitution allows one to replace one sentence with another. This is
possible when one sentence is logically equivalent to another. As an example
let us look at the following equivalence.
((α⊃β) ≡ (¬α∨β))
If the above equivalence is a tautology, then the sentence (α⊃β) will always
take the same truth value as the sentence (¬α∨β).

Hence either of the two could be replaced by the other without any loss.

α β (α ⊃ β) ¬α (¬α∨β) ((α⊃β) ≡ (¬α∨β))


true true true false true true
false true true true true true
true false false false false true
false false true true true true

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Common rules of substitution (α ∨ true) ≡ true
(α ∨ false) ≡ α
α ≡ (α ∨ α) idempotence of ∨ (α ∧ true) ≡ α
α ≡ (α ∧ α) idempotence of ∧ (α ∧ false) ≡ false
(α ∨ β) ≡ (β ∨ α) commutativity of ∨ (α ∧ ¬α) ≡ false
(α ∧ β) ≡ (β ∧ α) commutativity of ∧ (α ∨ ¬α) ≡ true
((α ∨ β) ∨ γ) ≡ (α ∨ (β ∨ γ)) associativity of ∨ α ≡ ¬(¬α)
((α ∧ β) ∧ γ) ≡ (α ∧ (β ∧ γ)) associativity of ∧
¬(α ∨ β) ≡ (¬α ∧ ¬β) DeMorgan’s Law
¬(α ∧ β) ≡ (¬α ∨¬β) DeMorgan’s Law
(α ∧ (β ∨ γ)) ≡ ((α ∧ β) ∨ (α ∧ γ)) distributivity of ∧ over ∨
(α ∨ (β ∧ γ)) ≡ ((α ∨ β) ∧ (α ∨ γ)) distributivity of ∨ over ∧
(α ⊃ β) ≡ (¬β ⊃ ¬α) contrapositive
(α ⊃ β) ≡ (¬α ∨ β) implication
(α ≡ β) ≡ ((α ⊃ β) ∧ (β ⊃ α)) equivalence
((α ∧ β) ⊃ γ) ≡ (α ⊃ (β ⊃ γ)) exportation
((α ⊃ β) ∧ (α ⊃ ¬β)) ≡ ¬α absurdity
Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
Logic is Formal
From α∧β.
Consider the Simplification rule of inference: Infer α
Simplification (S)

Given (α ∧ β) can we infer β?

We should, but no hand waving like “you know what I mean” is allowed …

We must first employ the rule “commutativity of ∧”


to produce (β ∧ α) from (α ∧ β)
and then apply the Simplification rule,
because it says the first sentence in the conjunct can be inferred.

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Expressivity: Are all connectives needed?
• A binary connective ⚬ defines the semantics of the sentence (α ⚬ β).
• There are 16 ways in which the last column of the truth table for a binary connective.
• Exercise: Explore all the 16 connectives.
• Do we need all 16 connectives to express a compound sentence?

The answer is no.

Consider the tautological equivalence ((α⊃β) ≡ (¬α∨β)).


Wherever we have (α⊃β) in a compound sentence,
we can substitute it with (¬α∨β).

In this way the connective ⊃ can be eliminated.

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University


Expressivity: Complete Sets of Connectives
It can be shown that the following sets of connectives are sufficient to express
whatever can be expressed with other connectives.
{∧, ¬}, {∨, ¬}
{⊃, ¬} Gottlob Frege used this set in his Propositional Calculus
In practice we often use the set {∧, ∨, ¬} in our implementations.
Interestingly there are two singleton sets that are complete. They are,

NAND or Not-AND NOR or Not-OR or Joint Denial


α β (α ↑ β) α β (α ↓ β)
true true false true true false
false true true false true false
true false true true false false
false false true false false true

Also known as Sheffer Stroke Also known as Peirce's arrow


Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
Frege’s Propositional Calculus
• Given a set of axioms / premises which set of rules suffices to derive all entailments?
• Gottlob Frege showed that just one rule Modus Ponens with the set of connectives
{⊃, ¬} is complete, given the axioms below.
• Frege’s Propositional Calculus is an axiomatic system that can derive all true
statements or tautologies given the following axioms (accepted as true statements):

1. THEN-1 α ⊃ (β ⊃ α) Note that α and β are variables.


2. THEN-2 (α ⊃ (β ⊃ 𝛾)) ⊃ ((α ⊃ β) ⊃ (α ⊃ 𝛾))
3. THEN-3 (α ⊃ (β ⊃ 𝛾)) ⊃ (β ⊃ (α ⊃ 𝛾)) Redundant
4. FRG-1 (α ⊃ β) ⊃ (¬β ⊃ ¬α)
5. FRG-2 ¬¬α → α
6. FRG-3 α → ¬¬α

https://en.wikipedia.org/wiki/Frege_propositional_calculus
Knowledge Representation and Reasoning Deepak Khemani, Plaksha University
Next

PROPOSITIONAL LOGIC

Knowledge Representation and Reasoning Deepak Khemani, Plaksha University

You might also like