Situation Calculus and YAGI

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

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

Automata Theory for Reasoning about Actions

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Towards a Logical Reconstruction of Relational Database Theory

Languages for goals and plans

Th(N, +) is decidable

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

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

3. Relational Data Model 3.5 The Tuple Relational Calculus

Typed Lambda Calculus

SOFTWARE ENGINEERING DESIGN I

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

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

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

Typed Lambda Calculus for Syntacticians

15-819M: Data, Code, Decisions

X-KIF New Knowledge Modeling Language

Com S 541. Programming Languages I

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

Hypothetical Temporal Reasoning in Databases

Range Restriction for General Formulas

F. Brief review of classical predicate logic (PC)

Logic as a framework for NL semantics. Outline. Syntax of FOL [1] Semantic Theory Type Theory

A SITUATION CALCULUS APPROACH TO MODELING AND PROGRAMMING AGENTS

Lecture 4: January 12, 2015

Semantics and Pragmatics of NLP Propositional Logic, Predicates and Functions

Programming Languages Third Edition

From OCL to Propositional and First-order Logic: Part I

HTN Planning for Web Service Composition Using SHOP2

LOGIC AND DISCRETE MATHEMATICS

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

Part I Logic programming paradigm

Foundations of Databases

Propositional Logic. Part I

Model checking pushdown systems

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

CS 512, Spring 2017: Take-Home End-of-Term Examination

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

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Denotational Semantics. Domain Theory

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

2.1 Sets 2.2 Set Operations

Formal Predicate Calculus. Michael Meyling

CMPS 277 Principles of Database Systems. Lecture #4

Relational Database: The Relational Data Model; Operations on Database Relations

Typed First-order Logic

Safe Stratified Datalog With Integer Order Does not Have Syntax

Modeling Dynamic Domains with ConGolog

Declarative Programming. 2: theoretical backgrounds

Formal Systems II: Applications

Conjunctive queries. Many computational problems are much easier for conjunctive queries than for general first-order queries.

An Incremental Interpreter for High-Level Programs with Sensing

6. Hoare Logic and Weakest Preconditions

8. Relational Calculus (Part II)

AI for Service Composition

A Logic of Proofs for Differential Dynamic Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

Lecture 1: Conjunctive Queries

Database System Concepts, 5 th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Logic (or Declarative) Programming Foundations: Prolog. Overview [1]

Introduction to Logic Programming

Complex Epistemic Modalities in the Situation Calculus

Logic Programming and Resolution Lecture notes for INF3170/4171

Contents. Chapter 1 SPECIFYING SYNTAX 1

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

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

Where Can We Draw The Line?

DATABASE THEORY. Lecture 18: Dependencies. TU Dresden, 3rd July Markus Krötzsch Knowledge-Based Systems

Knowledge Representation and Reasoning Logics for Artificial Intelligence

IG-JADE-PKSlib. An Agent Based Framework for Advanced Web Service Composition and Provisioning. Erick Martínez & Yves Lespérance

The Formal Syntax and Semantics of Web-PDDL

e-service Composition by Description Logics Based reasoning. 1 Introduction

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

Review Material: First Order Logic (FOL)

Chapter 3 Complexity of Classical Planning

Handling Integer Arithmetic in the Verification of Java Programs

Principles of AI Planning. Principles of AI Planning. 7.1 How to obtain a heuristic. 7.2 Relaxed planning tasks. 7.1 How to obtain a heuristic

Lecture 17 of 41. Clausal (Conjunctive Normal) Form and Resolution Techniques

Semantics and Pragmatics of NLP

Deciding Extensions of the Theory of Arrays by Integrating Decision Procedures and Instantiation Strategies

CMPS 277 Principles of Database Systems. Lecture #3

Expressive Power and Abstraction in Essence

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

Logic Programming and MDPs for Planning. Alborz Geramifard

UniLFS: A Unifying Logical Framework for Service Modeling and Contracting

Semantic data integration in P2P systems

INCONSISTENT DATABASES

Chapter 3: Relational Model

Relational Databases

Constraint Solving. Systems and Internet Infrastructure Security

Continuation Passing Style. Continuation Passing Style

A New Statement for Selection and Exception Handling in Imperative Languages arxiv: v3 [cs.pl] 24 Aug 2015

Introduction to Homotopy Type Theory

Reasoning about Actions for e-service Composition

Chapter 2: Relational Model

AN APPROACH TO THE FORMAL REPRESENTATION OF MATHEMATICAL PROPOSITIONS

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

Organization of Programming Languages CS3200/5200N. Lecture 11

Symbolic Trajectory Evaluation - A Survey

Transcription:

Situation Calculus and YAGI Institute for Software Technology 1

Progression another solution to the projection problem does a sentence hold for a future situation used for automated reasoning and planning in the SC observation: regression becomes slow for a long action sequence α idea: progress (roll forward) the actual initial data D S0 to a new initial database D Sα advantages queries can be answered using a shorter action sequence drawbacks one loses the action history progression is not always possible 3

Progression - Definition given a basic action theory D = Σ D SS D AP D UNA D S0 and a ground action term α a set of sentences D Sα is a (correct) progression of D S0 to D Sα wrt. α iff 1. the sentences in D Sα are uniform in S α 2. for every first-order formula φ about the future of S α D φ iff D D S0 D Sα φ 4

Progression - Existence progression is the dual problem of regression unfortunately it is conceptually much more complex for a finite D S0 the progression is always definable using second-order logic the progression is not always definable using first-order logic but we can restrict the initial database D S 0 in order to express the regression in first-order logic 5

Relatively Complete Databases D S0 is relatively complete iff it is the set formed by 1. the situation-independent sentences 2. one sentence for each fluent F in the form x. F(x, S 0 ) Π F (x) where Π F (x) is a situation-independent formula whose free variables are among x 6

Progressing Relatively Complete Databases I consider a basic action theory D with a relatively complete initial database D S0 suppose α to be a ground action if we want to progress D S0 to D Sα we have F(x, S α ) Φ F x, α, S 0 successor state axiom if F(x, S α ) mentions a fluent atom G t, S 0 replace it by Π G (t) using y. G(y, S 0 ) Π G (y) this leads to F(x, S α ) Ψ F x, α where Ψ F x, α is situation-independent D Sα is the union of D UNA, the situation-independent sentences in D S0 and the above for each fluent 7

Progressing Relatively Complete Databases II the set of sentences obtained are a progression of D S0 wrt. α the progressed set is again relatively complete we can apply the procedure again for another action 8

Golog Situation Calculus is yet only a theoretical construct Golog (algol for Logic) is based on the Situation Calculus it is a program language for dynamic systems it allows a balance between reasoning/planning and imperative programming (i.e., planning is expensive) it allows complex actions there exist Prolog interpreters for Golog 9

Golog a Golog program is based SC it uses the macro Do(,s,s ) Do(,s,s ) will be macro-expand to a SC formula the formula Do states that situation s is reachable from situation s by executing the program the syntax supports primitive and complex actions 10

Primitive Action: a Golog Syntax (1) has a precondition Poss and the effects are modeled in the successor state axioms walk(r,l) Test action: φ? tests if φ holds in a situation, does not change the situation ( ( x,y).nextto(x,y))? 1 Sequence: 1 ; 2 executes 1 and 2 one after each other walk(r,l);pickup(r,k) 1 situation suppressed form of fluents 11

Golog Syntax (2) Non-deterministic Choice of Actions: 1 2 (randomly) action 1 or 2 will be executed walk(r,a) walk(r,b) Non-deterministic Choice of Arguments: (π x) (x) (randomly) choose an argument x for the action (π x)pickup(r,x) Non-deterministic Iteration: * executes for a not defined number of times (n 0) (pickup(r,l);drop(r,l))* 12

On the Semantics of Golog Golog programs are macro-expanded to Situation Calculus formulas using the macro Do(,s,s ) what is the meaning of Golog and a program D ( s).do(,s 0,s) the Basic Action Theory entails if a given program lead to the situation s starting from S 0 drawback: the macros are less expressive a program trace can be obtained by a constructive proof of the above sentence some properties are provable: e.g., termination 14

YAGI Yet Another Golog Interpreter Golog suffers from several drawback unclear and uncommon syntax and semantics Prolog-based interpreter no separation of front/backend offline execution no feedback from the world YAGI is designed for keeping the situation calculus/golog foundations a sound definition of the language a separation of the front/backend familiarity to other common program languages online execution providing language statements to build up a basic action theory 15

YAGI Interpreter Architecture 16

Fluents as Databases YAGI fluents are similar to fluents in Situation Calculus they change their truth value with the situation but YAGI always does progression and refer to D S0, YAGI omits the situation term a n-ary fluent F in the BAT in YAGI is defined as fluent F[domain 1,domain 2,,domain n ]; domain is a finite set of strings, e.g { r1, r2, r3 } the semantics of a fluent F is defined by a database table the database columns represent the fluent s parameters a fluent F[<x 1,x 2,,x n >] holds iff the tuple is represented as a row in the database 17

Fluents YAGI Domain Definition defined by a fluent definition can be immutable if the keyword fact is used Actions defined by an action definition of the following form action goto($x,$y) precondition: ((<$x> in at) and not(<$y>)); effect: at = {<$y>}; signal: move from + $x + to + $y; end action 18

Procedures YAGI Procedures defined by a procedure definition of the following form proc dummy($x,$y) action_a($x); action_b($y); end proc the body of a procedure may contain any number of YAGI actions and YAGI statements 19

YAGI Program a YAGI program comprises of a set of declarations for fluents facts fluent assignments actions procedures a sequence of YAGI statements test action procedure call nondeterministic choice of actions nondeterministic pick of arguments conditional for loop while loop search 20

YAGI Fluent Assignments I can be used to assign truth values to fluents it can be done for a n-ary fluent F=S; or F=G; where S is a set of tuples compatible with F s arity and domains and G is a fluent with the same arity and domains, fluent F only holds for the members of S or for the same terms G holds F+=S; or F+=G; where S is a set of tuples compatible with F s arity and domains and G is a fluent with the same arity and domains, fluent F additionally holds for the members of S or for the same terms G holds F-=S; or F-=G; where S is a set of tuples compatible with F s arity and domains and G is a fluent with the same arity and domains, fluent F does not hold for the members of S or for the same terms G holds assignments can be used in the declaration to specify the initial database D S0 21

YAGI Fluent Assignments II YAGI allows also loop assignments of the form foreach <$x> in objects do owner += {<$x, Alice >} end for YAGI allows also conditional assignments of the form if (< Bread, Alice > in owner) do happy += {< Alice >} else happy -= {< Alice >} end if 22

YAGI Formulas I are similar to first order logic formulas they are used in action preconditions, test actions, conditionals, while loops they are online evaluated for their truth value 23

YAGI Formulas II formulas are build up the following way formula:= atom not (formula) atom connection atom exists tuple 1 in set (such formula) all tuple in set (such formula) tuple in set atom:= value compare value set compare set true false compare:= ==,!= <=,>=,<,> connection:= and,or,implies 1 tuples may comprise variables <$x, r1 > 24

YAGI Execution Semantics YAGI follows an online semantic (similar IndiGolog) the next possible and necessary action is derived and immediately executed the execution semantics is defined by 2 predicates YagiTrans(α, b, α, b ) holds if the YAGI program α can be executed using database b leading to the remaining program α and an updated database b YagiFinal(α, b) holds if the YAGI program α can legally terminate using database b 25

Semantics of YAGI Parts (1) primitive Action: a YagiTrans a, b, α, b φ AP,a α = null b = exec a, b YagiFinal a, b false φ AP,a is the precondition of a, null is the empty program, exec updates the database according to a s effects test action: φ?; YagiTrans φ? ;, b, α, b φ b α = null b = b YagiFinal φ? ;, b false Sequence: 1 ; 2 YagiTrans α 1 ; α 2, b, α, b γ. α = γ; α 2 YagiTrans α 1, b, γ, b YagiFinal α 1, b YagiTrans(α 2, b, α, b ) YagiFinal α 1 ; α 2, b YagiFinal α 1, b YagiFinal(α 2, b) 26

YAGI Setting Actions setting actions are similar to primitive actions except they have additional variables after a keyword external these variables are set by the backend the enable feedback from the world defined by an action definition of the following form action holding ($o) external ($x) effect: if ($x== true ) holds += {<$o>}; else holds -= {<$o>}; signal: holding + $o; end action 29

signals are strings Signals strings and the content of variables can be concatenated signals are emitted by actions to trigger activities in the backend the signal is decoded by the backend 31

Questions? 33