Prolog中的函子,事实,谓词和规则之间有什么区别? [英] What's the difference between functor, a fact, a predicate and a rule in Prolog?

查看:73
本文介绍了Prolog中的函子,事实,谓词和规则之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道这些术语之间的区别:

I would like to know the difference between those terms :

  1. 事实
  2. 函子
  3. 谓词.
  4. 规则

在序言中.

如果我写:brother(john, jack).
这是事实吗?还是谓词?

if I write: brother(john, jack).
is that a fact? or a predicate?

推荐答案

来自

ISO/IEC 13211-1 第一版 1995-06-01
信息技术 - 编程语言 - Prolog -
第 1 部分:
通用核心

ISO/IEC 13211-1 First edition 1995-06-01
Information technology - Programming languages - Prolog -
Part 1:
General Core

3.9 arity:复合词的参数个数.在语法上,一个与函子或谓词相关联的非负整数.

3.9 arity: The number of arguments of a compound term. Syntactically, a non-negative integer associated with a functor or predicate.

3.19 body:一个目标,以其作为一部分的上下文来区分规则(见 3.154).

3.19 body: A goal, distinguished by its context as part of a rule (see 3.154).

3.32 子句:事实或规则.它有两部分:一个头,和一个身体.

3.32 clause: A fact or a rule. It has two parts: a head, and a body.

3.37 复合项:一个元数为 N、N 为正的函子,连同 N 个参数的序列.

3.37 compound term: A functor of arity N, N positive, together with a sequence of N arguments.

3.72 事实:主体为目标为真的子句.
注意 - 事实可以在 Prolog 文本中用术语表示其主函子既不是 (:-)/1 也不是 (:-)/2.

3.72 fact: A clause whose body is the goal true.
NOTE - A fact can be represented in Prolog text by a term whose principal functor is neither (:-)/1 nor (:-)/2.

3.77 函子:一个标识符和一个元数.

3.77 functor: An identifier together with an arity.

3.81 目标:要执行的预测(参见正文、查询和 7.7.3).

3.81 goal: A predication which is to be executed (see body, query, and 7.7.3).

3.84 head(规则的):谓词,由上下文区分.

3.84 head (of a rule): A predication, distinguished by its context.

3.88 标识符:用于表示原子、函子名称或谓词名称的基本非结构化对象.

3.88 identifier: A basic unstructured object used to denote an atom, functor name or predicate name.

3.129 谓词:一个标识符和一个元数.

3.129 predicate: An identifier together with an arity.

3.133 predication:具有元数 N 和 a 的谓词N 个参数的序列.

3.133 predication: A predicate with arity N and a sequence of N arguments.

3.143 query:作为交互式输入给出的目标顶级.

3.143 query: A goal given as interactive input to the top level.

3.154 规则:主体不符合目标的子​​句.在执行期间,如果 body 对某些替换为真,那么该替换的头部也是如此.一条规则在 Prolog 文本中由一个术语表示,其主体函子是 (:-)/2 ,其中第一个参数被转换到头部,第二个参数被转换为身体.

3.154 rule: A clause whose body is not the goal true. During execution, if the body is true for some substitution, then the head is also true for that substitution. A rule is represented in Prolog text by a term whose principal functor is (:-)/2 where the first argument is converted to the head, and the second argument is converted to the body.

所以brother(john, jack).是事实.

这篇关于Prolog中的函子,事实,谓词和规则之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆