IAI +010
· 약 11분
Knowledge representation
- Intelligent agents need knowledge about the world in order to reach good decisions.
- Declarative knowledge is represented in a form of sentences in a knowledge representation language and stored in a knowledge base.
- Knowledge base is used by an inference engine to infer a new sentence which will be used for the agent to decide what action to take next.
- Formal languages are defined by its grammar and semantic rules
- grammar: defines the syntax of legal sentences
- semantic rules: defines the meaning.
- Common knowledge representation formalisms:
- Propositional logic
- First-order logic
- Fuzzy logic
- Semantic networks
- Ontologies
Propositional logic
- a declarative language in which can handle propositions that are known true, known false, or completely (unknown true or false)
- a BNK (Backus-Naur Form) grammer of sentences in propositional logic.
- = NOT
- = AND
- = OR
- = IMPLIES
- = IF AND ONLY IF
- Negation: a sentence using is called negation
- Literal: either an atomic sentence or a negated atomic sentence
- Conjunction: two sentences connected by . Eac hof them is called conjunct
- Disjunction: two sentences connected by . Each of them is called disjunct
- Implication: two sentences connected by . . P is called premise or antecedent and Q is the conclusion or consequent.
- An implication is
if-thenstatement.
- An implication is
Truth tables
| P | Q | P | P Q | P Q | P Q | P Q |
|---|---|---|---|---|---|---|
| T | T | F | T | T | T | T |
| T | F | F | F | T | F | F |
| F | T | T | F | T | T | F |
| F | F | T | F | F | T | T |
FOL, First-order logic
- a declarative language
- Syntax of FOL builds on that of propositional logic
- terms to represent objects, universal quantifier, and existential quantifier
- a model in FOL must provide the information required to determine the truth value of every atomic sentence in the language.
- means for all x, P(x) is true
- means there exists an x such that P(x) is true
Logical equivalence
| logical equivalence | meaning |
|---|---|
| Commutativity of | |
| Commutativity of | |
| Associativity of | |
| Associativity of | |
| Double negation elimination | |
| Implication elimination | |
| Contraposition | |
| ( | Biconditional elimination |
| De Morgan's law for | |
| De Morgan's law for | |
| Distributivity of over | |
| Distributivity of over |
- For all x, not P(x) is logically equivalent to "it is not the case that there exists an x such that P(x) is true."
Reasoning
Deductive reasoning
- a process of reasoning from one or more statements (premises) to reach a logical conclusion.
- first premise, second premise, therefore conclusion.
Inductive reasoning
- the process of resoning from specific observations to borader generalizations and theories.
- also described as a method where one's experiences and observations are synthesized to cmoe up with a general truth.
- premises and then conclusion
Inference
- steps in reasoning
- moves from premises to logical consequences
- In AI Context, inference is to derive new logical sentences (as the conclusion) from existing logical sentences (as premises).
- researchers develop automated inference systems to emulate human inference.
Inference Problem
- KB, Knowledge Base, is a set of propositions that represent what is known about the world.
- , Query sentence, is the target conclusion which needs to be confirmed based on the given KB.
- where denotes the relation of logical entailment between KB and the sentence , reading as "KB entails " or "if KB is true, then must also be true".
-
- is the set of all models that satisfy .
- is the set of all models that satisfy .
- The statement means that in every model where is true, is also true. In other words, if holds, then must also hold.
- Model Checking: enumerates all possible models and checks if the entailment holds in each model.
- Knowledge base will be used to draw inferences.
- Query sentence, , is needed to be checked whether it is entailed by the KB.
- Symbols, a list of all symbols (or atomic propositions) used in the problem context.
- Models, assignments of truth and false values to those identified symbols.
- Model Checking Procedure
- Identify the propositional symbols involved in the KB sentences and query sentence
- Enumerate all possible models by assigning truth values to the identified symbols.
- Evaluate the KB sentence in each model and fined the models in which KB is true.
- Evaluate the query sentence in the models from step 3 and check if query sentence is true in these models.
- Conclude that the KB entails the query sentence if and only if the query sentence is true in all models where the KB is true.
Inference Problem Example
- Obersvation P: "It is raining"
- Query sentence Q: "The ground is wet"
- Knowledge: (If it is raining, then the ground is wet)
- Knowledge Base KB:
- Inference Problem: from KB=T, get Q=T
- Proof:
- From the 4 possible models, only Model 1 makes KB true.
- M(KB) = model 1
- Model 1 also makes Q true.
- M(Q) = model 1
- , therefore
| Model | P | Q | P Q | P (P Q) |
|---|---|---|---|---|
| 1 | T | T | T | T |
| 2 | T | F | F | F |
| 3 | F | T | T | F |
| 4 | F | F | T | F |
Inference by theorem proving
to apply rules of inference directly to the sentences in the KB to construct a proof of the desired sentence without consulting models.
- Proof: a chain of consequences that leads to the desired goal.
- KB will be used to draw inferences.
- Desired sentence is needed to be checked whether it is entailed by the KB.
- The rules of inference are the approved logical equivalences and rules.
| Aspect | Model Checking | Theorem Proving |
|---|---|---|
| 방식 | 참/거짓으로 실제 계산 | 논리 규칙을 사용해 증명 |
| 예시 | 진리표 | Modus Ponens, Resolution |
| 장점 | 단순함 | 복잡한 문장도 처리 가능 |
| 단점 | 계산 많음 | 규칙 익혀야 함 |
Modus Ponens Rule
- whenever any sentences of the form and are given, then the sentence can be inferred.
Add-Elimination Rule
- from a conjunction, one of the conjuncts can be inferred.
Terms to contradiction and resolution
CNF
┌────────────────────────────────────────────────┐
│ (P ∨ Q) ∧ (¬Q ∨ R) │
│ ┌──────────────────────┐ ┌───────────────┐ │
│ │ Clause 1 │ │ Clause 2 │ │
│ │ (P ∨ Q) │ │ (¬Q ∨ R) │ │
│ │ ┌───────┬───────┐ │ │ ┌──────┬─────┐ │
│ │ │ P │ Q │ │ │ │ ¬Q │ R │ │
│ │ └───────┴───────┘ │ │ └──────┴─────┘ │
│ └──────────────────────┘ └───────────────┘ │
└────────────────────────────────────────────────┘
- Literal: an atomic sentence or its negation
- Complementary literals: a literal and its negation are complementary literals
- Clause: an expression formed from a collection of finite literals
- In most cases, a clause is a disjunction of finite literals.
- written as the symbol .
- Conjunctive Normal Form: a sentence expressed as a conjunction of clauses.
- Satisfiability: a sentence is satisfiable if it is true in, or satisfied by, some models.
Propositional satisfiability (SAT) problem
- to determine the satisfiability of sentences in propositional logic.
- if there exists a model that satisfies a given logical sentence, then the sentence is satisfiable.
- Satisfiability can be checked by enumerating the possible models until one is found that satisfies the sentence, or by resolving complementary literals until an empty clause is derived.
- many problems in CS are really SAT problems.
Resolution rule
Unit resolution rule
- where is a literal and and are complementary literals.
- Unit resolution rule takes a clause which is a disjunction of literals, and a literal and produces a new clause as the resolvent.
Full resolution rule
- where is a literal and and are complementary literals.
- Full resolution rule takes two clauses which are disjuctions of literals and produces a new clause containing all the literals of the two original clauses except for the two complementary literals.
Inference via proof by contradiction through resolution
- to prove that , we can show that the sentence is unsatisfiable.
- by deriving an empty clause from using the resolution rule.
- In order to derive an empty clause, we use resolution which is a process to resolve complementary literals until to find an empty clause.
- R1: P (observation)
- R2: P Q (knowledge, raining implies ground is wet)
- Query sentence: Q
- Inference problem: , i.e. from , get
- Proof:
- Let valid
- Convert to CNF
- Apply implication elimination rule, one has
- Apply unit resolution rule to and , resolve and , one has
- Apply unit resolution rule to and , resolve and , one has
Inference in FOL
- convert the first-order inference to propositional inference using the ruls for quantifiers.
- universal instantiation (UI)
- existential instantiation (EI)
- do inference in propositional logic using the methods about inference in propositional logic.
- this approach to first-order logic inference via propositionalization is complete, means any entailed sentences can be proved.
- in most cases, this approach works
- in some cases, it is slow and only useful when the domain is small.
- get rid of quantifiers by instantiating them with specific constants or variables.
Universal instantiation (UI)
- to convert sentences with universal quantifiers to sentences without universal quantifiers.
- it can infer any sentence obtained by substituting a ground term for the universally quantified variable.
- denotes the result of applying the subsitution to the sentence and is a ground term or a constant symbol.
- universal instantiation can be applied many times to produce may different consequences.
-
- ...
Existential instantiation (EI)
- to convert sentences with existential quantifiers to sentences without existential quantifiers.
- the quantified variable can be replaced by a single new constant symbol.
- for any sentence , variable , and constant symbol not appear elsewhere in the knowldge base, the following rule is sound:
- denotes the result of applying the subsitiution in the sentence and is ground term or a new constant symbol.
- Existential instantiation can be applied only once, and then the existentially quantified sentence can be discarded.
-
- where is a new constant symbol not appear elsewhere in the knowledge base
CNF, Conjunctive Normal Form
| Step | Rule Name | Description | Example |
|---|---|---|---|
| 1 | 제거 | , 없애기 | → |
| 2 | De Morgan's | 분배 | |
| 3 | Double negation | 이중부정 제거 | |
| 4 | Distribution | over 분배 | → |
| 5 | And-Elimination | 분리 | 따로 |