UNIHIVE

Study Hub UNIPORT CSC 494

CSC 494 · Introduction to Artificial Intelligence

Logic and inference: propositional logic

Knowledge bases, syntax and semantics of propositional logic, entailment, inference rules and resolution.

Our notes

2 min read

Knowledge-based agents

A knowledge base (KB) is a set of sentences in a formal language. The agent TELLs the KB what it perceives and ASKs it what to do; an inference procedure derives new sentences.

Propositional logic

  • Atoms: P, Q, R (true or false).
  • Connectives: ¬ (not), ∧ (and), ∨ (or), ⇒ (implies), ⇔ (if and only if).
  • A model assigns true or false to every atom.
  • Valid: true in all models (P ∨ ¬P). Satisfiable: true in some model. Unsatisfiable: true in none.

Entailment

KB ⊨ α (KB entails α) if α is true in every model in which the KB is true.
Model checking: list all models (truth table) and check. With n atoms there are 2ⁿ models.

Inference rules

  • Modus ponens: from α ⇒ β and α, infer β.
  • And-elimination: from α ∧ β, infer α.
  • Resolution: from (α ∨ β) and (¬β ∨ γ), infer (α ∨ γ).

An inference procedure is sound if it derives only entailed sentences, complete if it can derive every entailed sentence.

Conjunctive normal form (CNF)

A conjunction of clauses (each a disjunction of literals). Convert by: eliminate ⇔ and ⇒ (α ⇒ β becomes ¬α ∨ β), move ¬ inwards (De Morgan), distribute ∨ over ∧.

Resolution refutation

To prove KB ⊨ α: add ¬α to the KB in CNF and resolve until the empty clause (a contradiction) appears.

Worked example

KB: P ⇒ Q, Q ⇒ R, P. Prove R.

  • Clauses: (¬P ∨ Q), (¬Q ∨ R), (P), and the negated goal (¬R).
  1. Resolve (¬R) with (¬Q ∨ R) → (¬Q).
  2. Resolve (¬Q) with (¬P ∨ Q) → (¬P).
  3. Resolve (¬P) with (P) → empty clause.

Contradiction, so R is proved. (A truth table agrees: in every model where the KB is true, P, Q and R are all true.)

Horn clauses and chaining

A Horn clause has at most one positive literal (rules like P ∧ Q ⇒ R). For Horn KBs, forward chaining (data-driven: fire rules whose premises are known) and backward chaining (goal-driven: work back from the query) are efficient (linear time). Prolog uses backward chaining.

Exams usually ask

  • Define entailment, validity and satisfiability.
  • Convert sentences to CNF and prove a query by resolution.
  • Compare forward and backward chaining.

Common mistake

Forgetting to negate the goal before resolution. Resolution refutation proves α by showing KB ∧ ¬α is impossible.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

Practise

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 494 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.