gpt4 book ai didi

prolog - Prolog 中的谓词逻辑是如何表示的?

转载 作者:行者123 更新时间:2023-12-03 20:25:23 26 4
gpt4 key购买 nike

可能是一个奇怪而广泛的问题,而不是 100% 的编程问题,但我希望这没问题。我最近讨论过,Prolog 中的许多程序不遵循严格的谓词逻辑(Frege),但通常是“面向对象的”,我试图掌握这一点。
我知道 Prolog 基于一阶谓词逻辑,尤其是 Horn 子句,并且它们是一种特殊形式的 modus ponens。单独出现的事实和规则只是从句,但是一旦我添加了多个出现,它们就变成了谓词。
一般而言,一阶谓词逻辑的量词如何表示并与事实、规则、谓词或 Prolog 概念相关?仿函数表达什么以及与谓词逻辑相关的参数是什么。谓词逻辑和一阶谓词逻辑在Prolog中是如何体现的,prolog的概念在哪里?例如我将如何在谓词逻辑和一阶谓词逻辑中定义点、线和垂直线。
我如何在谓词逻辑和一阶谓词逻辑中表述它之间的语义和逻辑区别是什么

vertical(line).
line(vertical).
或者在这个例子中是一条线和一个点。点和线不是谓词逻辑吗?
对我来说,它是“点(X)所有点的集合”,当我选择一个具体点时“存在一个点(110、12)”。
point(X,Y).
line(point(W,X), point(Y,Z)).

vertical(line(point(X,Y), point(X,Z))).
horizontal(line(point(X,Y), point(Z,Y))).
任何信息都有帮助!非常感谢,H

最佳答案

一章Programming in Prolog由 W.Clocksin 和 C.Mellish 编写,致力于解释 Prolog 与逻辑的关系。从那里引用

If we wish to discuss how Prolog is related to logic, we must first establish what wemean by logic. Logic was originally devised as a way of representing the form ofarguments, so that it would be possible to check in a formal way whether or not theyare valid. Thus we can use logic to express propositions, the relations between propositions and how one can validly infer some propositions from others. The particularform of logic that we will be talking about here is called the Predicate Calculus. Wewill only be able to say a few words about it here. There are scores of good basicintroductions to logic you can turn to for background reading.

If we wish to express propositions about the world, we must be able to describethe objects that are involved in them. In Predicate Calculus, we represent objects byterms. A term is of one of the following forms:

  • A constant symbol. This is a symbol that stands for a single individual or concept.We can think of this as a Prolog atom, and we will use the Prolog syntax. Sogreek, agatha, and peace are constant symbols.
  • A variable symbol. This is a symbol that we may want to stand for differentindividuals at different times. Variables are really only introduced in conjunctionwith quantifiers, which are discussed below. We can think of them as Prologvariables and will use the Prolog syntax. Thus X, Man, and Greek are variablesymbols.
  • A compound term. A compound term consists of a function symbol, togetherwith an ordered set of terms as its arguments. The idea is that the compoundterm represents some individual that depends on the individuals represented bythe arguments. The function symbol represents how the first depends on the second. For instance, we could have a function symbol standing for the notion of"distance" and two arguments. In this case, the compound term stands for thedistance between the objects represented by the arguments. We can think of acompound term as a Prolog structure with the function symbol as the functor.We will write Predicate Calculus compound terms using the Prolog syntax, sothat, for instance, wife(henry) might mean Henry's wife, distance(point1, X)might mean the distance between some particular point and some other place tobe specified, and classes(mary, dayafter(W)) might mean the classes that Maryteaches on the day after some day W to be specified.

Thus in Predicate Calculus the ways of representing objects are just like the ways available in Prolog.


把整章放在这里似乎不太合适……还有一个程序,非常有说明性,在附录 B 中,它执行 WFF 的自动翻译。 s 成子句。
这本书可读性很强,可惜不在 Free Prolog Programming Books的书名之列。部分。

关于prolog - Prolog 中的谓词逻辑是如何表示的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62620171/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com