SlideShare une entreprise Scribd logo
1  sur  36
A Logic-Based Framework for Reactive Systems
                     or
           Programming with Logic
         without Logic Programming


       Robert Kowalski and Fariba Sadri
         Department of Computing
          Imperial College London
Ambition:
to unify

  • Programming

  • Databases

  • AI knowledge representation and problem-solving
Outline
•      KELPS - a simplified kernel for reactive logic-based
       production-style systems
•      KELPS model-theoretic semantics
•      KELPS operational semantics
•      LPS = KELPS + LP
•      MALPS = Multi Agent LPS (The Dining Philosophers)
•      Related work (MetateM, Transaction Logic)
•      Conclusions
KELPS


Programs are reactive rules with explicit time
in the logical form:

            antecedent(X)     consequent(X, Y)

i.e.       X [antecedent(X)     Y consequent(X, Y)]

whenever the antecedent is true in the past or present,
then the consequent is true in the future.
KELPS rules =
Composite events + rules + composite actions
    pre-sensor detects possible fire in area A at time T1 ∧
    smoke detector detects smoke in area A at time T2 ∧
    |T1 – T2 | 60 sec ∧ max(T1, T2, T)

    activate local fire suppression in area A at time T3 ∧ T <T3 T + 10 sec ∧
        fire in area A at time T4 ∧ T3 <T4 T3 + 30 sec ∧
    send security guard to area A at time T5 ∧ T4 <T5 T4 + 10 sec

∨   call fire department to area A at time T3‘∧ T <T3‘   T + 60 sec
Syntax of reactive rules
        antecedent1 (X) ∧… ∧ antecedentn (X)

        consequent11 (X, Y) ∧… ∧ consequent1l1 (X, Y)
    ∨ …
    ∨ consequentm1 (X, Y) ∧… ∧ consequentmlm (X, Y)
Each antecedenti (X) and consequenti j(X, Y) is
a condition, event atom or temporal constraint:

A condition is an FOL formula in the vocabulary of state predicates.

An event atom is an atomic formula representing an event.
An action atom is an event atom in which the event is an action.

A temporal constraint has the form time1 < time2 or time1 ≤ time2,
where at least one of time1 and time2 is a variable.
Comparison with MetateM (Michael Fisher et al)

Programs = reactive rules in modal temporal logic:

        ‘past and present formula’ implies ‘present or future formula’

Computation = model generation.

Model = possible worlds connected by an accessibility relation.

States updated by frame axioms.
Comparison with Transaction Logic (Bonner and Kifer)

   Programs = sequences of FOL queries and database updates.

   Computation = model generation.

   Model = possible worlds. Truth values relative to
   paths between possible worlds.

   States (databases) updated destructively.
Reactive rules are like:
       integrity constraints
       condition-action rules
       event-condition-action rules
       “plans” in BDI agents.
Reactive rules generate states using destructive updates.
States are model-theoretic structures represented as
sets of atomic sentences (also called facts or fluents), like:
       program variables
       relational databases
       Herbrand models
       representations of the real world.
The computational task is to generate a model in which all of the
reactive rules are true.
Operational Semantics: States are updated destructively.
Model-theoretic semantics: Facts are time-stamped.

                               ei
              Si                                Si+1

                old-fact                  new-fact
                fact1                     fact1
                fact2                     fact2
                …                         …
                factn                     factn



         ti        ti          ti+1 = ti +εi
Other semantics can be dealt with similarly


                                    ei
               Si                                     Si+1

                    old-fact                    new-fact
                    fact1                       fact1
                    fact2                       fact2
                    …                           …
                    factn                       factn



         ti                    ti        ti+1
LPS = KELPS + LP      Dialogue/parsing example
Reactive rule:
sentence(T1, T2)    sentence (T3, T4) T3 < T2 < T3 + 10

Basic (or atomic events):
word(my, 1, 2)        word(name, 2, 3)       word(is, 3, 4)     word(bob, 4, 5)

Composite events (or actions) represented by logic programs:
adjective(T1, T2)   word(my, T1, T2)
adjective(T1, T2)   word(your, T1, T2)
noun(T1, T2)    word(name, T1, T2)       verb(T1, T2)     word(is, T1, T2)
noun(T1, T2)    word(bob, T1, T2)        noun(T1, T2)     word(what, T1, T2)
sentence(T1, T3) noun-phrase(T1, T2) verb-phrase(T2, T3)
noun-phrase(T1, T3) adjective(T1, T2) noun(T2, T3)
noun-phrase(T1, T2) noun(T1, T2)
verb-phrase(T1, T3) verb(T1, T2) noun-phrase(T2, T3)
verb-phrase(T1, T2) verb(T1, T2)
Example: teleo-reactive program

Let   be a small number.

methane-level(M, T) critical   M
  alarm(T’) T < T’ T +

methane-level(M, T) critical > M    water-level(W, T)    high < W
   pump(T’) T < T’ T +

methane-level (M, T) critical > M    water-level(W, T)
low < W pump-active(T)
   pump(T’) T < T’ T +
Non-modal time-free syntax


methane-level(M)   critical   M
   : alarm

methane-level(M)   critical > M   water-level(W)    high < W
  : pump

methane-level (M) critical > M     water-level(W)
low < W pump-active
   : pump
Model-theoretic Semantics:
  Facts are represented with time parameters.
  All states and events are combined into a single model.




methane-level(M, T)   critical   M    alarm(T’)   T < T’ T +
Outline
•      KELPS - a simplified KErnel for reactive Logic-based
       Production-style Systems
•      KELPS model-theoretic semantics
•      KELPS operational semantics
•      LPS = KELPS + LP
•      MALPS = Multi Agent LPS (The Dining Philosophers)
•      Related work (MetateM, Transaction Logic)
•      Conclusions
KELPS model-theoretic semantics
Given reactive rules R0, initial state S0, set of ground atoms
Aux defining auxiliary predicates, and
sequence of sets of external events ex1,…, exi,….

the computational task is to generate sets of actions a1,…, ai,…. such that
R0 is true in the Herbrand model:

    M = Aux         S0*   e1*   S1*    e2*    …        ei*   Si*    ei+1*….

    ei = exi ai
    ei* = {happens(e, ti) | e         ei at time ti}


    Si+1 = ( Si –     {p | terminates(p, ei, ti) is true in Si} )      initiates and
                      {p | initiates(p, ei, ti) is true in Si}         terminates are
                                                                       defined by a
     Si* =    {holds(p, ti) | p       Si at time ti}                    “domain theory” D
KELPS model-theoretic semantics

The computational task is to generate sets of actions a1,…, ai,…. such
that R0 is true in the Herbrand model:


    M = Aux     S0*   e1*   S1*   e2*   …     ei*   Si*   ei+1* ….

Here R0 can be generalised to arbitrary sentences
(or integrity constraints) of FOL.
The operational semantics becomes more difficult.

Frame axioms of the situation calculus (or event calculus) are
emergent properties that are true in M.
KELPS model-theoretic semantics

Definition: ETholds             holds(P, T)         happens(E, T) initiates(E, P, T)
                                holds(P, T2)        holds(P, T1) happens(E, T2)
                                next(T1, T2)       ¬ terminates(E, P, T2)

Theorem. The Herbrand model:

         Aux      S0*     e1*     S1*      e2*     …         ei*       Si*         ei+1*….

Is contained in the weakly perfect model
of the weakly stratified logic program:

        ETholds       D    Aux       S0*     e1*       e2*         …         ei*     ei+1*….

where D defines initiates, terminates, possible and next.
Outline
•      KELPS - a simplified KErnel for reactive Logic-based
       Production-style Systems
•      KELPS model-theoretic semantics
•      KELPS operational semantics
•      LPS = KELPS + LP
•      MALPS = Multi Agent LPS (The Dining Philosophers)
•      Related work (MetateM, Transaction Logic)
•      Conclusions
KELPS operational semantics is an
observe–decide–think –act cycle.

The i-th cycle starts with state Si-1, goal state Gi,
rules Ri and events ei at time ti .

Logically, Gi is a conjunction of disjunctions of conjunctions.

Each disjunction has the syntax of the consequents of reactive rules.
Operationally, each conjunct is a separate thread.

Each disjunct is an alternative partially executed conditional plan.
KELPS operational semantics
Step 0. Observe. Use ei to transform state Si-1 into state Si.

Step 1. Think. If earlier-antecedents(X) later-antecedents(X) consequent(X, Y)
is in Ri and      earlier-antecedents(x) is true in Aux ei* Si*,
then simplify any temporal constraints in later-antecedents(x) consequent(x, Y)
and add the result to Ri to obtain Ri+1.

If later-antecedents(x) is empty, then add the result to Gi as a new thread.

Step 2.1. Decide. Choose a set D of disjuncts from one or more threads in Gi.

Step 2.2. Think. For every disjunct in D, choose a form
earlier-consequents(Y) later-consequents(Y).
If earlier-consequents(y) is true in Aux ei* Si*, then
simplify any temporal constraints in later-consequents(y)
and add the result as an new disjunct to the same thread in D to obtain Gi+1.

Step 2.3. Act. For every disjunct in D of a form
actions(Z) other-consequents(Z), choose such a form,
attempt to execute actions(Z) and
add any successfully executed instances actions(z) to ei+1.
The operational semantics is sound with respect to
the model-theoretic semantics.

Theorem 1. Soundness. Given a program R0 with domain
theory D , an initial state S0, goal state G0, and a sequence of sets
of external events ex1,…, exn,…., suppose the OS generates a
possibly infinite sequence: S0, R0, G0 , a1, … ,
Si, Ri, Gi, ai+1, …. Let M be the perfect model of:

D     S0*    e1*   ….    Si*   ei+1* …..

where ei = exi ai . Then R0 G0 is true in M if for every top-
level goal G added to a goal state Gi as a new thread, there exists
a goal state Gj such that i ≤ j and the empty disjunct (equivalent
to true) is added a disjunct to the same thread as G in Gj.
Incompleteness


The operational semantics is incomplete.
It cannot preventively make a rule true by making its
antecedents false:
      attacks(X, me, T1) ¬ prepared-for-attack(me, T1)
          surrender(me, T2) T1 < T2 T1 +
It cannot proactively make a reactive rule true by making its
consequents true before its antecedents become true:
      enter-bus(me, T1)
         have-ticket(me, T2)   T1 < T2 T1 +
Outline
•      KELPS - a simplified KErnel for reactive Logic-based
        Production-style Systems
•      KELPS model-theoretic semantics
•      KELPS operational semantics
•      LPS = KELPS + LP
•      MALPS = Multi Agent LPS (The Dining Philosophers)
•      Related work (MetateM, Transaction Logic)
•      Conclusions
LPS = KELPS + LP model-theoretic semantics
Let LP be a locally stratified logic program defining the auxiliary
predicates . LP = Ltimeless Lint Levent D.

    Ltimeless defines time-independent predicates.
   Lint defines intentional predicates.
   Lint defines composite events.
   D defines the domain theory.
   (Events initiate and terminate only extensional predicates.)

The computational task is to generate actions a1,…, ai,…. such that
R0 is true in the perfect model of:

   LP     S0*    e1*    S1*     e2*    …      ei*   Si*   ei+1* ….
Outline
•      KELPS - a simplified KErnel for reactive Logic-based
       Production-style Systems
•      KELPS model-theoretic semantics
•      KELPS operational semantics
•      LPS = KELPS + LP
•      MALPS = Multi Agent LPS (The Dining Philosophers)
•      Related work (MetateM, Transaction Logic)
•      Conclusions
The Dining Philosophers
The Dining Philosophers – solution in MALPS
(multi-agent LPS)
The initial state S0:

available(fork0)
available(fork1)
available(fork2)
available(fork3)
available(fork4)

Aux/Ltimeless

adjacent(fork0, philosopher(0), fork1)
adjacent(fork1, philosopher(1), fork2)
adjacent(fork2, philosopher(2), fork3)
adjacent(fork3, philosopher(3), fork4)
adjacent(fork4, philosopher(4), fork0)
Actions are defined by a domain specific event theory
D, specifying preconditions and the fluents that are
initiated and terminated.

                  think(philosopher(I))
   initiates      thinking(philosopher(I)).

                  eat(philosopher(I))
   initiates      eating(philosopher(I))
   terminates     thinking(philosopher(I)).

                 pickup-forks(philosopher(I))
   terminates    available(F1) and available(F2)
   preconditions available(F1), available(F2) where
                 adjacent(F1, philosopher(I), F2).

                  putdown-forks(philosopher(I))
   terminates     eating(philosopher(I))
   initiates      available(F1), available(F2) where
                  adjacent(F1, philosopher(I), F2) .
The Dining Philosophers – with time-free syntax
                          and auxiliary logic program

time-to-eat(philosopher(I))
   dine(philosopher(I))

dine(philosopher(I))
   think(philosopher(I)),
    pickup-forks(philosopher(I)),
    eat(philosopher(I)),
    putdown-forks(philosopher(I)).
Outline
•      KELPS - a simplified KErnel for reactive Logic-based
       Production-style Systems
•      KELPS model-theoretic semantics
•      KELPS operational semantics
•      LPS = KELPS + LP
•      MALPS = Multi Agent LPS (The Dining Philosophers)
•      Related work (MetateM, Transaction Logic)
•      Conclusions
Comparison with MetateM (Michael Fisher et al)

Programs = reactive rules in modal temporal logic:

        ‘past and present formula’ implies ‘present or future formula’

Computation = generate model of the reactive rules.

Model = possible worlds connected by an accessibility relation.

States updated by frame axioms.

Interaction by message passing.
Comparison with Transaction Logic (Bonner and Kifer)
   Programs = complex actions (and transactions) =
   sequences of FOL queries and actions.

   Computation = generate model of complex actions.

   Model = possible worlds. Truth values relative to
   paths in a collection of possible worlds.

   Reactive rule is true if,
   for every path over which the antecedents are true,
   there exists a later path over which the consequents are true.

   States updated destructively.

   Interaction via a global state.
LPS: alternative external notations

Transaction Logic:
P    Q means P(T1) Q(T2) T1 < T2
      or P(T1 , T2) Q(T3, T4) T2 < T3


Modal temporal logic:
P    ◊Q means P(T1) Q(T2) T1 < T2.
P    Q means P(T) Q(T+1)
              or P(T1) Q(T2) T1 <T2             T1+ ε


Graphical notation:
           P
                                         R
           Q
means P(T1)    Q(T2)   R(T3)   T1 < T3       T2 < T3

9/6/2012                                                35
Conclusions
•   KELPS simplifies LPS, by eliminating logic programming.
    It extends LPS, by including a form of composite events.

•   The operational semantics is based on destructive updates.

•   The model-theoretic semantics of KELPS is inspired by the
    minimal model semantics of logic programming.

•   The model-theory and operational semantics can be
    extended to deal with other “integrity constraints”.

•   KELPS gives a declarative semantics to imperative computing.

•   KELPS puts logic programming in its place.

Contenu connexe

Tendances

Spectral Learning Methods for Finite State Machines with Applications to Na...
  Spectral Learning Methods for Finite State Machines with Applications to Na...  Spectral Learning Methods for Finite State Machines with Applications to Na...
Spectral Learning Methods for Finite State Machines with Applications to Na...
LARCA UPC
 
PaperNo3-YousefiHabibi-IMF
PaperNo3-YousefiHabibi-IMFPaperNo3-YousefiHabibi-IMF
PaperNo3-YousefiHabibi-IMF
Mezban Habibi
 
05 history of cv a machine learning (theory) perspective on computer vision
05  history of cv a machine learning (theory) perspective on computer vision05  history of cv a machine learning (theory) perspective on computer vision
05 history of cv a machine learning (theory) perspective on computer vision
zukun
 
Potentialist reflection
Potentialist reflectionPotentialist reflection
Potentialist reflection
jamesstudd
 
Presentation-Alex-20150421
Presentation-Alex-20150421Presentation-Alex-20150421
Presentation-Alex-20150421
alexfang2014
 
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Cristiano Longo
 

Tendances (20)

Spectral Learning Methods for Finite State Machines with Applications to Na...
  Spectral Learning Methods for Finite State Machines with Applications to Na...  Spectral Learning Methods for Finite State Machines with Applications to Na...
Spectral Learning Methods for Finite State Machines with Applications to Na...
 
PaperNo3-YousefiHabibi-IMF
PaperNo3-YousefiHabibi-IMFPaperNo3-YousefiHabibi-IMF
PaperNo3-YousefiHabibi-IMF
 
05 history of cv a machine learning (theory) perspective on computer vision
05  history of cv a machine learning (theory) perspective on computer vision05  history of cv a machine learning (theory) perspective on computer vision
05 history of cv a machine learning (theory) perspective on computer vision
 
Properties of Fourier transform
Properties of Fourier transformProperties of Fourier transform
Properties of Fourier transform
 
Lecture10 Signal and Systems
Lecture10 Signal and SystemsLecture10 Signal and Systems
Lecture10 Signal and Systems
 
Potentialist reflection
Potentialist reflectionPotentialist reflection
Potentialist reflection
 
Influence of the sampling on Functional Data Analysis
Influence of the sampling on Functional Data AnalysisInfluence of the sampling on Functional Data Analysis
Influence of the sampling on Functional Data Analysis
 
Laplace transform & fourier series
Laplace transform & fourier seriesLaplace transform & fourier series
Laplace transform & fourier series
 
EM3 mini project Laplace Transform
EM3 mini project Laplace TransformEM3 mini project Laplace Transform
EM3 mini project Laplace Transform
 
Discussion of Faming Liang's talk
Discussion of Faming Liang's talkDiscussion of Faming Liang's talk
Discussion of Faming Liang's talk
 
E212126
E212126E212126
E212126
 
Fourier Transform
Fourier TransformFourier Transform
Fourier Transform
 
5. fourier properties
5. fourier properties5. fourier properties
5. fourier properties
 
Presentation-Alex-20150421
Presentation-Alex-20150421Presentation-Alex-20150421
Presentation-Alex-20150421
 
Eece 301 note set 14 fourier transform
Eece 301 note set 14 fourier transformEece 301 note set 14 fourier transform
Eece 301 note set 14 fourier transform
 
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
Herbrand-satisfiability of a Quantified Set-theoretical Fragment (Cantone, Lo...
 
Bai tap-prolog-da-tap-hop-9889
Bai tap-prolog-da-tap-hop-9889Bai tap-prolog-da-tap-hop-9889
Bai tap-prolog-da-tap-hop-9889
 
Group theory notes
Group theory notesGroup theory notes
Group theory notes
 
Pre- Operator Compact Space
Pre- Operator Compact SpacePre- Operator Compact Space
Pre- Operator Compact Space
 
Group Theory
Group TheoryGroup Theory
Group Theory
 

Similaire à KELPS LPS - A Logic-Based Framework for Reactive System30 aug 2012

Noise Immunity With Hermite Polynomial Presentation Final Presentation
Noise Immunity With Hermite Polynomial Presentation Final PresentationNoise Immunity With Hermite Polynomial Presentation Final Presentation
Noise Immunity With Hermite Polynomial Presentation Final Presentation
guestf6db45
 
A proof induction has two standard parts. The first establishing tha.pdf
A proof induction has two standard parts. The first  establishing tha.pdfA proof induction has two standard parts. The first  establishing tha.pdf
A proof induction has two standard parts. The first establishing tha.pdf
leventhalbrad49439
 

Similaire à KELPS LPS - A Logic-Based Framework for Reactive System30 aug 2012 (20)

Can we estimate a constant?
Can we estimate a constant?Can we estimate a constant?
Can we estimate a constant?
 
Laplace transform
Laplace transformLaplace transform
Laplace transform
 
On the k-Riemann-Liouville fractional integral and applications
On the k-Riemann-Liouville fractional integral and applications On the k-Riemann-Liouville fractional integral and applications
On the k-Riemann-Liouville fractional integral and applications
 
Inverse laplace transforms
Inverse laplace transformsInverse laplace transforms
Inverse laplace transforms
 
phuong trinh vi phan d geometry part 2
phuong trinh vi phan d geometry part 2phuong trinh vi phan d geometry part 2
phuong trinh vi phan d geometry part 2
 
IVR - Chapter 1 - Introduction
IVR - Chapter 1 - IntroductionIVR - Chapter 1 - Introduction
IVR - Chapter 1 - Introduction
 
Algorithms and Complexity: Cryptography Theory
Algorithms and Complexity: Cryptography TheoryAlgorithms and Complexity: Cryptography Theory
Algorithms and Complexity: Cryptography Theory
 
senior seminar
senior seminarsenior seminar
senior seminar
 
lec04.pdf
lec04.pdflec04.pdf
lec04.pdf
 
Noise Immunity With Hermite Polynomial Presentation Final Presentation
Noise Immunity With Hermite Polynomial Presentation Final PresentationNoise Immunity With Hermite Polynomial Presentation Final Presentation
Noise Immunity With Hermite Polynomial Presentation Final Presentation
 
Fol
FolFol
Fol
 
Mit18 330 s12_chapter5
Mit18 330 s12_chapter5Mit18 330 s12_chapter5
Mit18 330 s12_chapter5
 
Unit-8.pdf
Unit-8.pdfUnit-8.pdf
Unit-8.pdf
 
free Video lecture
free Video lecture free Video lecture
free Video lecture
 
A proof induction has two standard parts. The first establishing tha.pdf
A proof induction has two standard parts. The first  establishing tha.pdfA proof induction has two standard parts. The first  establishing tha.pdf
A proof induction has two standard parts. The first establishing tha.pdf
 
Chapter10
Chapter10Chapter10
Chapter10
 
Ft3 new
Ft3 newFt3 new
Ft3 new
 
Understanding lattice Boltzmann boundary conditions through moments
Understanding lattice Boltzmann boundary conditions through momentsUnderstanding lattice Boltzmann boundary conditions through moments
Understanding lattice Boltzmann boundary conditions through moments
 
Dynamic programing
Dynamic programingDynamic programing
Dynamic programing
 
3_MLE_printable.pdf
3_MLE_printable.pdf3_MLE_printable.pdf
3_MLE_printable.pdf
 

Plus de RuleML

A software agent controlling 2 robot arms in co-operating concurrent tasks
A software agent controlling 2 robot arms in co-operating concurrent tasksA software agent controlling 2 robot arms in co-operating concurrent tasks
A software agent controlling 2 robot arms in co-operating concurrent tasks
RuleML
 

Plus de RuleML (20)

Aggregates in Recursion: Issues and Solutions
Aggregates in Recursion: Issues and SolutionsAggregates in Recursion: Issues and Solutions
Aggregates in Recursion: Issues and Solutions
 
A software agent controlling 2 robot arms in co-operating concurrent tasks
A software agent controlling 2 robot arms in co-operating concurrent tasksA software agent controlling 2 robot arms in co-operating concurrent tasks
A software agent controlling 2 robot arms in co-operating concurrent tasks
 
Port Clearance Rules in PSOA RuleML: From Controlled-English Regulation to Ob...
Port Clearance Rules in PSOA RuleML: From Controlled-English Regulation to Ob...Port Clearance Rules in PSOA RuleML: From Controlled-English Regulation to Ob...
Port Clearance Rules in PSOA RuleML: From Controlled-English Regulation to Ob...
 
RuleML 2015: When Processes Rule Events
RuleML 2015: When Processes Rule EventsRuleML 2015: When Processes Rule Events
RuleML 2015: When Processes Rule Events
 
RuleML 2015: Ontology Reasoning using Rules in an eHealth Context
RuleML 2015: Ontology Reasoning using Rules in an eHealth ContextRuleML 2015: Ontology Reasoning using Rules in an eHealth Context
RuleML 2015: Ontology Reasoning using Rules in an eHealth Context
 
RuleML 2015: Semantics of Notation3 Logic: A Solution for Implicit Quantifica...
RuleML 2015: Semantics of Notation3 Logic: A Solution for Implicit Quantifica...RuleML 2015: Semantics of Notation3 Logic: A Solution for Implicit Quantifica...
RuleML 2015: Semantics of Notation3 Logic: A Solution for Implicit Quantifica...
 
Challenge@RuleML2015 Developing Situation-Aware Applications for Disaster Man...
Challenge@RuleML2015 Developing Situation-Aware Applications for Disaster Man...Challenge@RuleML2015 Developing Situation-Aware Applications for Disaster Man...
Challenge@RuleML2015 Developing Situation-Aware Applications for Disaster Man...
 
Rule Generalization Strategies in Incremental Learning of Disjunctive Concepts
Rule Generalization Strategies in Incremental Learning of Disjunctive ConceptsRule Generalization Strategies in Incremental Learning of Disjunctive Concepts
Rule Generalization Strategies in Incremental Learning of Disjunctive Concepts
 
RuleML 2015 Constraint Handling Rules - What Else?
RuleML 2015 Constraint Handling Rules - What Else?RuleML 2015 Constraint Handling Rules - What Else?
RuleML 2015 Constraint Handling Rules - What Else?
 
RuleML2015 The Herbrand Manifesto - Thinking Inside the Box
RuleML2015 The Herbrand Manifesto - Thinking Inside the Box RuleML2015 The Herbrand Manifesto - Thinking Inside the Box
RuleML2015 The Herbrand Manifesto - Thinking Inside the Box
 
RuleML2015 PSOA RuleML: Integrated Object-Relational Data and Rules
RuleML2015 PSOA RuleML: Integrated Object-Relational Data and RulesRuleML2015 PSOA RuleML: Integrated Object-Relational Data and Rules
RuleML2015 PSOA RuleML: Integrated Object-Relational Data and Rules
 
Industry@RuleML2015: Norwegian State of Estate A Reporting Service for the St...
Industry@RuleML2015: Norwegian State of Estate A Reporting Service for the St...Industry@RuleML2015: Norwegian State of Estate A Reporting Service for the St...
Industry@RuleML2015: Norwegian State of Estate A Reporting Service for the St...
 
A Service for Improving the Assignments of Common Agriculture Policy Funds to...
A Service for Improving the Assignments of Common Agriculture Policy Funds to...A Service for Improving the Assignments of Common Agriculture Policy Funds to...
A Service for Improving the Assignments of Common Agriculture Policy Funds to...
 
Datalog+-Track Introduction & Reasoning on UML Class Diagrams via Datalog+-
Datalog+-Track Introduction & Reasoning on UML Class Diagrams via Datalog+-Datalog+-Track Introduction & Reasoning on UML Class Diagrams via Datalog+-
Datalog+-Track Introduction & Reasoning on UML Class Diagrams via Datalog+-
 
RuleML2015: Binary Frontier-guarded ASP with Function Symbols
RuleML2015: Binary Frontier-guarded ASP with Function SymbolsRuleML2015: Binary Frontier-guarded ASP with Function Symbols
RuleML2015: Binary Frontier-guarded ASP with Function Symbols
 
RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms
RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge PlatformsRuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms
RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms
 
RuleML2015: Rule-Based Exploration of Structured Data in the Browser
RuleML2015: Rule-Based Exploration of Structured Data in the BrowserRuleML2015: Rule-Based Exploration of Structured Data in the Browser
RuleML2015: Rule-Based Exploration of Structured Data in the Browser
 
RuleML2015: Ontology-Based Multidimensional Contexts with Applications to Qua...
RuleML2015: Ontology-Based Multidimensional Contexts with Applications to Qua...RuleML2015: Ontology-Based Multidimensional Contexts with Applications to Qua...
RuleML2015: Ontology-Based Multidimensional Contexts with Applications to Qua...
 
RuleML2015: Compact representation of conditional probability for rule-based...
RuleML2015:  Compact representation of conditional probability for rule-based...RuleML2015:  Compact representation of conditional probability for rule-based...
RuleML2015: Compact representation of conditional probability for rule-based...
 
RuleML2015: Learning Characteristic Rules in Geographic Information Systems
RuleML2015: Learning Characteristic Rules in Geographic Information SystemsRuleML2015: Learning Characteristic Rules in Geographic Information Systems
RuleML2015: Learning Characteristic Rules in Geographic Information Systems
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

KELPS LPS - A Logic-Based Framework for Reactive System30 aug 2012

  • 1. A Logic-Based Framework for Reactive Systems or Programming with Logic without Logic Programming Robert Kowalski and Fariba Sadri Department of Computing Imperial College London
  • 2. Ambition: to unify • Programming • Databases • AI knowledge representation and problem-solving
  • 3. Outline • KELPS - a simplified kernel for reactive logic-based production-style systems • KELPS model-theoretic semantics • KELPS operational semantics • LPS = KELPS + LP • MALPS = Multi Agent LPS (The Dining Philosophers) • Related work (MetateM, Transaction Logic) • Conclusions
  • 4. KELPS Programs are reactive rules with explicit time in the logical form: antecedent(X) consequent(X, Y) i.e. X [antecedent(X) Y consequent(X, Y)] whenever the antecedent is true in the past or present, then the consequent is true in the future.
  • 5. KELPS rules = Composite events + rules + composite actions pre-sensor detects possible fire in area A at time T1 ∧ smoke detector detects smoke in area A at time T2 ∧ |T1 – T2 | 60 sec ∧ max(T1, T2, T) activate local fire suppression in area A at time T3 ∧ T <T3 T + 10 sec ∧ fire in area A at time T4 ∧ T3 <T4 T3 + 30 sec ∧ send security guard to area A at time T5 ∧ T4 <T5 T4 + 10 sec ∨ call fire department to area A at time T3‘∧ T <T3‘ T + 60 sec
  • 6. Syntax of reactive rules antecedent1 (X) ∧… ∧ antecedentn (X) consequent11 (X, Y) ∧… ∧ consequent1l1 (X, Y) ∨ … ∨ consequentm1 (X, Y) ∧… ∧ consequentmlm (X, Y) Each antecedenti (X) and consequenti j(X, Y) is a condition, event atom or temporal constraint: A condition is an FOL formula in the vocabulary of state predicates. An event atom is an atomic formula representing an event. An action atom is an event atom in which the event is an action. A temporal constraint has the form time1 < time2 or time1 ≤ time2, where at least one of time1 and time2 is a variable.
  • 7. Comparison with MetateM (Michael Fisher et al) Programs = reactive rules in modal temporal logic: ‘past and present formula’ implies ‘present or future formula’ Computation = model generation. Model = possible worlds connected by an accessibility relation. States updated by frame axioms.
  • 8. Comparison with Transaction Logic (Bonner and Kifer) Programs = sequences of FOL queries and database updates. Computation = model generation. Model = possible worlds. Truth values relative to paths between possible worlds. States (databases) updated destructively.
  • 9. Reactive rules are like: integrity constraints condition-action rules event-condition-action rules “plans” in BDI agents. Reactive rules generate states using destructive updates. States are model-theoretic structures represented as sets of atomic sentences (also called facts or fluents), like: program variables relational databases Herbrand models representations of the real world. The computational task is to generate a model in which all of the reactive rules are true.
  • 10. Operational Semantics: States are updated destructively. Model-theoretic semantics: Facts are time-stamped. ei Si Si+1 old-fact new-fact fact1 fact1 fact2 fact2 … … factn factn ti ti ti+1 = ti +εi
  • 11. Other semantics can be dealt with similarly ei Si Si+1 old-fact new-fact fact1 fact1 fact2 fact2 … … factn factn ti ti ti+1
  • 12. LPS = KELPS + LP Dialogue/parsing example Reactive rule: sentence(T1, T2) sentence (T3, T4) T3 < T2 < T3 + 10 Basic (or atomic events): word(my, 1, 2) word(name, 2, 3) word(is, 3, 4) word(bob, 4, 5) Composite events (or actions) represented by logic programs: adjective(T1, T2) word(my, T1, T2) adjective(T1, T2) word(your, T1, T2) noun(T1, T2) word(name, T1, T2) verb(T1, T2) word(is, T1, T2) noun(T1, T2) word(bob, T1, T2) noun(T1, T2) word(what, T1, T2) sentence(T1, T3) noun-phrase(T1, T2) verb-phrase(T2, T3) noun-phrase(T1, T3) adjective(T1, T2) noun(T2, T3) noun-phrase(T1, T2) noun(T1, T2) verb-phrase(T1, T3) verb(T1, T2) noun-phrase(T2, T3) verb-phrase(T1, T2) verb(T1, T2)
  • 13. Example: teleo-reactive program Let be a small number. methane-level(M, T) critical M alarm(T’) T < T’ T + methane-level(M, T) critical > M water-level(W, T) high < W pump(T’) T < T’ T + methane-level (M, T) critical > M water-level(W, T) low < W pump-active(T) pump(T’) T < T’ T +
  • 14. Non-modal time-free syntax methane-level(M) critical M : alarm methane-level(M) critical > M water-level(W) high < W : pump methane-level (M) critical > M water-level(W) low < W pump-active : pump
  • 15. Model-theoretic Semantics: Facts are represented with time parameters. All states and events are combined into a single model. methane-level(M, T) critical M alarm(T’) T < T’ T +
  • 16. Outline • KELPS - a simplified KErnel for reactive Logic-based Production-style Systems • KELPS model-theoretic semantics • KELPS operational semantics • LPS = KELPS + LP • MALPS = Multi Agent LPS (The Dining Philosophers) • Related work (MetateM, Transaction Logic) • Conclusions
  • 17. KELPS model-theoretic semantics Given reactive rules R0, initial state S0, set of ground atoms Aux defining auxiliary predicates, and sequence of sets of external events ex1,…, exi,…. the computational task is to generate sets of actions a1,…, ai,…. such that R0 is true in the Herbrand model: M = Aux S0* e1* S1* e2* … ei* Si* ei+1*…. ei = exi ai ei* = {happens(e, ti) | e ei at time ti} Si+1 = ( Si – {p | terminates(p, ei, ti) is true in Si} ) initiates and {p | initiates(p, ei, ti) is true in Si} terminates are defined by a Si* = {holds(p, ti) | p Si at time ti} “domain theory” D
  • 18. KELPS model-theoretic semantics The computational task is to generate sets of actions a1,…, ai,…. such that R0 is true in the Herbrand model: M = Aux S0* e1* S1* e2* … ei* Si* ei+1* …. Here R0 can be generalised to arbitrary sentences (or integrity constraints) of FOL. The operational semantics becomes more difficult. Frame axioms of the situation calculus (or event calculus) are emergent properties that are true in M.
  • 19. KELPS model-theoretic semantics Definition: ETholds holds(P, T) happens(E, T) initiates(E, P, T) holds(P, T2) holds(P, T1) happens(E, T2) next(T1, T2) ¬ terminates(E, P, T2) Theorem. The Herbrand model: Aux S0* e1* S1* e2* … ei* Si* ei+1*…. Is contained in the weakly perfect model of the weakly stratified logic program: ETholds D Aux S0* e1* e2* … ei* ei+1*…. where D defines initiates, terminates, possible and next.
  • 20. Outline • KELPS - a simplified KErnel for reactive Logic-based Production-style Systems • KELPS model-theoretic semantics • KELPS operational semantics • LPS = KELPS + LP • MALPS = Multi Agent LPS (The Dining Philosophers) • Related work (MetateM, Transaction Logic) • Conclusions
  • 21. KELPS operational semantics is an observe–decide–think –act cycle. The i-th cycle starts with state Si-1, goal state Gi, rules Ri and events ei at time ti . Logically, Gi is a conjunction of disjunctions of conjunctions. Each disjunction has the syntax of the consequents of reactive rules. Operationally, each conjunct is a separate thread. Each disjunct is an alternative partially executed conditional plan.
  • 22. KELPS operational semantics Step 0. Observe. Use ei to transform state Si-1 into state Si. Step 1. Think. If earlier-antecedents(X) later-antecedents(X) consequent(X, Y) is in Ri and earlier-antecedents(x) is true in Aux ei* Si*, then simplify any temporal constraints in later-antecedents(x) consequent(x, Y) and add the result to Ri to obtain Ri+1. If later-antecedents(x) is empty, then add the result to Gi as a new thread. Step 2.1. Decide. Choose a set D of disjuncts from one or more threads in Gi. Step 2.2. Think. For every disjunct in D, choose a form earlier-consequents(Y) later-consequents(Y). If earlier-consequents(y) is true in Aux ei* Si*, then simplify any temporal constraints in later-consequents(y) and add the result as an new disjunct to the same thread in D to obtain Gi+1. Step 2.3. Act. For every disjunct in D of a form actions(Z) other-consequents(Z), choose such a form, attempt to execute actions(Z) and add any successfully executed instances actions(z) to ei+1.
  • 23. The operational semantics is sound with respect to the model-theoretic semantics. Theorem 1. Soundness. Given a program R0 with domain theory D , an initial state S0, goal state G0, and a sequence of sets of external events ex1,…, exn,…., suppose the OS generates a possibly infinite sequence: S0, R0, G0 , a1, … , Si, Ri, Gi, ai+1, …. Let M be the perfect model of: D S0* e1* …. Si* ei+1* ….. where ei = exi ai . Then R0 G0 is true in M if for every top- level goal G added to a goal state Gi as a new thread, there exists a goal state Gj such that i ≤ j and the empty disjunct (equivalent to true) is added a disjunct to the same thread as G in Gj.
  • 24. Incompleteness The operational semantics is incomplete. It cannot preventively make a rule true by making its antecedents false: attacks(X, me, T1) ¬ prepared-for-attack(me, T1) surrender(me, T2) T1 < T2 T1 + It cannot proactively make a reactive rule true by making its consequents true before its antecedents become true: enter-bus(me, T1) have-ticket(me, T2) T1 < T2 T1 +
  • 25. Outline • KELPS - a simplified KErnel for reactive Logic-based Production-style Systems • KELPS model-theoretic semantics • KELPS operational semantics • LPS = KELPS + LP • MALPS = Multi Agent LPS (The Dining Philosophers) • Related work (MetateM, Transaction Logic) • Conclusions
  • 26. LPS = KELPS + LP model-theoretic semantics Let LP be a locally stratified logic program defining the auxiliary predicates . LP = Ltimeless Lint Levent D. Ltimeless defines time-independent predicates. Lint defines intentional predicates. Lint defines composite events. D defines the domain theory. (Events initiate and terminate only extensional predicates.) The computational task is to generate actions a1,…, ai,…. such that R0 is true in the perfect model of: LP S0* e1* S1* e2* … ei* Si* ei+1* ….
  • 27. Outline • KELPS - a simplified KErnel for reactive Logic-based Production-style Systems • KELPS model-theoretic semantics • KELPS operational semantics • LPS = KELPS + LP • MALPS = Multi Agent LPS (The Dining Philosophers) • Related work (MetateM, Transaction Logic) • Conclusions
  • 29. The Dining Philosophers – solution in MALPS (multi-agent LPS) The initial state S0: available(fork0) available(fork1) available(fork2) available(fork3) available(fork4) Aux/Ltimeless adjacent(fork0, philosopher(0), fork1) adjacent(fork1, philosopher(1), fork2) adjacent(fork2, philosopher(2), fork3) adjacent(fork3, philosopher(3), fork4) adjacent(fork4, philosopher(4), fork0)
  • 30. Actions are defined by a domain specific event theory D, specifying preconditions and the fluents that are initiated and terminated. think(philosopher(I)) initiates thinking(philosopher(I)). eat(philosopher(I)) initiates eating(philosopher(I)) terminates thinking(philosopher(I)). pickup-forks(philosopher(I)) terminates available(F1) and available(F2) preconditions available(F1), available(F2) where adjacent(F1, philosopher(I), F2). putdown-forks(philosopher(I)) terminates eating(philosopher(I)) initiates available(F1), available(F2) where adjacent(F1, philosopher(I), F2) .
  • 31. The Dining Philosophers – with time-free syntax and auxiliary logic program time-to-eat(philosopher(I)) dine(philosopher(I)) dine(philosopher(I)) think(philosopher(I)), pickup-forks(philosopher(I)), eat(philosopher(I)), putdown-forks(philosopher(I)).
  • 32. Outline • KELPS - a simplified KErnel for reactive Logic-based Production-style Systems • KELPS model-theoretic semantics • KELPS operational semantics • LPS = KELPS + LP • MALPS = Multi Agent LPS (The Dining Philosophers) • Related work (MetateM, Transaction Logic) • Conclusions
  • 33. Comparison with MetateM (Michael Fisher et al) Programs = reactive rules in modal temporal logic: ‘past and present formula’ implies ‘present or future formula’ Computation = generate model of the reactive rules. Model = possible worlds connected by an accessibility relation. States updated by frame axioms. Interaction by message passing.
  • 34. Comparison with Transaction Logic (Bonner and Kifer) Programs = complex actions (and transactions) = sequences of FOL queries and actions. Computation = generate model of complex actions. Model = possible worlds. Truth values relative to paths in a collection of possible worlds. Reactive rule is true if, for every path over which the antecedents are true, there exists a later path over which the consequents are true. States updated destructively. Interaction via a global state.
  • 35. LPS: alternative external notations Transaction Logic: P Q means P(T1) Q(T2) T1 < T2 or P(T1 , T2) Q(T3, T4) T2 < T3 Modal temporal logic: P ◊Q means P(T1) Q(T2) T1 < T2. P Q means P(T) Q(T+1) or P(T1) Q(T2) T1 <T2 T1+ ε Graphical notation: P R Q means P(T1) Q(T2) R(T3) T1 < T3 T2 < T3 9/6/2012 35
  • 36. Conclusions • KELPS simplifies LPS, by eliminating logic programming. It extends LPS, by including a form of composite events. • The operational semantics is based on destructive updates. • The model-theoretic semantics of KELPS is inspired by the minimal model semantics of logic programming. • The model-theory and operational semantics can be extended to deal with other “integrity constraints”. • KELPS gives a declarative semantics to imperative computing. • KELPS puts logic programming in its place.