人智导(十八):知识表示与自动推理(Ⅰ)
基于一阶谓词逻辑的知识表示
一阶谓词逻辑(FOL)
- 亦称为一阶谓词演算 first-order predicate calculus
- 更强的表达能力
- 对象(object):不同的对象通过其特征属性的不同而区分
- 关系(relation):对象与对象间的关联
- 函数:一种特例类型关系
一阶谓词逻辑的特点
- 对于数学及人工智能学科极为重要的影响
- 对于客观世界的概念化
- 客观对象和对象之间关系
- 表达的“随意性”
例如,king:可表示为人物(object);也可表示为人物与国家的关系(relation);也可表示为国家对应于人物的函数(function) - 研究知识表示与推理的首选语言
一阶谓词逻辑之语法
- 项(terms):相应于表示对象(objects)
- 常量:King, John, 野獸先軰……
- 变量:x, y, ……
- 函数:FatherOf, LeftLegOf, NM$L, 雷普……
- 以上三点构成项(terms)
- 谓词(predicates):相应于表示关系(relations)
例如,
Brother(John, Richard)
雷普(先軰, 远野)
贴贴(Kagura Mea, Aqua)
构成原子句子(atomic sentences)(简单句) - 复合句(complex sentences):使用连接符组合简单句
- 量词
- 全程量词( ∀ \forall ∀): ∀ < v a r i a b l e s > < s e n t e n c e > \forall <variables> <sentence> ∀<variables><sentence> e . g . : ∀ x F a n O f ( x , X i a o Z h a n ) → S t u p i d ( x ) e.g.:\forall x~FanOf(x, XiaoZhan)\to Stupid(x) e.g.:∀x FanOf(x,XiaoZhan)→Stupid(x)
- ∀ x P \forall x~P ∀x P等价于表示P的所有例化后的句子合取(conjunction)
- 典型地, → \to →是对应于全称量词 ∀ \forall ∀的连接符
- 存在量词( ∃ \exists ∃): ∃ < v a t i a b l e s > < s e n t e n c e > \exists <vatiables><sentence> ∃<vatiables><sentence> e . g . : ¬ ( ∃ x F u n O f ( x , X i a o Z h a n ) ) ∧ S m a r t ( x ) e.g.:\neg(\exists x~FunOf(x, XiaoZhan))\wedge Smart(x) e.g.:¬(∃x FunOf(x,XiaoZhan))∧Smart(x)
- ∃ x P \exists x~P ∃x P等价于表示P的所有例化后的句子析取(disjunction)
- 典型地, ∧ \wedge ∧是对应于存在量词 ∃ \exists ∃的连接符
- 全程量词( ∀ \forall ∀): ∀ < v a r i a b l e s > < s e n t e n c e > \forall <variables> <sentence> ∀<variables><sentence> e . g . : ∀ x F a n O f ( x , X i a o Z h a n ) → S t u p i d ( x ) e.g.:\forall x~FanOf(x, XiaoZhan)\to Stupid(x) e.g.:∀x FanOf(x,XiaoZhan)→Stupid(x)
一阶谓词逻辑之语义
- 对应于一个具体的解释,句子被确定其真/假值
- 解释 针对于如下信息
- 常量符号 → \to →objects
- 谓词符号 → \to →relations
- 函数符号 → \to →function relations
- 一个原子句 p r e d i c a t e ( t e r m 1 , … , t e r m n ) predicate(term_1, \dots , term_n) predicate(term1,…,termn)为真,当且仅当 t e r m 1 , … , t e r m n term_1, \dots ,term_n term1,…,termn具有谓词所描述的关联
一阶谓词逻辑之推理规则
- 一阶谓词逻辑继承了命题逻辑的全部推理规则
- Modus Ponens(假言)
- And-Elimination(与消除)
- And-Introduction(与引入)
- Double-Negation Elimination(非消除)
- Or-Introduction(或引入)
- Resolution(归结)
- 此外,有三条有关量词的推理规则:
- 置换(substitution):变量赋予特定值,即实例化
- S U B S T ( θ , α ) SUBST(\theta ,\alpha) SUBST(θ,α):置换表 θ \theta θ应用到句子 α \alpha α S U B S T ( { x / X i a o Z h a n , y / S h i t } , L i k e s ( x , y ) ) = L i k e s ( X i a o Z h a n , S h i t ) SUBST(\{x/XiaoZhan, y/Shit\}, Likes(x, y)) = Likes(XiaoZhan, Shit) SUBST({ x/XiaoZhan,y/Shit},Likes(x,y))=Likes(XiaoZhan,Shit)
涉及量词的推理规则
- 全称量词的消除: ∀ v α S U B S T ( { v / g } , α ) \frac{\forall v~\alpha}{SUBST(\{v/g\}, \alpha)} SUBST({ v/g},α)∀v α g g g:常量或函数标号 e . g . : ∀ x l i k e s ( x , S t e a k ) : s u b s t i t u t i o n { x / B e n } → l i k e s ( B e n , S t e a k ) e.g.:\forall x~likes(x, Steak):substitution\{x/Ben\}\to likes(Ben, Steak) e.g.: