SlideShare a Scribd company logo
1 of 39
Logic in Computer Science
CS 19.305
Logic in Computer Science
Text Books:
1. Huth M and Ryan M, Logic in Computer Science: Modelling
and Reasoning about Systems, Cambridge University Press
2. Enderton H B, A Mathematical Introduction to Logic,
Academic Press, 2nd edition, 2001.
Reference Books:
1. Arindama Singh, Logics for Computer Science, Prentice Hall
of India, 1st edition, 2004.
2. M. Ben-Ari, Mathematical Logic for Computer Science,
Springer, 2nd edition, 2003.
3. 3. Rich E., and Knight K., Artificial Intelligence, Tata
McGraw-Hill, 3rd edition, 2009.
4. C. L. Chang and R. C. T. Lee, Symbolic Logic and Mechanical
Theorem Proving, Academic Press
Logic evolution
 In the early years of this century symbolic or formal
logic became quite popular with philosophers and
mathematicians because they were interested in
the concept of what constitutes a correct proof in
mathematics.
 Concept of logic then hinged upon what is a correct
argument as opposed to a wrong (or faulty)
 Logic is the science of the correctness or
incorrectness of reasoning, or the study of the
evaluation of arguments.
 Different so-called proofs that have come up for
Euclid’s parallel postulate and for Fermat’s last
theorem.
 There have invariably been “bugs”
(a term popularized by computer scientists for the
faults in a program)
 which were often very hard to detect and it was
necessary therefore to find infallible methods of
proof.
 The early logicians of the nineteenth and twentieth
centuries hoped to establish formal logic as a
foundation for mathematics, though that never
really happened.
 But mathematics does rest on one firm
foundation, namely set theory.
 Set theory itself has been expressed in first order
logic.
 What really needed to be answered were
questions relating to the automation or
mechanizability of proofs.
 Very relevant for today’s computers
 David Hilbert asked the important question,
 if all the statements are reduced to symbolic logic,
then can it be derived by a machine?
 Latter half of the twentieth century logic has been
used in computer science for various purposes
ranging from program specification and
verification to theorem-proving.
 Initially its use was restricted to merely specifying
programs and reasoning about their
implementations.
 This is exemplified in the some fairly elegant
research on the development of correct programs
using first-order logic in such calculi such as the
weakest-precondition calculus of Dijkstra.
 Amethod called Hoare Logic which combines
first-order logic sentences and program phrases
into a specification and reasoning mechanism is
also quite useful in the development of small
programs.
 Logic in this form has also been used to specify
the meanings of some programming languages,
notably Pascal.
 The close link between logic as a formal system
and computer-based theorem proving is proving
to be very useful especially where there are a
large number of cases.
Logic evolution
 In the early years of this century symbolic or formal
logic became quite popular with philosophers and
mathematicians because they were interested in
the concept of what constitutes a correct proof in
mathematics
 Concept of logic then hinged upon what is a correct
argument as opposed to a wrong (or faulty)
 Logic is the science of the correctness or
incorrectness of reasoning, or the study of the
evaluation of arguments.
What is Logic in Computer
Science ?
 Logical formalisms are applied in many areas of
computer science.
 The extensive use of those formalisms resulted in
defining hundreds of logics that fit nicely to
particular application areas.
First the role of logic in the clarification of human
reasoning
 First, decide what is the subject of reasoning
or, in other words, what are we going to talk about
and what language are we going to use
What is Logic in Computer
Science ?
 The next step is to associate a precise meaning to
basic notions of the language, in order to avoid
ambiguities and misunderstandings.
 First, decide what is the subject of reasoning
or, in other words, what are we going to talk about
and what language are we going to use
 state clearly what kind of opinions (sentences),
 which of those opinions are true (valid), and which
are false (invalid).
What is Logic in Computer
Science ?
 Traditionally, there are two methodologies to
introduce a logic:
 syntactically, via a notion of a proof and proof
system
 semantically, via a notion of a model,
satisfiability and truth
 Both methodologies first require to chose a
language that suits best a particular application
 a sentence (formula) is considered valid provided
that it can be proved (syntactical approach)
What is Logic in Computer
Science ?
or it is valid in models accepted as semantical
structures (semantical approach).
 Logic dealt with arguments in the natural language
used by humans.
Example
 All men are mortal. P (Socrates) mortal
 Socrates is a man
 Therefore, Socrates is mortal
What is Logic in Computer
Science ?
 In computer science, we design and study
systems through the use of formal languages that
can themselves be interpreted by a formal system.
Example
Boolean circuits
Programming languages
Design Validation and verification
AI, Security. Etc.
What is Logic in Computer
Science ?
 Different logics in computer science
Example
Boolean circuits
Propositional Logic
First Order Logic
Higher Order Logic
Theory of Construction
Real-time Logic, Temporal Logic
ProcessAlgebras
Linear Logic
Summary
 Logic is a tool for working with complicated
compound statements. It includes:
 A language for expressing them.
 A concise notation for writing them.
 A methodology for objectively reasoning about
their truth or falsity.
 It is the foundation for expressing formal proofs
in all branches of mathematics.
Components
 Propositional logic
Basic definitions
Equivalence rules & derivations
 Predicate logic
Predicates
Quantified predicate expressions.
Equivalences & derivations.
Propositional Logic
 Propositional Logic is the logic of compound
statements built from simpler statements
using so-called Boolean connectives.
 Some applications in computer science:
Design of digital electronic circuits.
Expressing conditions in programs.
Queries to databases & search engines.
George Boole
(1815-1864)
Chrysippus of Soli
(ca. 281 B.C. – 205 B.C.)
Propositional Logic
 A proposition (p, q, r, …) is simply a statement
(i.e., a declarative sentence) with a definite
meaning, having a truth value that’s either true
(T) or false (F) (never both, neither, or
somewhere in between).
 However, you might not know the actual truth
value, and it might be situation-dependent.
 Later we will study probability theory, in which
we assign degrees of certainty to propositions.
But for now: think True/False only
Examples Propositional Logic
 “It is raining.” (In a given situation.)
 “Colombo is the capital of Sri Lanka.”
 • “1 + 2 = 3”
 But, the following are NOT propositions:
•“Who’s there?” (interrogative, question)
•“La la la la la.” (meaningless interjection)
•“Just do it!” (imperative, command)
•“Yeah, I sorta dunno, whatever...” (vague)
•“1 + 2” (expression with a non-true/false value)
Predicate logic
 Predicate logic is an extension of propositional
logic that permits concisely reasoning about
whole classes of entities.
 Propositional logic (recall) treats simple
propositions (sentences) as atomic entities.
 In contrast, predicate logic distinguishes the
subject of a sentence from its predicate.
 Remember these English grammar terms?
Predicate logic
 It is the formal notation for writing perfectly clear,
concise, and unambiguous mathematical
definitions, axioms, and theorems for any
branch of mathematics.
 It is the foundation of the field of mathematical
logic, which culminated in Gödel’s
incompleteness theorem, which revealed the
ultimate limits of mathematical thought:
Kurt Gödel
1906-1978
Predicate logic
 Given any finitely describable, consistent proof
procedure, there will still be some true
statements that can never be proven by that
procedure.
 We can’t discover all mathematical truths,
unless we sometimes resort to making guesses
Predicate logic Applications
 Basis for clearly expressed formal specifications
for any complex system.
 Basis for automatic theorem provers and many
other Artificial Intelligence systems.
 Supported by some of the more sophisticated
database query engines and container class
libraries (these are types of programming tools).
Example Predicate logic
 In the sentence “The dog is sleeping”
 The phrase “the dog” denotes the subject -
the object or entity that the sentence is about.
 The phrase “is sleeping” denotes the predicate-
a property that is true of the subject.
 In predicate logic, a predicate is modeled as a
function P(·) from objects to propositions.
 P(x) = “x is sleeping” (where x is any object).
Example Predicate logic
 Convention: Lowercase variables x, y, z...
denote objects/entities; uppercase variables P,
Q, R… denote propositional functions
(predicates).
 Keep in mind that the result of applying a
predicate P to an object x is the proposition P(x).
But the predicate P itself (e.g. P=“is sleeping”) is
not a proposition (not a complete sentence).
 E.g. if P(x) = “x is a prime number”,
P(3) is the proposition “3 is a prime number”.
Example Predicate logic
 Predicate logic generalizes the grammatical notion
of a predicate to also include propositional
functions of any number of arguments, each of
which may take any grammatical role that a noun
can take.
E.g. let P(x, y, z) = “x gave y the grade z”, then
P(x, y, z) = “Mike gave Mary the grade A”
x can fool y at time z
If x=“”, y=“”, z=“”, then
Mathematical Induction
 Mathematical Induction is a method of
mathematical proof typically used to establish
that a given statement is true for all natural
numbers.
 Mathematical induction is a mathematical
proof technique. It is essentially used to prove
that a statement P(n) holds for every natural
number n = 0, 1, 2, 3, . . . ; that is, the overall
statement is a sequence of infinitely many
cases P(0), P(1), P(2), P(3), . . . . Informal
metaphors help to explain this technique, such
as falling dominoes or climbing a ladder:
Mathematical Induction
 It is a method of mathematical
proof typically used to establish
that a given statement is true of
all natural numbers.
 A method of proof
It does not generate answers:
it only can prove them
Mathematical Induction
 It works in three parts:
 Base case(s): show it is true for one element
 Inductive hypothesis: assume it is true for any
given element, Must be clearly labeled!!!
 Show that if it is true for the next highest element
Mathematical Induction
 Mathematical induction is a legitimate method
of proof for all positive integers n
 Principle:
Let Pn be a statement involving n, a positive
integer. If
1. P1 is true, and
2. the truth of Pk implies the truth of Pk + 1 for
every positive k,
then Pn must be true for all positive integers n.
 Question: 1.1
Use mathematical induction to prove
Sn = 2 + 4 + 6 + 8 + . . . + 2n = n(n + 1)
for every positive integer n.
Mathematical Induction
 Question: 1.1
Use mathematical induction to prove
Sn = 2 + 4 + 6 + 8 + . . . + 2n = n(n + 1)
for every positive integer n.
Step 1. Show that the formula is true when n = 1.
S1 = n(n + 1) = 1(1 + 1) = 2 is True
Step 2. Assume the formula is valid for some integer k.
Use this assumption to prove the formula is valid for
the next integer, k + 1 and show that the formula
Sk + 1 = (k + 1)(k + 2) is true
Mathematical Induction
Let’s assume
Sk = 2 + 4 + 6 + 8 + . . . + 2k = k(k + 1) // assuming that it will hold
Now,
Sk + 1 = 2 + 4 + 6 + 8 + . . . + 2k + [2(k + 1)]
= 2 + 4 + 6 + 8 + . . . + 2k + (2k + 2)
=Sk + (2k + 2)
= k(k + 1) + (2k + 2) Replace Sk by k(k + 1).
= k2 + k + 2k + 2
= k2 + 3k + 2
= (k + 1)(k + 2)
= (k + 1)((k + 1)+1)
The formula Sn = n(n + 1) is valid for all positive integer values of n.
Question:1.2
Prove that the sum of the first n natural numbers
is given by this formula:
1 + 2 + 3 + . . . + n = n(n + 1)
2
Mathematical Induction
Question:1.2 Prove that the sum of the first n natural numbers
is given by this formula:
1 + 2 + 3 + . . . + n = n(n + 1)
2
First, we will assume that the formula is true for n = k; that is,
we will assume:
1 + 2 + 3 + . . . + k = k(k + 1)
2 (1)
This is the induction assumption. Assuming this, we must prove
that the formula is true for its successor, n = k + 1. That is, we
must show:
1 + 2 + 3 + . . . + (k + 1) = (k + 1)(k + 2)
2 (2)
Mathematical Induction
To do that, we will simply add the next term (k + 1) to
both sides of the induction assumption in equation 1
1 + 2 + 3 + . . . + k+ (k+1) = k(k + 1) + (k+1)
2
= k(k + 1) + 2(k+1)
2
= (k + 1)(k+2)
2
(on taking (k+1) as a common factor)
Does it corresponds to equation 2; Yes ; Its true
Mathematical Induction
Assignments
1.3 Prove that
12 + 22 + 32 + ... + n2 = n (n + 1) (2n + 1)/ 6
For all positive integers n.
1.4 Use mathematical induction to prove that
13 + 23 + 33 + ... + n3 = n2 (n + 1)2 / 4
for all positive integers n.

More Related Content

What's hot

SOP POS, Minterm and Maxterm
SOP POS, Minterm and MaxtermSOP POS, Minterm and Maxterm
SOP POS, Minterm and MaxtermSelf-employed
 
Predicates and Quantifiers
Predicates and QuantifiersPredicates and Quantifiers
Predicates and Quantifiersblaircomp2003
 
Lec 01 proposition (Discrete Mathematics)
Lec 01   proposition (Discrete Mathematics)Lec 01   proposition (Discrete Mathematics)
Lec 01 proposition (Discrete Mathematics)Naosher Md. Zakariyar
 
Translating English to Propositional Logic
Translating English to Propositional LogicTranslating English to Propositional Logic
Translating English to Propositional LogicJanet Stemwedel
 
Discrete structures & optimization unit 1
Discrete structures & optimization unit 1Discrete structures & optimization unit 1
Discrete structures & optimization unit 1SURBHI SAROHA
 
NLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishNLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishHemantha Kulathilake
 
Lec 02 logical eq (Discrete Mathematics)
Lec 02   logical eq (Discrete Mathematics)Lec 02   logical eq (Discrete Mathematics)
Lec 02 logical eq (Discrete Mathematics)Naosher Md. Zakariyar
 
Discrete Mathematics
Discrete MathematicsDiscrete Mathematics
Discrete Mathematicsmetamath
 
Algorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to AlgorithmsAlgorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to AlgorithmsMohamed Loey
 
Discrete Math Lecture 01: Propositional Logic
Discrete Math Lecture 01: Propositional LogicDiscrete Math Lecture 01: Propositional Logic
Discrete Math Lecture 01: Propositional LogicIT Engineering Department
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchartSachin Goyani
 
Cryptography and applications
Cryptography and applicationsCryptography and applications
Cryptography and applicationsthai
 
Discrete Mathematics Lecture
Discrete Mathematics LectureDiscrete Mathematics Lecture
Discrete Mathematics LectureGenie Rose Santos
 

What's hot (20)

Boolean Algebra
Boolean AlgebraBoolean Algebra
Boolean Algebra
 
SOP POS, Minterm and Maxterm
SOP POS, Minterm and MaxtermSOP POS, Minterm and Maxterm
SOP POS, Minterm and Maxterm
 
Linguistic hedges in fuzzy logic
Linguistic hedges in fuzzy logicLinguistic hedges in fuzzy logic
Linguistic hedges in fuzzy logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Predicates and Quantifiers
Predicates and QuantifiersPredicates and Quantifiers
Predicates and Quantifiers
 
Lec 01 proposition (Discrete Mathematics)
Lec 01   proposition (Discrete Mathematics)Lec 01   proposition (Discrete Mathematics)
Lec 01 proposition (Discrete Mathematics)
 
Translating English to Propositional Logic
Translating English to Propositional LogicTranslating English to Propositional Logic
Translating English to Propositional Logic
 
Introduction to Algorithm
Introduction to AlgorithmIntroduction to Algorithm
Introduction to Algorithm
 
Discrete structures & optimization unit 1
Discrete structures & optimization unit 1Discrete structures & optimization unit 1
Discrete structures & optimization unit 1
 
NLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishNLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for English
 
Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
 
Lec 02 logical eq (Discrete Mathematics)
Lec 02   logical eq (Discrete Mathematics)Lec 02   logical eq (Discrete Mathematics)
Lec 02 logical eq (Discrete Mathematics)
 
Discrete Mathematics
Discrete MathematicsDiscrete Mathematics
Discrete Mathematics
 
Algorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to AlgorithmsAlgorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to Algorithms
 
BOOLEAN ALGEBRA & LOGIC GATE
BOOLEAN ALGEBRA & LOGIC GATEBOOLEAN ALGEBRA & LOGIC GATE
BOOLEAN ALGEBRA & LOGIC GATE
 
Discrete Math Lecture 01: Propositional Logic
Discrete Math Lecture 01: Propositional LogicDiscrete Math Lecture 01: Propositional Logic
Discrete Math Lecture 01: Propositional Logic
 
Predicate logic
 Predicate logic Predicate logic
Predicate logic
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Cryptography and applications
Cryptography and applicationsCryptography and applications
Cryptography and applications
 
Discrete Mathematics Lecture
Discrete Mathematics LectureDiscrete Mathematics Lecture
Discrete Mathematics Lecture
 

Similar to Lecture 1-3-Logics-In-computer-science.pptx

Lecture 2: From Semantics To Semantic-Oriented Applications
Lecture 2: From Semantics To Semantic-Oriented ApplicationsLecture 2: From Semantics To Semantic-Oriented Applications
Lecture 2: From Semantics To Semantic-Oriented ApplicationsMarina Santini
 
Artificial intelligence and first order logic
Artificial intelligence and first order logicArtificial intelligence and first order logic
Artificial intelligence and first order logicparsa rafiq
 
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxRuchitaMaaran
 
Discrete Mathematics Lecture Notes
Discrete Mathematics Lecture NotesDiscrete Mathematics Lecture Notes
Discrete Mathematics Lecture NotesFellowBuddy.com
 
LOGIC-PRESENTATION.pptx
LOGIC-PRESENTATION.pptxLOGIC-PRESENTATION.pptx
LOGIC-PRESENTATION.pptxAlfredoAmango
 
CSC375CSCM75Logic for Computer ScienceUlrich Berger.docx
CSC375CSCM75Logic for Computer ScienceUlrich Berger.docxCSC375CSCM75Logic for Computer ScienceUlrich Berger.docx
CSC375CSCM75Logic for Computer ScienceUlrich Berger.docxfaithxdunce63732
 
Ai lecture 07(unit03)
Ai lecture  07(unit03)Ai lecture  07(unit03)
Ai lecture 07(unit03)vikas dhakane
 
Knowledege Representation.pptx
Knowledege Representation.pptxKnowledege Representation.pptx
Knowledege Representation.pptxArslanAliArslanAli
 
Like Alice in Wonderland: Unraveling Reasoning and Cognition Using Analogies ...
Like Alice in Wonderland: Unraveling Reasoning and Cognition Using Analogies ...Like Alice in Wonderland: Unraveling Reasoning and Cognition Using Analogies ...
Like Alice in Wonderland: Unraveling Reasoning and Cognition Using Analogies ...Facultad de Informática UCM
 
Ai lecture 09(unit03)
Ai lecture  09(unit03)Ai lecture  09(unit03)
Ai lecture 09(unit03)vikas dhakane
 
First order predicate logic(fopl)
First order predicate logic(fopl)First order predicate logic(fopl)
First order predicate logic(fopl)surbhi jha
 
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITSA NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITSijasuc
 
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITSA NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITSijwscjournal
 
A Natural Logic for Artificial Intelligence, and its Risks and Benefits
A Natural Logic for Artificial Intelligence, and its Risks and Benefits A Natural Logic for Artificial Intelligence, and its Risks and Benefits
A Natural Logic for Artificial Intelligence, and its Risks and Benefits gerogepatton
 
Automated Education Propositional Logic Tool (AEPLT): Used For Computation in...
Automated Education Propositional Logic Tool (AEPLT): Used For Computation in...Automated Education Propositional Logic Tool (AEPLT): Used For Computation in...
Automated Education Propositional Logic Tool (AEPLT): Used For Computation in...CSCJournals
 
Foundation_Logic_1.pptx discrete mathematics
Foundation_Logic_1.pptx discrete mathematicsFoundation_Logic_1.pptx discrete mathematics
Foundation_Logic_1.pptx discrete mathematicsSherwinSangalang3
 
1194Propositional Logicflytosky11iStockThinkstock.docx
1194Propositional Logicflytosky11iStockThinkstock.docx1194Propositional Logicflytosky11iStockThinkstock.docx
1194Propositional Logicflytosky11iStockThinkstock.docxmoggdede
 
Knowledge representation using predicate logic
Knowledge representation using predicate logicKnowledge representation using predicate logic
Knowledge representation using predicate logicHarshitaSharma285596
 

Similar to Lecture 1-3-Logics-In-computer-science.pptx (20)

Lecture 2: From Semantics To Semantic-Oriented Applications
Lecture 2: From Semantics To Semantic-Oriented ApplicationsLecture 2: From Semantics To Semantic-Oriented Applications
Lecture 2: From Semantics To Semantic-Oriented Applications
 
Artificial intelligence and first order logic
Artificial intelligence and first order logicArtificial intelligence and first order logic
Artificial intelligence and first order logic
 
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
 
Discrete Mathematics Lecture Notes
Discrete Mathematics Lecture NotesDiscrete Mathematics Lecture Notes
Discrete Mathematics Lecture Notes
 
LOGIC-PRESENTATION.pptx
LOGIC-PRESENTATION.pptxLOGIC-PRESENTATION.pptx
LOGIC-PRESENTATION.pptx
 
CSC375CSCM75Logic for Computer ScienceUlrich Berger.docx
CSC375CSCM75Logic for Computer ScienceUlrich Berger.docxCSC375CSCM75Logic for Computer ScienceUlrich Berger.docx
CSC375CSCM75Logic for Computer ScienceUlrich Berger.docx
 
Ai lecture 07(unit03)
Ai lecture  07(unit03)Ai lecture  07(unit03)
Ai lecture 07(unit03)
 
Knowledege Representation.pptx
Knowledege Representation.pptxKnowledege Representation.pptx
Knowledege Representation.pptx
 
A career in Mathematics
A career in MathematicsA career in Mathematics
A career in Mathematics
 
Like Alice in Wonderland: Unraveling Reasoning and Cognition Using Analogies ...
Like Alice in Wonderland: Unraveling Reasoning and Cognition Using Analogies ...Like Alice in Wonderland: Unraveling Reasoning and Cognition Using Analogies ...
Like Alice in Wonderland: Unraveling Reasoning and Cognition Using Analogies ...
 
Ai lecture 09(unit03)
Ai lecture  09(unit03)Ai lecture  09(unit03)
Ai lecture 09(unit03)
 
First order predicate logic(fopl)
First order predicate logic(fopl)First order predicate logic(fopl)
First order predicate logic(fopl)
 
01bkb04p.ppt
01bkb04p.ppt01bkb04p.ppt
01bkb04p.ppt
 
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITSA NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
 
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITSA NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
A NATURAL LOGIC FOR ARTIFICIAL INTELLIGENCE, AND ITS RISKS AND BENEFITS
 
A Natural Logic for Artificial Intelligence, and its Risks and Benefits
A Natural Logic for Artificial Intelligence, and its Risks and Benefits A Natural Logic for Artificial Intelligence, and its Risks and Benefits
A Natural Logic for Artificial Intelligence, and its Risks and Benefits
 
Automated Education Propositional Logic Tool (AEPLT): Used For Computation in...
Automated Education Propositional Logic Tool (AEPLT): Used For Computation in...Automated Education Propositional Logic Tool (AEPLT): Used For Computation in...
Automated Education Propositional Logic Tool (AEPLT): Used For Computation in...
 
Foundation_Logic_1.pptx discrete mathematics
Foundation_Logic_1.pptx discrete mathematicsFoundation_Logic_1.pptx discrete mathematics
Foundation_Logic_1.pptx discrete mathematics
 
1194Propositional Logicflytosky11iStockThinkstock.docx
1194Propositional Logicflytosky11iStockThinkstock.docx1194Propositional Logicflytosky11iStockThinkstock.docx
1194Propositional Logicflytosky11iStockThinkstock.docx
 
Knowledge representation using predicate logic
Knowledge representation using predicate logicKnowledge representation using predicate logic
Knowledge representation using predicate logic
 

Recently uploaded

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 

Recently uploaded (20)

young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 

Lecture 1-3-Logics-In-computer-science.pptx

  • 2.
  • 3. CS 19.305 Logic in Computer Science Text Books: 1. Huth M and Ryan M, Logic in Computer Science: Modelling and Reasoning about Systems, Cambridge University Press 2. Enderton H B, A Mathematical Introduction to Logic, Academic Press, 2nd edition, 2001. Reference Books: 1. Arindama Singh, Logics for Computer Science, Prentice Hall of India, 1st edition, 2004. 2. M. Ben-Ari, Mathematical Logic for Computer Science, Springer, 2nd edition, 2003. 3. 3. Rich E., and Knight K., Artificial Intelligence, Tata McGraw-Hill, 3rd edition, 2009. 4. C. L. Chang and R. C. T. Lee, Symbolic Logic and Mechanical Theorem Proving, Academic Press
  • 4. Logic evolution  In the early years of this century symbolic or formal logic became quite popular with philosophers and mathematicians because they were interested in the concept of what constitutes a correct proof in mathematics.  Concept of logic then hinged upon what is a correct argument as opposed to a wrong (or faulty)  Logic is the science of the correctness or incorrectness of reasoning, or the study of the evaluation of arguments.
  • 5.  Different so-called proofs that have come up for Euclid’s parallel postulate and for Fermat’s last theorem.  There have invariably been “bugs” (a term popularized by computer scientists for the faults in a program)  which were often very hard to detect and it was necessary therefore to find infallible methods of proof.
  • 6.  The early logicians of the nineteenth and twentieth centuries hoped to establish formal logic as a foundation for mathematics, though that never really happened.  But mathematics does rest on one firm foundation, namely set theory.  Set theory itself has been expressed in first order logic.  What really needed to be answered were questions relating to the automation or mechanizability of proofs.  Very relevant for today’s computers
  • 7.  David Hilbert asked the important question,  if all the statements are reduced to symbolic logic, then can it be derived by a machine?  Latter half of the twentieth century logic has been used in computer science for various purposes ranging from program specification and verification to theorem-proving.  Initially its use was restricted to merely specifying programs and reasoning about their implementations.
  • 8.  This is exemplified in the some fairly elegant research on the development of correct programs using first-order logic in such calculi such as the weakest-precondition calculus of Dijkstra.  Amethod called Hoare Logic which combines first-order logic sentences and program phrases into a specification and reasoning mechanism is also quite useful in the development of small programs.  Logic in this form has also been used to specify the meanings of some programming languages, notably Pascal.
  • 9.  The close link between logic as a formal system and computer-based theorem proving is proving to be very useful especially where there are a large number of cases.
  • 10. Logic evolution  In the early years of this century symbolic or formal logic became quite popular with philosophers and mathematicians because they were interested in the concept of what constitutes a correct proof in mathematics  Concept of logic then hinged upon what is a correct argument as opposed to a wrong (or faulty)  Logic is the science of the correctness or incorrectness of reasoning, or the study of the evaluation of arguments.
  • 11. What is Logic in Computer Science ?  Logical formalisms are applied in many areas of computer science.  The extensive use of those formalisms resulted in defining hundreds of logics that fit nicely to particular application areas. First the role of logic in the clarification of human reasoning  First, decide what is the subject of reasoning or, in other words, what are we going to talk about and what language are we going to use
  • 12. What is Logic in Computer Science ?  The next step is to associate a precise meaning to basic notions of the language, in order to avoid ambiguities and misunderstandings.  First, decide what is the subject of reasoning or, in other words, what are we going to talk about and what language are we going to use  state clearly what kind of opinions (sentences),  which of those opinions are true (valid), and which are false (invalid).
  • 13. What is Logic in Computer Science ?  Traditionally, there are two methodologies to introduce a logic:  syntactically, via a notion of a proof and proof system  semantically, via a notion of a model, satisfiability and truth  Both methodologies first require to chose a language that suits best a particular application  a sentence (formula) is considered valid provided that it can be proved (syntactical approach)
  • 14. What is Logic in Computer Science ? or it is valid in models accepted as semantical structures (semantical approach).  Logic dealt with arguments in the natural language used by humans. Example  All men are mortal. P (Socrates) mortal  Socrates is a man  Therefore, Socrates is mortal
  • 15. What is Logic in Computer Science ?  In computer science, we design and study systems through the use of formal languages that can themselves be interpreted by a formal system. Example Boolean circuits Programming languages Design Validation and verification AI, Security. Etc.
  • 16. What is Logic in Computer Science ?  Different logics in computer science Example Boolean circuits Propositional Logic First Order Logic Higher Order Logic Theory of Construction Real-time Logic, Temporal Logic ProcessAlgebras Linear Logic
  • 17. Summary  Logic is a tool for working with complicated compound statements. It includes:  A language for expressing them.  A concise notation for writing them.  A methodology for objectively reasoning about their truth or falsity.  It is the foundation for expressing formal proofs in all branches of mathematics.
  • 18. Components  Propositional logic Basic definitions Equivalence rules & derivations  Predicate logic Predicates Quantified predicate expressions. Equivalences & derivations.
  • 19. Propositional Logic  Propositional Logic is the logic of compound statements built from simpler statements using so-called Boolean connectives.  Some applications in computer science: Design of digital electronic circuits. Expressing conditions in programs. Queries to databases & search engines. George Boole (1815-1864) Chrysippus of Soli (ca. 281 B.C. – 205 B.C.)
  • 20. Propositional Logic  A proposition (p, q, r, …) is simply a statement (i.e., a declarative sentence) with a definite meaning, having a truth value that’s either true (T) or false (F) (never both, neither, or somewhere in between).  However, you might not know the actual truth value, and it might be situation-dependent.  Later we will study probability theory, in which we assign degrees of certainty to propositions. But for now: think True/False only
  • 21. Examples Propositional Logic  “It is raining.” (In a given situation.)  “Colombo is the capital of Sri Lanka.”  • “1 + 2 = 3”  But, the following are NOT propositions: •“Who’s there?” (interrogative, question) •“La la la la la.” (meaningless interjection) •“Just do it!” (imperative, command) •“Yeah, I sorta dunno, whatever...” (vague) •“1 + 2” (expression with a non-true/false value)
  • 22. Predicate logic  Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities.  Propositional logic (recall) treats simple propositions (sentences) as atomic entities.  In contrast, predicate logic distinguishes the subject of a sentence from its predicate.  Remember these English grammar terms?
  • 23. Predicate logic  It is the formal notation for writing perfectly clear, concise, and unambiguous mathematical definitions, axioms, and theorems for any branch of mathematics.  It is the foundation of the field of mathematical logic, which culminated in Gödel’s incompleteness theorem, which revealed the ultimate limits of mathematical thought: Kurt Gödel 1906-1978
  • 24. Predicate logic  Given any finitely describable, consistent proof procedure, there will still be some true statements that can never be proven by that procedure.  We can’t discover all mathematical truths, unless we sometimes resort to making guesses
  • 25. Predicate logic Applications  Basis for clearly expressed formal specifications for any complex system.  Basis for automatic theorem provers and many other Artificial Intelligence systems.  Supported by some of the more sophisticated database query engines and container class libraries (these are types of programming tools).
  • 26. Example Predicate logic  In the sentence “The dog is sleeping”  The phrase “the dog” denotes the subject - the object or entity that the sentence is about.  The phrase “is sleeping” denotes the predicate- a property that is true of the subject.  In predicate logic, a predicate is modeled as a function P(·) from objects to propositions.  P(x) = “x is sleeping” (where x is any object).
  • 27. Example Predicate logic  Convention: Lowercase variables x, y, z... denote objects/entities; uppercase variables P, Q, R… denote propositional functions (predicates).  Keep in mind that the result of applying a predicate P to an object x is the proposition P(x). But the predicate P itself (e.g. P=“is sleeping”) is not a proposition (not a complete sentence).  E.g. if P(x) = “x is a prime number”, P(3) is the proposition “3 is a prime number”.
  • 28. Example Predicate logic  Predicate logic generalizes the grammatical notion of a predicate to also include propositional functions of any number of arguments, each of which may take any grammatical role that a noun can take. E.g. let P(x, y, z) = “x gave y the grade z”, then P(x, y, z) = “Mike gave Mary the grade A” x can fool y at time z If x=“”, y=“”, z=“”, then
  • 29. Mathematical Induction  Mathematical Induction is a method of mathematical proof typically used to establish that a given statement is true for all natural numbers.  Mathematical induction is a mathematical proof technique. It is essentially used to prove that a statement P(n) holds for every natural number n = 0, 1, 2, 3, . . . ; that is, the overall statement is a sequence of infinitely many cases P(0), P(1), P(2), P(3), . . . . Informal metaphors help to explain this technique, such as falling dominoes or climbing a ladder:
  • 30. Mathematical Induction  It is a method of mathematical proof typically used to establish that a given statement is true of all natural numbers.  A method of proof It does not generate answers: it only can prove them
  • 31. Mathematical Induction  It works in three parts:  Base case(s): show it is true for one element  Inductive hypothesis: assume it is true for any given element, Must be clearly labeled!!!  Show that if it is true for the next highest element
  • 32. Mathematical Induction  Mathematical induction is a legitimate method of proof for all positive integers n  Principle: Let Pn be a statement involving n, a positive integer. If 1. P1 is true, and 2. the truth of Pk implies the truth of Pk + 1 for every positive k, then Pn must be true for all positive integers n.
  • 33.  Question: 1.1 Use mathematical induction to prove Sn = 2 + 4 + 6 + 8 + . . . + 2n = n(n + 1) for every positive integer n.
  • 34. Mathematical Induction  Question: 1.1 Use mathematical induction to prove Sn = 2 + 4 + 6 + 8 + . . . + 2n = n(n + 1) for every positive integer n. Step 1. Show that the formula is true when n = 1. S1 = n(n + 1) = 1(1 + 1) = 2 is True Step 2. Assume the formula is valid for some integer k. Use this assumption to prove the formula is valid for the next integer, k + 1 and show that the formula Sk + 1 = (k + 1)(k + 2) is true
  • 35. Mathematical Induction Let’s assume Sk = 2 + 4 + 6 + 8 + . . . + 2k = k(k + 1) // assuming that it will hold Now, Sk + 1 = 2 + 4 + 6 + 8 + . . . + 2k + [2(k + 1)] = 2 + 4 + 6 + 8 + . . . + 2k + (2k + 2) =Sk + (2k + 2) = k(k + 1) + (2k + 2) Replace Sk by k(k + 1). = k2 + k + 2k + 2 = k2 + 3k + 2 = (k + 1)(k + 2) = (k + 1)((k + 1)+1) The formula Sn = n(n + 1) is valid for all positive integer values of n.
  • 36. Question:1.2 Prove that the sum of the first n natural numbers is given by this formula: 1 + 2 + 3 + . . . + n = n(n + 1) 2
  • 37. Mathematical Induction Question:1.2 Prove that the sum of the first n natural numbers is given by this formula: 1 + 2 + 3 + . . . + n = n(n + 1) 2 First, we will assume that the formula is true for n = k; that is, we will assume: 1 + 2 + 3 + . . . + k = k(k + 1) 2 (1) This is the induction assumption. Assuming this, we must prove that the formula is true for its successor, n = k + 1. That is, we must show: 1 + 2 + 3 + . . . + (k + 1) = (k + 1)(k + 2) 2 (2)
  • 38. Mathematical Induction To do that, we will simply add the next term (k + 1) to both sides of the induction assumption in equation 1 1 + 2 + 3 + . . . + k+ (k+1) = k(k + 1) + (k+1) 2 = k(k + 1) + 2(k+1) 2 = (k + 1)(k+2) 2 (on taking (k+1) as a common factor) Does it corresponds to equation 2; Yes ; Its true
  • 39. Mathematical Induction Assignments 1.3 Prove that 12 + 22 + 32 + ... + n2 = n (n + 1) (2n + 1)/ 6 For all positive integers n. 1.4 Use mathematical induction to prove that 13 + 23 + 33 + ... + n3 = n2 (n + 1)2 / 4 for all positive integers n.