- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
获得正确的术语是成功传达概念的一部分,当在 SO 中使用错误的术语时,带有 Prolog 标签的受访者会很好地指出错误。
在阅读 William F. Clocksin 于 1997 年 ( WorldCat ) 的“条款和效果 - 工作程序员的序言编程”中是一段
A Prolog program consists of a collection of procedures. Each procedure defines a particular predicate, being a certain relationship between its arguments. A procedure consists of one or more assertions, or clauses. It is convenient to think of two kinds of clauses: facts and rules.
最佳答案
来自 Prolog ISO 标准
ISO/IEC 13211-1 (First edition 1995-06-01)
Information technology - Programming languages - Prolog
Part 1: General Core
3.7 argument: A term which is associated with a predication or compound term.
3.9 arity: The number of arguments of a compound term. Syntactically, a non-negative integer associated with a functor orpredicate.
3.10 assert, to: To assert a clause is to add it to the user-defined procedure in the database defined by the predicate ofthat clause.
3.19 body: A goal, distinguished by its context as part of a rule (see 3.154).
3.21 built-in predicate: A procedure whose execution is implemented by the processor (see 8).
3.32 clause: A fact or a rule. It has two parts: a head, and a body.
3.35 complete database The set of procedures with respect to which execution is performed (see 7.5).
3.37 compound term: A functor of arity
N
,N
positive, together with a sequence ofN
arguments.3.45 control construct: A procedure whose definition is part of the Prolog processor (see 7.8).
3.52 database: The set of user-defined procedures which currently exist during execution (see 7.5).
3.57 directive: A term
D
which affects the meaning of Prolog text (see 7.4.2) and is denoted in that Prolog text by the directive-term:-(D)
.3.59 dynamic (of a procedure): A dynamic procedure is one whose clauses can be inspected or altered during execution, for example byasserting or retracting clauses (see 7.5.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 functor: An identifier together with an arity.
3.81 goal: A predication which is to be executed (see body, query, and 7.7.3).
3.84 head (of a rule): A predication, distinguished by its context.
3.88 identifier: A basic unstructured object used to denote an atom, functor name or predicate name.
3.129 predicate: An identifier together with an arity.
3.131 predicate indicator: A compound term
A/N
, whereA
is an atom andN
is a non-negative integer, denoting one particular procedure (see 7.1.6.6).3.133 predication: A predicate with arity
N
and a sequence ofN
arguments.3.136 procedure: A control construct, a built-in predicate, or a user-defined procedure. A procedure is either static or dynamic. Aprocedure is either private or public (see 7.5).
3.141 Prolog text: A sequence of read-terms denoting directives and clauses (see 6.2, 7.4).
3.143 query: A goal given as interactive input to the top level.
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 textby 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.3.164 static (of a procedure): A static procedure is one whose clauses cannot be altered (see 7.5.2).
3.185 top level: A process whereby a Prolog processor repeatedly inputs and executes * queries.
3.195 user-defined procedure: A procedure which is defined by a sequence of clauses where the head of each clause has the samepredicate indicator, and each clause is expressed by Prolog text orhas been asserted during execution (see 8.9).
h(A,B,C) :- g(A,B),h(B,C),j(A,C).
<-------------------------------> - A (HORN) CLAUSE, which is also a RULE.
<------------------> - BODY of the RULE, which also a GOAL.
... only one literal: ATOMIC GOAL.
<------> - HEAD of the RULE, which can appear
as GOAL depending on context.
f(A,B,C). - A CLAUSE with the elided body `true`.
This is a FACT, but _not_ a RULE.
Also called a UNIT CLAUSE.
f(A,B,C) :- true. - Same as above, still not a RULE.
f(A,B,C) :- !. - Is it a RULE? We don't know!
:- f(A,B,C). - A DIRECTIVE.
:- (foo(bar)). - Another DIRECTIVE.
在
Horn Clause 的条目中可以找到略有不同的定义。一个维基百科。特别是,“事实”被称为“没有变量的单元子句”——这与 ISO 定义不符。
A/N
(
functor/arity
),有符号
A//N
,它不在 ISO 标准中(或者还没有,请参阅
this draft )。它告诉读者这个谓词用在
Definite Clause Grammar (DCG) 中。除了指定的参数数量外,还为输入“差异列表”(或“列表差异”)对采用 2 个隐藏参数。
3.19 non-terminal indicator: A compound term
A//N
whereA
isan atom andN
is a non-negative integer, denoting one particularnon-terminal
nt//n
到谓词
nt/n+2
.但是,不能依赖精确的翻译方式和通过调用相应谓词直接调用非终结符的结果,即未定义具有相同名称和两个额外参数的谓词。特别是第二个附加参数必须小心处理。直接使用可能会违反坚定性,尤其是在使用
dcg-semicontext 时.
Queries and directives are ways of directing the system to executesome goal or goals. (...) The principal use for directives (as opposedto queries) is to allow files to contain directives that call variouspredicates, but for which you do not want to have the answers printedout. In such cases you only want to call the predicates for theireffect, i.e. you do not want terminal interaction in the middle ofconsulting the file.
module
指示:
This directive can only be used as the first term of a source file. Itdeclares the file to be a module file, defining a module named Module.
This section describes directives which manipulate attributes ofpredicate definitions.
:- use_module(library(clpfd)).
空头规则
:- foo
,可以解释为
false :- foo
在 Prolog 中不使用来表达约束“foo 永远不是这种情况”。在
Answer Set Programming 的实现中就是这样使用的像“ASP Prolog”(它具有 Prolog-y 语法,但与 Prolog 完全不同)。
"A built-in predicate is a procedure which is provided by astandard-conforming processor"
The word functor was borrowed by mathematicians from the philosopherRudolf Carnap, who used the term in a linguistic context; seefunction word.
In linguistics, function words (also called functors) are wordsthat have little lexical meaning or have ambiguous meaning and expressgrammatical relationships among other words within a sentence, orspecify the attitude or mood of the speaker.
p(X)
,在这种情况下,它是一个原子目标,或由子目标组成的树,例如
p(X),q(Y)
因为
,
是主仿函数
(',')/2
的谓词.
p(X) -> q(Y) ; r(Z)
, 主仿函数
;
(不是
->
)绝对是一个目标。
call/1
这样的元谓词。例如:
X=(Z is 1+2), call(X).
.
u v w
:
foo(X,Y,Z) :- format("~q ~q ~q\n", [X,Y,Z]).
maplist(foo, [u],[v],[w]). % call "foo" with 3 arguments
maplist(foo(u), [v],[w]). % call closure foo(u) with 2 arguments
maplist(foo(u,v) ,[w]). % call closure foo(u,v) with 1 argument
关于谓词与过程与谓词指示器的说明
fact
arity 2 计算阶乘函数:
fact/2
是谓词指示符,并且
fact(0,1) :- !.
fact(X,F) :- Xp is (X-1), fact(Xp,Fp), F is (Fp*X).
是可能的对应程序。
The collection of clauses for a given predicate is called a procedure.
?- X is 5 * 3.
X = 15.
关于prolog - 这个 Prolog 术语是否正确? (事实、规则、程序、谓词……),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49898738/
我正在尝试使用以下命令通过 ansible 收集服务器 list : ansible all -m setup -a --tree facts/ 但这会在facts文件夹下为每个主机生成很多操作系统单
我决定学习 prolog 只是为了好玩,我正在看一些视频教程。我也在互联网上搜索了一些问题试图解决,但找不到解决方法。 我能够在纸上解决这个难题,但无法将其传递到代码中。 问题: I have 8 c
我正在通过DRT(规则模板)读取Excel表,然后通过Java类中的静态方法将其转换为类的对象。并将其插入到工作内存中。这样,工作内存就会被 Excel 表格中的所有事实填满。 现在,我通过 sess
我确信这非常简单,但我显然没有用谷歌搜索正确的东西。在几个单元测试相关的博客中,我看到了几个方法被赋予的属性 [fact] ,但我似乎无法弄清楚这意味着什么。示例: public class Some
我想知道这些术语之间的区别: 事实 仿函数 谓词。 规则 在Prolog中。 如果我写:brother(john, jack).这是事实吗?或谓词? 最佳答案 从 ISO/IEC 13211-1 Fi
问题 为什么选择 Ansible 事实,例如 ansible_distribution在角色部分不可用? --- - name: Test hosts: all tasks: - na
puppet 事实看起来像这样: processors => {"models"=>["AMD Opteron(tm) Processor 6172", "AMD Opteron(tm) Proces
在做了一些研究之后,我对 Prolog 以非常简单的方式表达查询的能力感到惊讶,几乎就像口头告诉机器该做什么一样。发生这种情况是因为我对工作中的 Propel 和 PHP 感到非常厌烦。 所以,我一直
我想生成一个密码和其他一些不存在的值。 像这样的东西: - name: Retrieve or generate my_password generated_fact: shell: so
我需要从 SEC 10-K 文件中获取一些事实,例如毛收入、毛利润、毛利率、营业费用等以及相应的上下文。 对于像 https://www.sec.gov/Archives/edgar/data/131
我是 puppet 新手,并计划在我们的环境中实现它。 我有在不同版本的 Redhat 上运行的 puppet 代理。 现在,我计划从 puppet master 推送存储库文件,我需要您的指导来实现
我是 puppet 新手,并计划在我们的环境中实现它。 我有在不同版本的 Redhat 上运行的 puppet 代理。 现在,我计划从 puppet master 推送存储库文件,我需要您的指导来实现
是否可以使用通常包含在 ansible_facts 中的内容?在 Ansible 临时命令中? 例如,我有一个位于 /tmp/myFile 的文件。在我所有的服务器上,我想做: ansible all
获得正确的术语是成功传达概念的一部分,当在 SO 中使用错误的术语时,带有 Prolog 标签的受访者会很好地指出错误。 在阅读 William F. Clocksin 于 1997 年 ( Worl
上下文:我的系统包含来自不同存储 Controller 的磁盘组合,因此每种类型的磁盘都有不同的用途。我是 ansible 的新手,我一边学习一边学习。编写一个剧本,从每种类型的 Controller
我是数据仓库的新手,我希望有一个关于构建星型模式的简单问题: 如果我有一个事实表,其中事实记录自然与单个维度具有一对多关系,那么如何建模星型模式来支持这一点?例如: 事实表:销售点条目(衡量标准是美元
我正在用 Idris 编写一个基本的 monadic 解析器,以适应与 Haskell 的语法和差异。我有基本的工作,但我坚持尝试为解析器创建 VerifiedSemigroup 和 Verified
我的应用程序需要足够的准确性,但 Google Places 按类别过滤的准确性似乎很差。所以我正在考虑迁移到 Factual API。大家用过吗?您如何看待它的准确性? 另一方面,我需要知道到某个地
我是一名优秀的程序员,十分优秀!