1. Trang chủ
  2. » Cao đẳng - Đại học

Slide trí tuệ nhân tạo propositional logic

39 7 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Propositional Logic
Tác giả Nguyễn Hải Minh
Trường học fit hcmus
Thể loại thesis
Năm xuất bản 2018
Định dạng
Số trang 39
Dung lượng 883,73 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Introduction to Artificial IntelligenceChapter 3: Knowledge Representation and Reasoning 2 Propositional Logic cont Nguyễn Hải Minh, Ph.D nhminh@fit.hcmus.edu.vn 07/09/2018 Nguyễn Hải Mi

Trang 1

Introduction to Artificial Intelligence

Chapter 3: Knowledge Representation and Reasoning

(2) Propositional Logic (cont)

Nguyễn Hải Minh, Ph.D nhminh@fit.hcmus.edu.vn

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 1

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 3

Horn Clauses

❑KB:

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 3

Conjunction Normal Form (CNF)

Clause 1 Clause 2 Clause n

Disjuctions of literals (𝑙 1 ∨ 𝑙 2 ∨ ⋯ ∨ 𝑙 𝑚 )

Trang 4

Horn Clauses

❑Modus Ponens for Horn Form:

❑More general version of the rule:

❑Why do we need Horn Clauses?

o Horn clauses are closed under resolution

o In the implication form, the sentence is easier to

understand

o Can be used with forward chaining or backward

chaining

o These algorithms are very natural and run in linear time.

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 4

Trang 5

A grammar for CNF, Horn Clauses

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 5

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 6

Forward chaining

❑Idea:

o fire any rule whose premises are satisfied in the KB,

o add its conclusion to the KB, until query is found

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 6

Trang 7

Forward chaining algorithm

❑Forward chaining is sound and complete for Horn KB

07/10/2018 Nguyễn Hải Minh @ FIT - HCMUS 7

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 8

Forward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 8

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 9

Forward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 9

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 10

Forward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 10

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 11

Forward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 11

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 12

Forward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 12

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 13

Forward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 13

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 14

Forward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 14

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 15

Forward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 15

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 16

Backward chaining

❑Idea: work backwards from the query q :

o to prove q by BC,

• check if q is known already, or

• prove by BC all premises of some rule

concluding q

❑Avoid loops: check if new subgoal is already on the goal stack

❑Avoid repeated work: check if new subgoal

o has already been proved true, or

o has already failed

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 16

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 17

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 17

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 18

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 18

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 19

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 19

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 20

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 20

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 21

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 21

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 22

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 22

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 23

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 23

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 24

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 24

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 25

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 25

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 26

Backward chaining example

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 26

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 27

Forward vs backward chaining

❑Forward chaining:

o FC is data-driven , automatic, unconscious processing,

• e.g., object recognition, routine decisions

o May do lots of work that is irrelevant to the goal

❑Backward chaining:

o BC is goal-driven , appropriate for problem-solving,

• e.g., Where are my keys? How do I get into a PhD

Trang 28

Efficient propositional inference

❑The SAT problem (checking satisfiability)

o Testing if KB |= α

o This can be done by testing Un satisfiability of KB ∧ ¬α

❑Two families of efficient algorithms for

propositional inference:

1 Complete backtracking search algorithms

o DPLL algorithm ( Davis, Putnam, Logemann, Loveland )

2 Incomplete local search algorithms (hill-climbing)

o WalkSAT algorithm

07/11/2018 Nguyễn Hải Minh @ FIT - HCMUS 28

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 29

The DPLL algorithm

❑Often called the Davis-Putnam algorithm

(1960)

❑Determine if an input propositional logic

sentence (in CNF) is satisfiable

o A recursive, depth-first enumeration of possible models.

❑Improvements over truth table enumeration:

1 Early termination

2 Pure symbol heuristic

3 Unit clause heuristic

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 29

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 30

The DPLL algorithm

1 Early termination

o A clause is true if any literal is true.

o A sentence is false if any clause is false.

Trang 31

The DPLL algorithm

2 Pure symbol heuristic

o Pure symbol : always appears with the same

"sign" in all clauses

o e.g., In the three clauses (A   B), (  B   C), (C  A), A and B are pure, C is impure

Make a pure symbol literal true

→Doing so can never make a clause false

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 31

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 32

The DPLL algorithm

3 Unit clause heuristic

o Unit clause: only one literal in the clause

o The only literal in a unit clause must be true

❑Example:

o If the model contains B = true then (  B   C)

simplifies to  C, which is a unit clause

o C must be false (so that  C = true)

o Then A must be true (so that C  A is true)

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 32

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 33

The DPLL algorithm

07/11/2018 Nguyễn Hải Minh @ FIT - HCMUS 33

1 Early Termination 2

3

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 34

The WalkSAT algorithm

❑Incomplete, local search algorithm

❑Evaluation function: The min-conflict

heuristic of minimizing the number of

Trang 35

The WalkSAT algorithm

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 35

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 36

The WalkSAT algorithm

❑When WalkSAT returns a model

o The input sentence is Satisfiable

❑When it returns false:

o The sentence is unsatisfiable OR

o We need to give it more time

exist

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 36

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 37

Inference-based agents in the

Wumpus world

A wumpus-world agent using propositional logic:

 P 1,1

 W 1,1

B x,y  (P x,y+1  P x,y-1  P x+1,y  P x-1,y )

S x,y  (W x,y+1  W x,y-1  W x+1,y  W x-1,y )

W 1,1  W 1,2  …  W 4,4

 W 1,1   W 1,2

 W 1,1   W 1,3

 64 distinct proposition symbols, 155 sentences

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 37

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 38

❑KB contains "physics" sentences for every single square

❑For every time t and every location [x,y],

L x,y  FacingRight t  Forward t  L x+1,y

❑Rapid proliferation of clauses

Expressiveness limitation of

propositional logic

t t

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 38

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Trang 39

❑Logical agents apply inference to a knowledge base to derive new information and make decisions

❑Basic concepts of logic:

o syntax : formal structure of sentences

o semantics : truth of sentences wrt models

o entailment : necessary truth of one sentence given another

o inference : deriving sentences from other sentences

o soundness : derivations produce only entailed sentences

o completeness: derivations can produce all entailed sentences

❑Wumpus world requires the ability to represent partial and negated information, reason by cases, etc.

❑Resolution is complete for propositional logic

Forward, backward chaining are linear-time, complete for Horn clauses

❑Propositional logic lacks expressive power

07/09/2018 Nguyễn Hải Minh @ FIT - HCMUS 39

CuuDuongThanCong.com https://fb.com/tailieudientucntt

Ngày đăng: 14/12/2021, 22:00