Logic for Computer Science Transparency No. 1-1 Chapter 1 Introduction Cheng-Chia Chen.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Artificial Intelligence Chapter 13 The Propositional Calculus Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
CS344 : Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 9,10,11- Logic; Deduction Theorem 23/1/09 to 30/1/09.
Logic Concepts Lecture Module 11.
Copyright © Cengage Learning. All rights reserved.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
TR1413: Discrete Mathematics For Computer Science Lecture 3: Formal approach to propositional logic.
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.
So far we have learned about:
Let remember from the previous lesson what is Knowledge representation
Logic in Computer Science Transparency No Chapter 3 Propositional Logic 3.1. The syntax.
Describing Syntax and Semantics
Intro to Discrete Structures
Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.
Inference is a process of building a proof of a sentence, or put it differently inference is an implementation of the entailment relation between sentences.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
1 Introduction to Logic Programming. 2 Human Logic Humans are information processors, We acquire information about the world and use this information.
MATH 224 – Discrete Mathematics
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.
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
CMPF144 FUNDAMENTALS OF COMPUTING THEORY Module 5: Classical Logic.
Pattern-directed inference systems
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Of 33 lecture 12: propositional logic – part I. of 33 propositions and connectives … two-valued logic – every sentence is either true or false some sentences.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
LOGIC AND ONTOLOGY Both logic and ontology are important areas of philosophy covering large, diverse, and active research projects. These two areas overlap.
0 What logic is or should be Propositions Boolean operations The language of classical propositional logic Interpretation and truth Validity (tautologicity)
SSK3003 DISCRETE STRUCTURES
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
CS6133 Software Specification and Verification
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Artificial Intelligence “Introduction to Formal Logic” Jennifer J. Burg Department of Mathematics and Computer Science.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
EEL 5937 Content languages EEL 5937 Multi Agent Systems Lecture 10, Feb. 6, 2003 Lotzi Bölöni.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Artificial Intelligence Logical Agents Chapter 7.
Chapter 1 Logic and proofs
CENG 424-Logic for CS Introduction Based on the Lecture Notes of Konstantin Korovin, Valentin Goranko, Russel and Norvig, and Michael Genesereth.
Chapter 7. Propositional and Predicate Logic
Knowledge Representation and Reasoning
The Propositional Calculus
Lecture 2 Propositional Logic
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Applied Discrete Mathematics Week 1: Logic
Back to “Serious” Topics…
Logics for Data and Knowledge Representation
Chapter 7. Propositional and Predicate Logic
CSNB234 ARTIFICIAL INTELLIGENCE
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
ece 720 intelligent web: ontology and beyond
Representations & Reasoning Systems (RRS) (2.2)
Presentation transcript:

Logic for Computer Science Transparency No. 1-1 Chapter 1 Introduction Cheng-Chia Chen

Logic for Computer Science Transparency No. 1-2 Introduction What is logic ? some inadequate definitions of logic Why studying logic ? Basic terms used in the discussion of logic Proposition, inference, premise, conclusion, argument... Elements of a logic A glimpse of the simple formal logic: propositional logic

Logic for Computer Science Transparency No. 1-3 What is logic ? Logic is the study of the methods and principles used to distinguish between good(correct) from bad(incorrect) reasonings. ( 區辨推理形式之好壞或正確與否的方法與原則的研究 )

Logic for Computer Science Transparency No. 1-4 Inadequate definitions of logic  Logic is the science of the law of thought. the study of psychology! logic is not a branch of psychology All reasoning is thinking, but not all thinking(mental activity) is reasoning.  Logic is the science of reasoning. much better, but still not correct!  Human reasoning is a special kind of thinking, in which inference takes place and problems are solved. Still a kind of mental activity and hence a part of psychologist's subject matter.  Human reasoning process is extremely complex and highly emotional, consisting of awkward trial-and-error procedures illuminated by sudden and sometimes apparently irrelevant flash of insight.  Logicians are only concerned with the correctness of the whole process of reasoning. They don't care about how the reasoning process takes place.

Logic for Computer Science Transparency No. 1-5 What logic is concerned  Concerns of logicians: Does conclusions reached followed from the premised used or assumed? Do the premises provide good reasons for accepting the conclusions ? If the premises do provide adequate grounds for affirming the conclusion, or if accepting the premises does warrant asserting the conclusions to be true, then we say that the reasoning is correct; o/w it is incorrect.  Central problem logic deals with: distinctions between correct and incorrect reasoning All kinds of reasonings are of interest to the logicians, but the special concern for its correctness is the logicians' focus.

Logic for Computer Science Transparency No. 1-6 Why studying logic ?  As a human being: ability to make correct arguments ability to distinguish between correct and incorrect arguments.  As a CS student: Knowledge of logic is fundamental to various fields of computer science.

Logic for Computer Science Transparency No. 1-7 Why Studying Logic ? Applications in CS  Hardware logic design (hardware specification and verification)  Database (formal modeling, expressiveness of query languages, relational algebra and SQL),  Algorithms (complexity and expressiveness),  Computation theory (general notions of computability),  Software engineering (specification and verification),  Programming languages (semantics, functional programming, logic programming), Applications in artificial intelligence (& semantic web):  Knowledge and problem representation: Logic can serve as a language for representing knowledge and problems of various domains.  Automated reasoning: Accompanied with an automated theorem prover corresponding to a logic, the goal of automated problem solving (by computer) can be achieved.

Logic for Computer Science Transparency No. 1-8 Basic functions of language Three basic functions of language –informative(declarative): » used to communicate information (and misinformation) »i.e., used to describe the world. »formulate and affirm (or deny) propositions »to present arguments »include true or false propositions. –expressive: »used to express feelings, emotions, attitudes etc. »e.g., poetry. –directive: »e.g., command and request »to cause (or prevent) overt actions »give me a book!; x <- x+1.

Logic for Computer Science Transparency No. 1-9 Basic terms used in logic propositions –statements; what are asserted using declarative sentences, –always either true or false - although its truth or falsity may be unknown. – e.g, It's raining. God exists c.f. sentences and propositions –Sentence is a syntactic notion and belongs to a particular language, while proposition is a semantic notion and is not particular to any language. –The same propositions can be asserted by many different sentences even in a language. –e.g., John won the election; The election was won by John. –In different contexts, the same sentence may be used to make very different statements. –eg., The present president was born in Taiwan. –1995 R.O.C => Lee, the sentence expresses a true proposition ! –1985 or not ROC => a false proposition.

Logic for Computer Science Transparency No Basic terms used in logic (con't) inference ( 推論 ): –referring to the process by which one proposition is arrived at and affirmed on the basis of one or more other propositions accepted as the starting point of the process. –e.g, –Human is mortal premise 1 –Since Confucius is a man, ---- premise 2 –Confucius is mortal conclusion inferred from premise (1) and (2) Argument ( 論斷, 論證 ) : –A group of propositions of which one (the conclusion) is claimed to follow from the others (the premises) which are regarded as providing support for the truth of that one. Premises: –Propositions that are assumed or asserted in an inferences or argument for reaching a conclusion. Conclusion: –Propositions that are concluded in an inference arguments.

Logic for Computer Science Transparency No Elements of a logic –vocabulary and language »providing basic vocabulary for expressing "What are to be asserted". –syntax: »characterizing well-formed expressions (WFF) for expressing propositions –axiomatics: (or called calculus) »methods for specifying all valid arguments or reasonings »usually consists of inference rules and axioms »different styles of specifications Hilbert-style calculus; natural deduction; sequent calculus, tableau methods, resolution... –semantics: »used to make precise that a proposition is true (or false) and that an inference rule is valid etc. –decidability and complexity analysis »determining if the logic under discussion is decidable and, if yes, what its computational complexity is.

Logic for Computer Science Transparency No Elements of a logic (cont'd) –automated proving methods »development of efficient methods for automated/semi- automated theorem proving. Formal logic –The study of logic in which all elements of logic are treated precisely (or formally) with mathematical rigor. –Unlike natural or programming languages, the language (and syntax) of a logic is usually very easy and deserves less attentions of logicians. –Traditional logicians are more concerned with axiomatics, semantics and decidability of a logic. –Computer scientists, AI researcher are also interested in the complexity and efficient proof methods of a logic.

Logic for Computer Science Transparency No Example (a glimpse of propositional loic)  Propositional logic (PL) the logic of 'or', 'and', 'not', 'if' (material implication) and ‘iff’ etc.  The language: 1. vocabulary L = PV  LC, where 2. PV= { p1, p2,...}: a (countable) set of symbols, each called a propositional variable.  used to represent propositions of domains of interest.  e.g., p1 = "It is raining now";  p2 = " A1 is the father of A2"; etc. 3. (LC includes ) logical connectives:  /\ (and), \/(or), ~ (not), => (if), (iff; if and only if; or equivalence), and more (XOR, NAND, NOR, 0, 1 etc.) 4. and auxiliary symbols (separator symbols)  (, ).

Logic for Computer Science Transparency No The syntax of PL  Well-formed formulas (WFF is a subset of L*) 1. Every propositional variable is a (well-formed) formula. 2. If A, B are wff, then so are (A /\ B), (A\/B), (A => B), (A B) and ~A. 3. Only strings that can be obtained by a finite number of applications of rule 1 and 2 are well-formed formulas.  Examples: 1. (p1 \/ (p2 /\ p1)), 2. (p1 => (p2 \/ (p3 ( ~p1 /\ p2))) 3. (p1 \/ q), 4. (p1), 5. (~(p1 /\ p2) ) Problem: Which of the above strings are wffs ? Rigorously speaking, some of the above expressions are not wffs. However, since syntax is not our main concern, as far as ambiguity does not arise, we do admit these as wffs.

Logic for Computer Science Transparency No The semantics of PL  Interpretation: An interpretation I for L is a truth-assignment for PV, i.e., a mapping from PV to the truth set {0, 1 }.  Note: The semantical content of a proposition variable in actual situation is not our concern; we only care about whether it is true or false in actual situations. So, two possible different situations interpreting each propositional variable with the same truth value are abstracted in semantics by the same interpretation. For each propositional variable p, if I(p) = 1, we say p is true; otherwise (I(p)=0), p is said to be false. How can we extend the truth/false definition from PV to all wffs ? (Below text define the meaning of all logic connectives.) notation: we use the symbols: I |= A to mean that the formula A is true under interpretation I. Mathematically, |= is a binary relation between interpretations and wffs (i.e., a subset of (the set of all interpretations x wffs))

Logic for Computer Science Transparency No Truth conditions of wffs in propositional logic  Definition of |= (The satisfaction relation) 1. I |= p, where p is a propositional variable, if I(p) = I |= (A /\ B) if I |= A and I |= B. 3. I |= A \/ B if I |= A or I |= B. 4. I |= A=> B if I |= B whenever I |= A. 5. I |= A B if I |= A =>B and I |= B => A 6. I |= ~A if it is not the case that I |= A.  If I |= A, we say I is a model of A.

Logic for Computer Science Transparency No logical consequence relation  Logical consequence relation (|=) Given a (possibly infinite or empty) set of formulas  = {A1,A2,...,An,...} and a formula A, we say A is a logical consequence of , in symbols,  |= A, if for any interpretation I, if all formulas in  are true in I, then A is true in I, i.e., for all I, if I |= Ai for every Ai in , then I |= A. I.e, Every model of  is a model of A. notations: 1.  |= A is abbreviated as A1,...,An |= A if  ={A1,A2,..An} is finite. 2.  |= A is abbreviated as |= A. Note: Both the satisfaction relation and the logical consequence relation are denoted by the same symbol |=.

Logic for Computer Science Transparency No Formalization of the validity of an argument in PL  Formalization of the validity of an argument (or inference) in PL. An argument with premises A1,...,An and conclusion A is valid iff it is impossible that (I.e., there exists no case in which) A1,...,An are all true but A is false iff for every interpretation I, if A1,...,An are true in I, then so are A. iff A is a logical consequence of A1,...,An iff A1,...,An |= A  Other notions: a formula or a set of formulas is said to be satisfiable if it has a model. (i.e., there is an interpretation I, such that every formula is true in I.) a formula A or a set of formulas is said to be valid if it is true in all interpretations. note: A is valid iff |= A; {A1,...,An} is valid iff |= A1 /\A2.../\An.

Logic for Computer Science Transparency No Decision problems in PL  Decision problems: The satisfiability problem (SAT):  Given an arbitrary formula A, determine if A is satisfiable (I.e., true in some interpretation). The validity problem(VALID):  Given an arbitrary formula A, determine if A is valid (I.e., true in all interpretations). The logical consequence problem:  Given a finite set of formulas  and a formula A, determine if A is a logical consequence of . Model-checking problem:  Given a formula A and an interpretation I, determine if I is a model of A. Note: All the above problems for PL are well known to be decidable(I.e., there exists a program for solving each problem)

Logic for Computer Science Transparency No Complexity results of PL  It is known that SAT is NP-complete, the model-checking problem can be solved in polynomial time, while the other two are CoNP-complete.  (deduction theorem) A1,...,An |= A iff A1,...,A(n-1) |= An => A  Corollary: A1,...,An |= A iff |= A1 =>(A2=>(... (An=>A)...) If  is restricted to finite sets, the binary logical consequence relation is interreducible to the unary validity relation, which are easier to handle. So the concerned relation (binary |=) may now be replaced by the unary validity relation (unary |=).

Logic for Computer Science Transparency No Axiomatics for PL  While semantics deals with the meaning of wffs, axiomatics deals with how we can systematically derive valid formulas. I.e., semantics is concerned about meaning and axiomatics is concerned about inference.  An axiom system (for PL) is a pair S = (A, R ) where A is a subset of the set of all wffs, called the set of axioms of PL, R is a finite set { R 1, R 2,…,R n } of relations among wffs, called rules of inferences. For each R i, if (A 1,…,A k, A)  R i for some A 1,…,A k,A, then A is called a direct consequence of the set {A 1,…,A k } by the rule R i. Notes: A represent the set of wffs that we accept as valid explicitly and need not be inferred. R is used to formalize inference rules that can be used to infer new valid wffs (consequence) from existing known valid formulas (premises)

Logic for Computer Science Transparency No Axiom system for PL  S = (A,R): an axiom system  The set of theorems of S is defined inductively as follows: Every wff A  A is a theorem of S. If A 1,…,A k are theorem of S and (A 1,…,A k,A)  R i for some R i in R, then A is a theorem of S. A is a theorem of S only if it can be obtained by finite applications of step 1 and 2.  The set { A | A is a theorem of S } is called the theory of S.  A proof of a theorem A of S is a witness of A being a theorem of S. Formally, it is a sequence A 1,…,A n of wffs s.t., 1. A n = A, 2. for all i = 1,..,n, either (1) A i is an axiom or (2) A i can be inferred from previous wffs by some rules, i.e., there are A i1,…,A ik with j1,…,jk < i and (A j1,…,A jk,A i )  R t for some R t  R.

Logic for Computer Science Transparency No Soundness and completeness of a logic system  Let VAL be the set of all valid formulas of some logic L  Let Th be the set of theorems of an axiom system S  We say S is a sound (correct) axiomatization of L if Th  VAL. ( i.e., every theorem of S is valid).  We say S is a complete axiomatization of L if VAL  Th. ( i.e., All valid wffs van be proved from S ).  If S is sound and complete for L we way S is an (sound and complete) axiom system for L.  An axiom system for PL: H = (A, R) where A include all wffs of one of the forms: 1. A -> (B -> A) 2. (A-> (B -> C)) -> ((A -> B) -> (A -> C)) 3. ( ~B -> ~A) -> (A -> B), and R = { MP } where MP = { (A, A->B, B) | A, B are wffs}