Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Similar documents
Recap Datalog Datalog Syntax Datalog Semantics. Logic: Datalog. CPSC 322 Logic 6. Textbook Logic: Datalog CPSC 322 Logic 6, Slide 1

Logic: TD as search, Datalog (variables)

Data Integration: Logic Query Languages

Propositional Logic Formal Syntax and Semantics. Computability and Logic

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

Using Definite Knowledge

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

Constraint Solving. Systems and Internet Infrastructure Security

Towards a Logical Reconstruction of Relational Database Theory

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Situation Calculus and YAGI

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Propositional Logic. Part I

Programming Languages Third Edition

CSC 501 Semantics of Programming Languages

Lecture 4: January 12, 2015

Contents. Chapter 1 SPECIFYING SYNTAX 1

Lecture 5 - Axiomatic semantics

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Lecture 5. Logic I. Statement Logic

Chapter 3 (part 3) Describing Syntax and Semantics

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Typed Lambda Calculus for Syntacticians

Integrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation

Semantics. There is no single widely acceptable notation or formalism for describing semantics Operational Semantics

For next Tuesday. Read chapter 8 No written homework Initial posts due Thursday 1pm and responses due by class time Tuesday

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

Database Theory VU , SS Introduction: Relational Query Languages. Reinhard Pichler

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Th(N, +) is decidable

Logic Programming and Resolution Lecture notes for INF3170/4171

Lectures 20, 21: Axiomatic Semantics

Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters. Corky Cartwright January 26, 2018

Choice Logic Programs and Nash Equilibria in Strategic Games

Introduction to Axiomatic Semantics (1/2)

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Chapter 16. Logic Programming Languages

Automated Reasoning. Natural Deduction in First-Order Logic

SOFTWARE ENGINEERING DESIGN I

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and

Predicate Logic CHAPTER What This Chapter Is About

Chapter 3. Describing Syntax and Semantics

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27

Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013

Expressive Power and Abstraction in Essence

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

F. Brief review of classical predicate logic (PC)

Context-free Grammars

An Annotated Language

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

RIF RuleML Rosetta Ring: Round-Tripping the Dlex Subset of Datalog RuleML and RIF-Core

CILOG User Manual Version 0.14

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1

What is a Logic Program. Introduction to Logic Programming. Introductory Examples. Introductory Examples. Foundations, First-Order Language

Introduction to Logic Programming

A review of First-Order Logic

Revisiting Kalmar completeness metaproof

An Evolution of Mathematical Tools

CMSC 330: Organization of Programming Languages. Operational Semantics

The Formal Syntax and Semantics of Web-PDDL

Lecture 1: Conjunctive Queries

LOGIC AND DISCRETE MATHEMATICS

CSE 20 DISCRETE MATH. Fall

The Logic Paradigm. Joseph Spring. 7COM1023 Programming Paradigms

Introduction to Axiomatic Semantics (1/2)

Chapter 3: Syntax and Semantics. Syntax and Semantics. Syntax Definitions. Matt Evett Dept. Computer Science Eastern Michigan University 1999

Logical reconstruction of RDF and ontology languages

Part I Logic programming paradigm

Talen en Compilers. Jurriaan Hage , period 2. November 13, Department of Information and Computing Sciences Utrecht University

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

ALGOL 48 AND ALGOL 50 ALGOLIC LANGUAGES IN MATHE- MATICS

Proseminar on Semantic Theory Fall 2013 Ling 720 An Algebraic Perspective on the Syntax of First Order Logic (Without Quantification) 1

Introduction to Axiomatic Semantics

Com S 541. Programming Languages I

6. Hoare Logic and Weakest Preconditions

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Database Theory VU , SS Introduction to Datalog. Reinhard Pichler. Institute of Logic and Computation DBAI Group TU Wien

COSC252: Programming Languages: Semantic Specification. Jeremy Bolton, PhD Adjunct Professor

Declarative programming. Logic programming is a declarative style of programming.

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

Handout 9: Imperative Programs and State

Introductory logic and sets for Computer scientists

Proving Theorems with Athena

Typed Lambda Calculus

Warm-Up Problem. Let L be the language consisting of as constant symbols, as a function symbol and as a predicate symbol. Give an interpretation where

Knowledge Representation

Automatic Synthesis of Decision Procedures: a Case Study of Ground and Linear Arithmetic

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems

Chapter 3. Describing Syntax and Semantics ISBN

What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010

15-819M: Data, Code, Decisions

Formal Semantics of Programming Languages

Chapter 3: Propositional Languages

Software Paradigms (Lesson 6) Logic Programming

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

Logic and its Applications

Lecture 5: Predicate Calculus. ffl Predicate Logic ffl The Language ffl Semantics: Structures

Transcription:

Chapter 2 & 3: A Representation & Reasoning System & Using Definite Knowledge Representations & Reasoning Systems (RRS) (2.2) Simplifying Assumptions of the Initial RRS (2.3) Datalog (2.4) Semantics (2.5) Questions & Answers (2.6) D. Poole, A. Mackworth, and R. Goebel, Computational Intelligence: A Logical Approach, Oxford University Press, January 1998 Representations & Reasoning Systems (2.2) A Representation and Reasoning System (RRS) is made up of: Formal language: specifies the legal sentences (grammar) A knowledge base is a set of sentences in the language Semantics: specifies the meaning of the symbols, sentences Reasoning theory or proof procedure: nondeterministic specification of how an answer can be produced (inference system). system - Using definite knowledge 1

Representations & Reasoning Systems (2.2) (cont.) Implementation of an RRS An implementation of an RRS consists of: Language parser: distinguish legal sentences and maps sentences of the language into data structures (internal form). Reasoning procedure: implementation of reasoning theory + search strategy (solve nondeterminism). Note: the semantics is not reflected in the implementation, (but gives a meaning to the symbols for an external viewer!) Representations & Reasoning Systems (2.2) (cont.) Using an RRS 1. Begin with a task domain. 2. Distinguish those things you want to talk about (the ontology). 3. Choose symbols in the computer to denote objects and relations. 4. Tell the system knowledge about the domain. 5. Ask the system questions. system - Using definite knowledge 2

Representations & Reasoning Systems (2.2) (cont.) Simplifying Assumptions of Initial RRS (2.3) An agent s knowledge can be usefully described in terms of individuals and relations among individuals. An agent s knowledge base consists of definite (not vague!) and positive statements. The environment is static. There are only a finite number of individuals of interest in the domain. Each individual can be given a unique name. RRS that makes these assumptions is called Datalog system - Using definite knowledge 3

Datalog (2.4) Syntax of Datalog variable starts with upper-case letter (X, Room, B4.) constant starts with lower-case letter or is a sequence of digits (numeral). predicate symbol starts with lower-case letter (alan). term is either a variable or a constant. atomic symbol (atom) is of the form p or p(t 1,, t n ) where p is a predicate symbol and t i are terms. Datalog (2.4) (cont.) Syntax of Datalog (cont.) definite clause is either an atomic symbol (a fact) or of the form: a{ b 142 1... b 43m head body where a and b i are atomic symbols. query is of the form?b 1 b m. knowledge base is a set of definite clauses. system - Using definite knowledge 4

Datalog (2.4) (cont.) Example Knowledge Base Semantics (2.5) General Idea A semantics specifies the meaning of sentences in the language. An interpretation specifies: what objects (individuals) are in the world (ontology) the correspondence between symbols in the computer and objects & relations in world person(alan) = true (in this world!) person(r123) = false (in fig. 2.1 p. 26) constants denote individuals predicate symbols denote relations system - Using definite knowledge 5

Semantics (2.5) (cont.) Formal Semantics An interpretation is a triple I = D, π, φ where: D, the domain, is a nonempty set. Elements of D are individuals. φ is a mapping that assigns to each constant an element of D. Constant c denotes individual φ(c). π is a mapping that assigns to each n-ary predicate symbol a function from D n into {TRUE, FALSE}. Semantics (2.5) (cont.) Important points to note The domain D can contain real objects. (e.g., a person, a room, a course). D can t necessarily be stored in a computer. π(p) specifies whether the relation denoted by the n-ary predicate symbol p is true or false for each n-tuple of individuals. If predicate symbol p has no arguments, then π(p) is either TRUE or FALSE. system - Using definite knowledge 6

Semantics (2.5) (cont.) Truth in an interpretation Each ground term (expression with no variables!) denotes an individual in an interpretation. A constant c denotes in I the individual φ (c) Ground (variable-free) atom p(t 1 t n ) is true in interpretation I if π(p)(t ' 1,...,t ' n ) = TRUE, where t i denotes ' t 1 in interpretation I and ' ' false in interpretation I if π(p)(t1,...,t n ) = FALSE. Ground clause h b 1 b m is false in interpretation I if h is false in I and each bi is true in I, and is true in interpretation I otherwise. Semantics (2.5) (cont.) Models and logical consequences A knowledge base, KB, is true in interpretation I if and only if every clause in KB is true in I. A model of a set of clauses is an interpretation in which all the clauses are true. If KB is a set of clauses and g is a conjunction of atoms (or just an atom), g is a logical consequence of KB, written KB g, if g is true in every model of KB. That is, KB g if there is no interpretation in which KB is true and g is false. system - Using definite knowledge 7

Semantics (2.5) (cont.) Simple example Semantics (2.5) (cont.) User s view of Semantics 1. Choose a task domain: intended interpretation. 2. Associate constants with individuals you want to name. 3. For each relation you want to represent, associate a predicate symbol in the language. 4. Tell the system clauses that are true in the intended interpretation: axiomatizing the domain. 5. Ask questions about the intended interpretation. 6. If KB g, then g must be true in the intended interpretation. system - Using definite knowledge 8

Semantics (2.5) (cont.) Computer s view of semantics The computer doesn t have access to the intended interpretation. All it knows is the knowledge base. The computer can determine if a formula is a logical consequence of KB. If KB g then g must be true in the intended interpretation. If KB g then there is a model of KB in which g is false. This could be the intended interpretation. Questions & Answers (2.6) Variables Variables are universally quantified in the scope of a clause. A variable assignment is a function from variables into the domain. Given an interpretation and a variable assignment, each term denotes an individual and each clause is either true or false. A clause containing variables is true in an interpretation if it is true for all variable assignments system - Using definite knowledge 9

Questions & Answers (2.6) (cont.) Queries and Answers A query is a way to ask if a body is a logical consequence of the knowledge base:?b 1 b m An answer is either an instance of the query that is a logical consequence of the knowledge base KB, or no if no instance is a logical consequence of KB. Questions & Answers (2.6) (cont.) Examples Queries system - Using definite knowledge 10

Questions & Answers (2.6) (cont.) Logical Consequence Atom g is a logical consequence of KB if and only if: g is a fact in KB, or there is a rule g b 1 b k in KB such that each bi is a logical consequence of KB. Questions & Answers (2.6) (cont.) Debugging false conclusions To debug answer g that is false in the intended interpretation: If g is a fact in KB, this fact is wrong. Otherwise, suppose g was proved using the rule: g b 1 b k where each bi is a logical consequence of KB. If each b i is true in the intended interpretation, then this clause is false in the intended interpretation. If some bi is false in the intended interpretation, debug b i. system - Using definite knowledge 11

Questions & Answers (2.6) (cont.) Axiomatizing the Electrical Environment Questions & Answers (2.6) (cont.) system - Using definite knowledge 12

Questions & Answers (cont.) Questions & Answers (cont.) Recursion and Mathematical Induction Above(X, Y) on (X, Y) Above(X, Y) on (X, Z) above (Z, Y) This can be seen as: Recursive definition of above: prove above in terms of a base case (on) or a simpler instance of itself; or Way to prove above by mathematical induction: the base case is when there are no blocks between X and Y, and if you can prove above when there are n blocks between them, you can prove it when there are n + 1 blocks. system - Using definite knowledge 13

Questions & Answers (2.6) (cont.) Make the following atoms Provable: live(w 5 ) given: connected_to(w 5,outside). live(w 3 ) live(w 4 ) live(l 2 ) system - Using definite knowledge 14