Extending Pattern Directed Inference Systems Algo & Data 2.

Slides:



Advertisements
Similar presentations
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Advertisements

A Program Transformation For Faster Goal-Directed Search Akash Lal, Shaz Qadeer Microsoft Research.
Truth Maintenance Systems. Outline What is a TMS? Basic TMS model Justification-based TMS.
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
Overview of Data Structures and Algorithms
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Best-First Search: Agendas
(1) ICS 313: Programming Language Theory Chapter 10: Implementing Subprograms.
CSE 425: Logic Programming I Logic and Programs Most programs use Boolean expressions over data Logic statements can express program semantics –I.e., axiomatic.
1 Programming Languages (CS 550) Simple Query Language* Jeremy R. Johnson *Material for this lecture comes from SICP chapter 4.
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Names and Scopes CS 351. Program Binding We should be familiar with this notion. A variable is bound to a method or current block e.g in C++: namespace.
1 Executing Method Calls This lecture tells you precisely how method calls are executed (a few details will have to wait until we get to classes and objects).
Environments and Evaluation
Functional programming: LISP Originally developed for symbolic computing First interactive, interpreted language Dynamic typing: values have types, variables.
Java Review 2 – Errors, Exceptions, Debugging Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Chapter TwelveModern Programming Languages1 Memory Locations For Variables.
Formal Models of Computation Part II The Logic Model
Introduction to Shell Script Programming
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Dale Roberts Procedural Programming using Java Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Natural deduction of logical proofs Kalish & Montegue: a set of heuristics for doing logical proofs Introduction rules –not introduction, and introduction,
1 Programming Languages (CS 550) Simple Query Language* Jeremy R. Johnson *Material for this lecture comes from SICP chapter 4.
Putting the JTMS to Work. Outline Interface between a JTMS and a rule engine Chronological Search versus Dependency Directed Search: A Playoff Using a.
RELATIONAL FAULT TOLERANT INTERFACE TO HETEROGENEOUS DISTRIBUTED DATABASES Prof. Osama Abulnaja Afraa Khalifah
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
Formal Semantics Chapter Twenty-ThreeModern Programming Languages, 2nd ed.1.
1 SystemVerilog Enhancement Requests Daniel Schostak Principal Engineer February 26 th 2010.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
Logic Programming CSC 358/ Outline Pattern matching Unification Logic programming.
Runtime Organization (Chapter 6) 1 Course Overview PART I: overview material 1Introduction 2Language processors (tombstone diagrams, bootstrapping) 3Architecture.
Natural deduction: the KM* system In contrast to forward / backward reasoning systems, natural deduction systems use many inference rules and at each step.
Prolog Program Style (ch. 8) Many style issues are applicable to any program in any language. Many style issues are applicable to any program in any language.
1 Chapter Four Creating and Using Classes. 2 Objectives Learn about class concepts How to create a class from which objects can be instantiated Learn.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Milos Hauskrecht (PDF) Hieu D. Vu (PPT) LISP PROGARMMING LANGUAGE.
CS 152: Programming Language Paradigms March 19 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
A Lattice Model of Secure Information Flow By Dorothy E. Denning Presented by Drayton Benner March 22, 2000.
Copyright © 2009 – Curt Hill Standard Template Library An Introduction.
 Static  Example for Static Field  Example for Static Method  Math class methods  Casting  Scope of Declaration  Method Overloading  Constructor.
Understanding Naturally Conveyed Explanations of Device Behavior Michael Oltmans and Randall Davis MIT Artificial Intelligence Lab.
Assumption-based Truth Maintenance Systems: Motivation n Problem solvers need to explore multiple contexts at the same time, instead of a single one (the.
Procedure Definitions and Semantics Procedures support control abstraction in programming languages. In most programming languages, a procedure is defined.
Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming.
Pattern-Directed Inference Systems Algorithms and Data Structures II Academic Year
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Design issues for Object-Oriented Languages
Operational Semantics of Scheme
Introduction to Logic for Artificial Intelligence Lecture 2
Why study programming languages?
Defining Macros in Lisp
CS 326 Programming Languages, Concepts and Implementation
Chapter 7: Introduction to CLIPS
Jess Architecture Diagram WORKING MEMORY INFERENCE ENGINE EXECUTION ENGINE PATTERN MATCHER RULE BASE Here you can see how all the parts fit.
KNOWLEDGE REPRESENTATION
6.001 SICP Variations on a Scheme
Defining Macros in Lisp
Recursive Procedures and Scopes
Defining Macros in Scheme
Course Overview PART I: overview material PART II: inside a compiler
Introduction to Methods and Interfaces
Presentation transcript:

Extending Pattern Directed Inference Systems Algo & Data 2

Extending the basic PDIS model How to increase the logical power of the system How to increase the efficiency of the system

FTRE Changes Syntax changes –Triggers are now a list, interpreted conjunctively –rassert! to remove backquotes Examples (rule (show ?q) (rule (implies ?p ?q) (assert! `(show,?p)))) becomes (rule ((show ?q) (implies ?p ?q)) (rassert! (show ?p)))

FTRE Syntax: Trigger keywords :VAR = next item is a variable to be bound to the entire preceding trigger pattern :TEST = next item is lisp code executed in environment so far. If NIL, match fails. Example: (rule ((show ?q) :test (not (fetch ?q)) (implies ?p ?q) :var ?imp) (debug-nd “~% BC-CE: Looking for ~A to use ~A..” ?p ?imp) (rassert! (show ?p)))

Problem: We need more inferential power Implementing full KM* requires the ability to make and retract assumptions –Indirect proof, negation introduction, conditional introduction, etc. Implementing search procedures more generally requires ability to make and retract assumptions –Example: N-queens problem

Key idea: Logical Environment The logical environment of a computation is the set of assumptions upon which it rests. Every program has a logical environment. In AI programs, a substantial fraction of that logical environment is represented explicitly in the program’s data structures. How to represent and manipulate logical environments is a key issue in problem solver design.

Stack model of logical environments Each operation that makes an assumption pushes a new stack frame. When the operation is finished, the stack is popped. Supports depth-first exploration of set of assumptions

Initial state of database (show P) (not Q) (implies (not P) Q) (implies (not Q) R)

Start of indirect proof attempt (show P) (not Q) (implies (not P) Q) (implies (not Q) R) (not P)

After CE on assumption (show P) (not Q) (implies (not P) Q) (implies (not Q) R) Q Contradiction (not P)

After successful indirect proof (show P) (not Q) (implies (not P) Q) (implies (not Q) R) P

Constraints on Assumption Stack Every assertion must be made in the newest context. –Guarantees retraction when assumption is retracted. Conclusions must be drawn in simplest possible logical environment –Prevents inappropriate retraction Every operation that requires an assumption must push a new context. –Otherwise could over-retract

Improving efficiency In TRE, alignment of logical variable bindings with Lisp variable bindings achieved via eval on a constructed let statement. –Inefficient. Should be able to compile rules. –Trick: Turn rules into procedures In TRE, pattern-matching was handled via calls to unify –Observation: We know one of the patterns already. –Trick: Open code unification

Making rules compilable Body of rule is lisp code -- should compile it –(Always compile your code! The error-checking alone is worth it.) Implementation in TRE won’t do Define a separate procedure for the rule body –Arguments are the pattern variables used –Do it automatically, user just writes rules Issues –Must create the appropriate environment –Must arrange contents of files so that procedures are defined before they are used, because matching facts can already be in the database.

Open code unification At compile time we know: –Structure of trigger pattern –What variables will already be bound –Any additional tests required. Idea: Create special-purpose procedure which does what unify would do on the trigger pattern Rule = match procedure and body procedure

Implementation issues for efficient rules & open-coded unification At rule expansion time, must process all subrules. Must keep track of variables that will be bound at run-time, to ensure that the appropriate lexical scoping is enforced. Tests performed by the unifier must be “unrolled” into a procedure. The rule and body procedures must have their argument lists set up correctly.