1 Introduction to Logic Programming. 2 Human Logic Humans are information processors, We acquire information about the world and use this information.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

1 Knowledge Representation Introduction KR and Logic.
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Logic Use mathematical deduction to derive new knowledge.
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Semantics of SL and Review Part 1: What you need to know for test 2 Part 2: The structure of definitions of truth functional notions Part 3: Rules when.
Logic.
ISBN Chapter 3 Describing Syntax and Semantics.
Philosophy 120 Symbolic Logic I H. Hamner Hill CSTL-CLA.SEMO.EDU/HHILL/PL120.
Knowledge Representation & Reasoning.  Introduction How can we formalize our knowledge about the world so that:  We can reason about it?  We can do.
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
1 Chapter 7 Propositional and Predicate Logic. 2 Chapter 7 Contents (1) l What is Logic? l Logical Operators l Translating between English and Logic l.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Knoweldge Representation & Reasoning
Let remember from the previous lesson what is Knowledge representation
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Describing Syntax and Semantics
Logical and Rule-Based Reasoning Part I. Logical Models and Reasoning Big Question: Do people think logically?
Discrete Mathematics and its Applications
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
Discrete Mathematics and Its Applications
 Predicate: A sentence that contains a finite number of variables and becomes a statement when values are substituted for the variables. ◦ Domain: the.
1 Chapter 7 Propositional and Predicate Logic. 2 Chapter 7 Contents (1) l What is Logic? l Logical Operators l Translating between English and Logic l.
Deductive versus Inductive Reasoning Consider the following two passages: Argument #1 Mr. Jones is a member of the Academy of Scholarly Fellows and only.
Chapter 1 Logic Section 1-1 Statements Open your book to page 1 and read the section titled “To the Student” Now turn to page 3 where we will read the.
CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 5: Classical Logic.
Pattern-directed inference systems
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
The Science of Good Reasons
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
0 What logic is or should be Propositions Boolean operations The language of classical propositional logic Interpretation and truth Validity (tautologicity)
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Course Overview and Road Map Computability and Logic.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Today’s Topics Introduction to Proofs Rules of Inference Rules of Equivalence.
BBI 3420 Critical Reading and Thinking Critical Reading Strategies: Identifying Arguments.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
CS6133 Software Specification and Verification
1 Propositional Logic Introduction. 2 What is propositional logic? Propositional Logic is concerned with propositions and their interrelationships. 
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
I think therefore I am - Rene Descartes. REASON (logic) It has been said that man is a rational animal. All my life I have been searching for evidence.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Metalogic Soundness and Completeness. Two Notions of Logical Consequence Validity: If the premises are true, then the conclusion must be true. Provability:
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Artificial Intelligence Logical Agents Chapter 7.
Deductive Reasoning. Inductive: premise offers support and evidenceInductive: premise offers support and evidence Deductive: premises offers proof that.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Chapter 7. Propositional and Predicate Logic
Knowledge Representation and Reasoning
Introduction to Prolog
Propositional Calculus: Boolean Algebra and Simplification
Chapter 1 The Foundations: Logic and Proof, Sets, and Functions
Logical Agents Chapter 7.
Logic Use mathematical deduction to derive new knowledge.
Computer Security: Art and Science, 2nd Edition
Chapter 7. Propositional and Predicate Logic
Knowledge Representation I (Propositional Logic)
CSNB234 ARTIFICIAL INTELLIGENCE
This Lecture Substitution model
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Representations & Reasoning Systems (RRS) (2.2)
Introducing Natural Deduction
Presentation transcript:

1 Introduction to Logic Programming

2 Human Logic Humans are information processors, We acquire information about the world and use this information to further our ends Logic is the study of what follows from what. What conclusions follow from a set of premises. We use Logic just about everything we do. We use it in our personal lives. We use it in our professional activities. We use the language of Logic to state observations, to define concepts, and to formalize theories. We use logical reasoning to derive conclusions from these bits of information. We use logical proofs to convince others of these conclusions.

Human Logic…..Cont. One of the strengths is our ability to represent and manipulate logical information, not just simple facts but also more complex forms of information, such as Ex. Ex. A simple children puzzle of blocks. Given some facts about the arrangement of five blocks in a stack, and we are asked to determine their exact arrangement. 3  The red block is on the green block.  The green block is somewhere above the blue block.  The green block is not on the blue block.  The yellow block is on the green block or the blue block.  There is some block on the black block. Negations, Alternatives, Constraints

Human Logic…..Cont. Even though the information is not literally present in what we are given, it is possible to derive that information. In particular, the conclusions shown below all follow from the premises above. 4  The red block is on the green block.  The green block is on the yellow block.  The yellow block is on the blue block.  The blue block is on the black block.  The black block is directly on the table.

Human Logic…..Cont. 5  All Accords are Hondas.  All Hondas are Japanese.  Therefore, all Accords are Japanese. They share the same reasoning structure  All x are y.  All y are z.  Therefore, all x are z.

Human Logic…..Cont. 6  All Toyotas are cars.  Some cars are made in America.  Therefore, some Toyotas are made in America.  All Toyotas are cars.  Some cars are Porsches.  Therefore, some Toyotas are Porsches. If we replace x by Toyotas and y by Japanese and z by made in America Correct Incorrect if we replace x by Toyotas and y by cars and z by Porsches Conclusions that are true whenever the premises are true

Logic is the science of arguments ( جدال ) All rational inquiry (استفسار عقلاني) turns on the ideal of a logical consequence (نتيجة), the idea that some claim must necessarily follow from others. Arguments are designed to show that one claim logically follows from others. Logic allows to determine whether the arguments succeed. An argument is a set of statements, one of which (the conclusion) is supposed to follow from the others (the premises).

Statement Statement: A sentence that has a truth value, i.e., a sentence that is either true or false (but never both). Statements are true when what they assert (تأكد ) about the world is the case. Types of statements:  Simple: A simple statement asserts exactly one fact about the world  Compound: A compound statement is one or more simple statements plus logical connectives. There are 5 logical connectives: not, and, or, if- then, if and only if NOTE: TRUTH is a property of statements. VALIDITY is a property of arguments

Conclusion & Premise Conclusion: A statement one is urged to accept on the basis of reasons given. Premise: A statement given as a reason for believing some other statement. Correctly identifying the premises and conclusion of an argument are essential if we are to evaluate it.

Models Each way the world can be is called a model (or interpretation). If a sentence is true in a model we say that the model satisfies the sentence. Otherwise it falsifies the sentence. A countermodel to an argument satisfies all the premises but falsifies the conclusion. 10 ECE Dep. of Tehran Univ. - Programming Language Design

Valid Argument Definition: An argument is valid iff it has no countermodel. In other words, if every model that satisfies the premises also satisfies the conclusion. Definition: If an argument is valid, we say that the premises entail the conclusion. 11 ECE Dep. of Tehran Univ. - Programming Language Design

Deductive Validity A characteristic of arguments in which the truth of the premises guarantees the truth of the conclusion. It is impossible for both the premises of a valid argument to be true and the conclusion to be false. Any argument that is not valid is invalid or non-valid Validity is not Directly Determined by truth and falsity of sentences involved There are valid arguments with true conclusions and valid arguments with false conclusions. There are valid arguments with true premises and valid arguments with false premises.

The following argument is VALID: All trout are mammals All mammals can breath So, all trout can breath This argument is valid because IF the premises are true THEN the conclusion MUST be true. This holds even though the premises are in fact false.

Patterns of reasoning 14 Induction Reasoning Induction Reasoning reasoning from the particular to the general.  I have seen 1000 black ravens ( الغربان).  I have never seen a raven that is not black.  Therefore, every raven is black. Now try red Hondas. If we see enough cases in which something is true and we never see a case in which it is false, we tend to conclude that it is always true.

Patterns of reasoning 15 Abduction Reasoning Abduction Reasoning reasoning from effects to possible causes  If there is no fuel, the car will not start.  If there is no spark, the car will not start.  There is spark.  The car will not start.  Therefore, there is no fuel.

Patterns of reasoning 16 Reasoning by analogy reasoning in which we infer a conclusion based on similarity of two situations  The flow in a pipe is proportional to its diameter.  Wires are like pipes.  Therefore, the current in a wire is proportional to diameter.

Formal Logic 17 Formal Logic is a formal version of human deductive logic. It provides a formal language with an clear syntax and a precise meaning, and it provides rules for manipulating expressions in a way that respects this meaning. EX. Ibrahim is three times as old as Mohamed. Ibrahim's age and Mohamed's age add up to twelve. How old are Ibrahim and Mohamed? x − 3y = 0 x + y = 12 −4y = −12 y = 3 x = 9

Applications 18  Mathematics: Automated reasoning programs can be used to check proofs and, in some cases, to produce proofs or portions of proofs.

19 Database Systems Database in Tabular Form Database in Sentential Form Constraints Definitions

20 Hardware Engineering Circuit: Behavior: Applications: Simulation Configuration Diagnosis Test Generation x y z s c o a b

21 Information Integration Schema Master Schema Schema Rules Consumers Access and Update Own Schema Suppliers Distributed Mgmt Own Schema Exchanges Master Schema Mapping Rules Integration Data

22 Regulations and Business Rules

Declarative programming 23 Logic programming is a declarative style of programming. The programmer says what they want to compute, but does not explicitly specify how to compute it. It is up to the interpreter (compiler/implementation) to figure out how to perform the computation requested. Examples: Logic programming (Prolog), database query languages (SQL), functional programming (Haskell) In contrast, in a Imperative (procedural) programming, the program explicitly describes the individual steps of computation. Examples: C, object-oriented programming (Java)

logic program 24  A logic program is given as a collection of assumed properties (stated as logical formulas) about the world (or rather about the world of the program(  The user supplies a logical formula stating a property that might or might not hold in the world as a query  The system determines whether the queried property is a consequence of the assumed properties in the program  One declarative aspect is that the user does not specify the method by which the system determines whether or not the query is a consequence of the program.  Another is that whether or not the query is indeed a consequence is independent of the method chosen by the system.

25 Multiple Logics  Propositional Logic : Symbols in the language represent “conditions” in the world, and complex sentences in the language express interrelationships among these conditions. The primary operators are Boolean connectives, such as and, or, and not. If it is raining, the ground is wet.  Relational Logic (Predicate, Frist order) : expands upon Propositional Logic by providing a means for explicitly talking about individual objects and their interrelationships (not just monolithic conditions). In order to do so, we expand our language to include object constants, relation constants, variables of various sorts, and quantifiers. If x is a parent of y, then y is a child of x.

Exercises 26 All x are z. All y are z. Therefore, some x are y. Some x are y. All y are z. Therefore, some x are z. All x are y. Some y are z. Therefore, some x are z Correct Incorrect

27 Thank You!