Lecture 6

Logical conditionals

Johannes Korbmacher Lecture slides

Logical methods for AI

Logical conditionals

Lecture 6

What you’ll be able to do

Read chapter 6 first; exercise sheet 6 comes after the lecture.

Conditionals

  • Rules, applied to facts, tell us what our knowledge entails.
  • An expert system: a KB of rules and facts, an inference engine.
  • Rain and a low sun: a rainbow.
expert_system_mascotExpert System

The material conditional

RAINWINDRAIN → WIND
111
100
011
001

Default-true

1
2
if day == "monday":
    number = 1

On Tuesday, the rule says nothing: assigning 1 or 2 both satisfy it.

The default truth-value is 1; only a counterexample changes it to 0.

With two truth-values, there is no third option.

Conditional rewriting

(A → B) ⟹ (¬A ∨ B)
Ex.

The interactive example is loading.

Modus ponens

By refutation:

RAIN ∧ (¬RAIN ∨ WIND) ∧ ¬WIND

resolves to WIND, then to ⊥.

con_ai_counterfactual

Not every if is material: “if you’d throw the ball at the window, then it would break.”

Knowledge bases

MORNING → DAY EVENING → DAY (CLEAR ∧ DAY) → SUN (MORNING ∧ SUN) → LOW_SUN (EVENING ∧ SUN) → LOW_SUN (RAIN ∧ LOW_SUN) → RAINBOW

TELL: MORNING, CLEAR, RAIN

ASK: RAINBOW?

Every part of the antecedent first, then the consequent.

Forward chaining

Forward chaining, step by step

Try “Rainbow”, then “Missing fact”: the same KB without CLEAR.

The example is loading.

Derivations found

Backward chaining

Rule used backwardRemaining queries
StartRAINBOW
(RAIN ∧ LOW_SUN) → RAINBOWLOW_SUN; RAIN is known
(MORNING ∧ SUN) → LOW_SUNSUN; MORNING is known
(CLEAR ∧ DAY) → SUNDAY; CLEAR is known
MORNING → DAYNone; MORNING is known

Backward chaining, step by step

Try the same query without CLEAR. Where does the search get stuck?

The example is loading.

Derivations found

Search order

Forward and backward describe the direction of reasoning; depth first and breadth first, the order of search.

Depth first

  • A
    • B
      • D
      • E
    • C
      • F
      • G

Breadth first

  • A
    • B
      • D
      • E
    • C
      • F
      • G

Horn clauses

Disjunctive formConditional formUse
¬CLEAR ∨ ¬DAY ∨ SUN(CLEAR ∧ DAY) → SUNDerive a fact
SUN⊤ → SUNInitial fact
¬SUN ∨ ¬RAIN(SUN ∧ RAIN) → ⊥Forbid a combination

Horn SAT

Chain from the facts. A constraint reached: ⊥, unsatisfiable. Otherwise the derived atoms are the least model (glossary, opens in a new tab) .

Truth-tables: 2ⁿ rows. Will our planning formulas be Horn?

Counters and an agenda

A counter of unmet premises for each rule; an agenda (glossary, opens in a new tab) of facts to process.

The example is loading.

Derivations found

Planning problem

con_ai_plan_setupInstructions:

Green on red ⟶ red on green. Two action steps.

Formalization and SATPLAN

States

¬On(X, X, t) On(X, Y, t) → ¬On(Y, X, t)

Initial and goal:

I = On(G, R, 0) ∧ ¬On(R, G, 0) G = On(R, G, 2)

Preconditions and effects

Stack(X, Y, t) → ¬On(X, Y, t) Stack(X, Y, t) → ¬On(Y, X, t) Unstack(X, Y, t) → On(X, Y, t) Stack(X, Y, t) → On(X, Y, t+1) Unstack(X, Y, t) → ¬On(X, Y, t+1)

Frame conditions and miracles

Frame notation

The example is loading.

Derivations found

Frame problem

How do we represent what stays unchanged?

¬On(X, Y, t) ∨ Unstack(X, Y, t) ∨ On(X, Y, t+1)

Two positive literals: this frame clause is non-Horn. The O(m+1) guarantee no longer applies.

Frame notation

The example is loading.

Derivations found