0% found this document useful (0 votes)
365 views

UNIT - II Part 1 LC& LP

This document provides an introduction to logic concepts and logic programming. It discusses: 1. Logic was originally considered a branch of philosophy concerned with drawing valid inferences from true statements. Symbolic logic includes propositional logic and predicate logic. 2. Propositional calculus uses logical operators and truth tables to evaluate formulas. Predicate logic extends propositional logic to represent relationships between objects using predicates. 3. Natural deduction systems, axiomatic systems, semantic tableaus, and resolution refutation are methods used in propositional and predicate logic to determine validity, satisfiability, and derivations. Logic programming is based on first-order predicate logic and represents programs as collections of clauses.

Uploaded by

Girish
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
365 views

UNIT - II Part 1 LC& LP

This document provides an introduction to logic concepts and logic programming. It discusses: 1. Logic was originally considered a branch of philosophy concerned with drawing valid inferences from true statements. Symbolic logic includes propositional logic and predicate logic. 2. Propositional calculus uses logical operators and truth tables to evaluate formulas. Predicate logic extends propositional logic to represent relationships between objects using predicates. 3. Natural deduction systems, axiomatic systems, semantic tableaus, and resolution refutation are methods used in propositional and predicate logic to determine validity, satisfiability, and derivations. Logic programming is based on first-order predicate logic and represents programs as collections of clauses.

Uploaded by

Girish
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

UNIT-II (PART-1)

LOGIC CONCEPTS & LOGIC PROGRAMMING)


2.1 Introduction
LOGIC

Logic was considered to be a branch of philosophy.


This formal logic has been studied in the context of foundations of mathematics, where it was
referred to as symbolic logic.
Formally, logic is concerned with the principles of drawing valid inferences from a given set of
true statements.
Symbolic logic is divided into two branches, namely.
1) Propositional Logic and
2) Predicate Logic
2.1Introduction
An extension to symbolic logic is mathematical logic, which is particularly concerned with the
study of proof theory, set theory, model theory, and recursion theory.
The field of logic is also concerned with properties such as validity, consistency, and inconsistency.
Logical systems should possess properties such as consistency, soundness and completeness.
Consistency implies that none of the theorems of the system should contradict each other.
Soundness means that the inference rules shall never allow a false inference from true premises.
Completeness means that there are no true sentences in the system that cannot be proved in the
system.
2.2 Propostional Calculus(PC)
PC refers to a language of propositions in which a set of rules are used to combine simple
propositions to form compound propositions with the help of certain logic operators.
These logical operators are called connectives
Ex: Λ, V, →, ↔, ~ (NOT)
In PC, it is extremely important to understand the concept of Well Formed Formula.
2.2.1 Well Formed Formula
A WFF is defined as a symbol or a string of symbols generated by the formal grammar of a
formal Language.
It has these properties.
1) The smallest unit (or an atom) is considered to be a WFF.
2) If α is a WFF, then ~ α is also a WFF
3) If α, β are WFF, then (αΛβ ),(αVβ ), (α→β), (α↔β ) are also WFF
2.2.2 Truth table
In PC, a Truth table is used to provide operational definitions of important logical operators. It
elaborates all possible truth values of a formula. The logical constants in PC are True (T) and
False (F).
A,B,C….. Are propositioned symbols.
LAWS OF PROPOSITION EQUIVALENCE
LAWS
PROPOSITIONAL LOGIC (PL)
PL deals with the validity, satisfiability and unsatisfiability of a formula and the derivation of a
new formula using Equivalence laws.
Each row of a truth table for a given formula α is called its interpretation under which the value
of a formula may be either True or False.
A Formula α is said to be a Tautology if and only if the value of α is true for all its interpretations.
PL
The Validity, Satisfiability and Unsatisfiability of a formula may be determined on the basis of the
following conditions:
1) A Formula α is said to be valid if and only if it is a Tautology.
2) A Formula α is said to be satisfiable if there exists atleast one interpretation for which α is
true.
3) A Formula α is said to be unsatisfiable if the value of α is false under all interpretations.
PL
Example: Show that the following is a valid argument:
“ If it is humid then it will rain and since it is humid today it will rain”
Sol: Symbolize each part of above sentence by Propositional Atoms as follows:
A: It is humid
B: It will rain
Now the formula(α) for above sentence is
α: [(A→B)ΛA]→B
Truth table for α: [(A→B)ΛA]→B
PL Limitation
The Truth table approach is a simple and Straight forward and is extremely useful at presenting
an overview of all the truth values in a given situation.
Although it is an easy method for evaluating consistency, inconsistency or validity of a formula,
the limitation of this method lies in the fact that the size of the truth table grows exponentially.
i.e, if a formula contains n atoms then the truth table contains 2^n entries.
Other methods
There are some other methods which can help in proving the validity of the formula directly.
They are:
1) Natural Deduction system
2)Axiomatic System
3)Semantic Tableau method
4)Resolution refutation method.
The NDS & AS methods use forward chaining approach for constructing proofs and derivations.
The STM and RRM follow backward chaining approach.
Natural Deduction System (NDS)
NDS is thus called because of the fact that it mimics the pattern of natural reasoning.
This system is based on a set of deductive inference rules.
Assuming that A1,….Ak, where 1≤k≤n, are a set of atoms and α,β are WFF, the inference rules
are tabulated as shown below:
NDS Rules Table(1)
NDS Rules Table(2)
NDS
A Theorem in NDS is written as ” from α1…….αn infer β ” which leads to the interpretation that β
is deduced from a set of hypotheses {α1…….αn }.
All hypotheses are assumed to be true in a given context and therefore the theorem β is also
true in the same context. Thus, we can conclude that β is consistent.
A theorem that is written as infer β implies that there are no hypotheses and β is true under all
interpretations, i.e, β is a tautology or valid.
The conventions used in the proof of NDS are:
1. The ‘Description’ column consists of rules applied on a sub expression in the proof line.
2. The second column consists the sub expression obtained after applying an appropriate rule.
3. The final column consists the line number of subexpressions in the proof.
Example: Prove that AΛ(BVC) is deduced from AΛB
Deduction Theorem
To prove a formula α1Λ…..Λ αn→β, it is sufficient to prove a theorem from α1…….αn infer β .
Conversely, if α1Λ…..Λ αn→β is proved then theorem from α1…….αn infer β is assumed to be
proved.
Example :
Axiomatic System
The axiomatic system is based on a set of three axioms and rule of deduction.
In axiomatic system, the proofs of the theorems are often difficult and require a guess in
selection of appropriate axiom(s).
In this system, only two logical operators not(~) and implies(→) are allowed to form a formula.
In axiomatic system, there are three axioms, which are always true(or valid), and one rule called
modusponen(MP).
Here α, β and γ are WFF of the axiomatic system. The three axioms and the rule are stated as:
Example
Semantic Tableau system in PL
In STM, a set of rules are applied systematically on a formula or a set of formulae in order to
establish consistency or inconsistency.
Semantic Tableau is a binary tree which is constructed by using semantic tableau rules with a
formula as a root.
A path is said to be contradictory or closed (finished) whenever complementary atoms (A, ~A)
appear in the same path of a semantic tableau. Otherwise, It is open.
A formula is satisfiable if its semantic tableau has atleast one open path.
A formula is unsatisfiable if its semantic table is condractictory or closed.
Resolution Refutation in Propositional Logic

RRM is a method to prove a formula or derive a goal from a given set of clauses by contradiction.
The term clause is used to denote a special formula containing the Boolean operators ~ and V.
Any given formula can be easily converted into a set of clauses.
Resolution refutation is the most favoured method for developing computer based systems that
can be used to prove theorems automatically.
It uses a single inference rule , which is known as Resolution based on modus ponen inference
rule.
It is more efficient in comparison to NDS and Axiomatic system because in this case we do not
need to guess which rule or axiom to apply in development of proofs.
During resolution, we need to identify two clauses: one with a positive atom (P) and the other
with a negative atom (~P) for the application of resolution rule.
Conversion of a formula into a set of
clauses
In PL, there are two normal forms, namely, Disjunctive normal form
(DNF) and Conjunctive normal Form (CNF)
A formula is said to be in its normal formif it is constructedusing only natural connectives {~,Λ,V}
In DNF, the formula is represented as Disjunction of conjunction that is in the form
(L1Λ….Ln)V………V(Ln1Λ……ΛLnn). Ex: (AΛB)V(CΛD)V(EΛ~F)
In CNF, the formula is represented as Conjnunction of Disjunction that is in the form
(L1V….VLn) Λ…. Λ(Ln1V…VLnn). Ex: (AVB) Λ(CVD) Λ~E
Formally a clause is defined as a formula of the form(L1VL2V….VLn). Hence Λ (Conjunction)
of these clauses is the conjunction NF.
Conversion of a formula into its CNF
Example:
Predicate Logic
There are many limitations with propositional logic.
For example, we cannot find the similarities between the given set of propositions
A- John is a boy
B- Peter is a boy
C- Paul is a boy.
PL cannot represent the similarity that John, Peter and Paul are boys.
This can be represented in predicate logic as boy(A) , boy(B), boy(C) and general statement for this
was boy(X) where X is a variable bounded with John, Paul and Peter which are instances of boy(X)
The statement boy(X) is called a predicate statement or expression. Here boy is a predicate symbol
and Xis its argument.
Boy(X) becomes true or false based on X values Ex: boy(Peter)=True, boy(Mary)=False.
The Predicate Logic is a Logical Extension to Propositional Logic which deals with the validity,
satisfiability and unsatisfiability of a formula along with the inference rules for derivation of new
formula.
Predicate Calculus
Predicate Calculus is the study of predicate systems; When the inference rules are added to
predicate calculus, it becomes predicate logic.
WFF(Predicate Calculus)
Examples
1)“X is a brother of Y”
Brother(X,Y)
2)Peter loves his son
Love(Peter, son(Peter))
3) Every human is mortal
(ꓯX)(human(X)←mortal(X))
First Order Predicate Calculus.
If the quantification in predicate formula is only on simple variables and on predicates or
functions then it is called FOPC
If the quantification is over first order predicates and functions then it becomes second order
predicate calculus.
Ex: ꓯp(p(X)↔p(Y)) is a SOPC statement
ꓯXꓯY(p(X)↔p(Y)) is a FOPC statement.
Example
Prenex Normal Form
PNF
Logic Programming
LP was first introduced by Kowalski in 1974 and Colmerauer in 1973. It is based on FOL.
In LP, a program is usually a collection of program clauses.
A clause of FOL is represented in clausal notation in Logic programming.
Clausal notation is written in the form
P1,…..Pk←N1,….Nk
Where Pi are positive literals
Ni are negative literals.
The goals or queries are solved, derived or proved from a logic program using resolution
principle.

You might also like