编程与软件工程vanemden.wordpress.com
谁杀死了 Prolog?
Who killed Prolog?
2010 — 2018,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是 van Emden 博客上一片追问「谁杀死了 Prolog」的文章,回顾这门逻辑编程语言从 AI 明星走向边缘化的过程,其中包括日本第五代计算机项目的失败给它带来的连带影响。评论区并不完全认同作者的单一归因:有人指出统计式 AI 的兴起、性能难以预测和范式本身的局限才是更自然的原因。
为什么经久不衰:它讨论的不只是一门语言的兴衰,而是范式、过度期望与资助风向如何共同决定技术的命运,这类问题每次重读都仍然切中当下。
HN 评论精选
Prolog 并未消亡,其逻辑变量与约束编程仍有价值,但更适合作为嵌入式规则引擎而非独立语言。
Prolog 没死,只是这些年不太受关注。我用 SWI-Prolog 做原型和探索式编程,装它并不费劲。但我不认为 Prolog 适合作为完全独立的语言:和 SQL 一样,它的模型强烈偏向某类问题,使 I/O 和副作用很别扭。最好是把它做成可嵌入的库(像 Lua 或 SQLite)用于规则和脚本。我认为 Prolog 最有趣之处是用逻辑变量做「部分信息计算」:变量恒有确定值,但不必立刻绑定,于是可以传带洞的结构做模式匹配模板,或用差分列表拼接链表,同时保持不可变的好处——不过 Mercury、Erlang 大多丢掉了逻辑变量,只有 Oz 保留。约束编程则是另一种部分信息计算,让 Prolog 聪明得多。
silentbicycle查看英文原文
Prolog isn't dead, it just doesn't seem to get a whole lot of attention these days. I use SWI-Prolog for prototyping and exploratory programming, and I didn't need a shovel and a lantern to install it. I don't think Prolog is practical as a fully standalone language, though. Like SQL, it has a model that strongly skews it towards certain kinds of problems, and which makes I/O and side effects awkward. I think it would be best to have a Prolog-like language as a library (like Lua or SQLite), to embed it for rules & scripting. (Writing one is on my project TODO list. I've been reading quite a bit about Prolog implementation.) To me, the single most interesting aspect of Prolog is computing with partial information via logic variables: variables that are constant, but don't necessarily have to be bound immediately. Conceptually, the variables always have some specific value, but you didn't know until they were bound. You can pass around structures with holes in them to use as templates in pattern matching, append lists by binding the "hole" at the end of a list to another's head ("difference lists"), etc., while still keeping the advantages of immutability. Most languages descended from Prolog (Mercury, Erlang) drop logic variables, though Oz keeps them. Another kind of computing with partial information is constraint programming, which makes Prolog much, much less dumb. Generate-and-test is great for prototyping, but quickly shows its limits with combinatorial problems - where constraint programming excels. Most major Prolog implementations come with constraint programming extensions, and they address many of its weak points. There's also Erlang. Erlang seems like a very modern, practical evolution of the declarative + concurrent direction that some logic programming research was going. If you remove backtracking (which makes handling concurrency far more difficult), then I/O also becomes feasible. Erlang keeps much of Prolog's declarative-ness, and adds several powerful features of its own.
Prolog 的衰落是自然死亡:统计式 AI 崛起、范式劝退普通程序员、性能不可预测。
我不太相信「Prolog 因与失败的日本项目挂钩而被杀死」这一论断。我认为它是自然死亡的:第一,Prolog 擅长演绎式专家系统,但 90 年代基于统计的 AI(先是模糊逻辑,后是贝叶斯方法)兴起,说明仅靠「真/假/失败」不够用了;第二,Prolog 会让人以非命令式的方式思考,这可能劝退普通程序员,又没有提供足以吸引高手的那种杀手级能力;第三,Prolog 难以优化、性能特征难以预测,在 80、90 年代用 C 写应用的背景下这是致命的。
Robin_Message查看英文原文
I'm not sure I'm convinced by the thesis Prolog was killed by association with a Japanese project that was a failure. I thought Prolog died a natural death, for several reasons: Firstly, Prolog is it was great at the deductive, expert system type of AI, but in 90's, a new generation of AI based on statistics (firstly, fuzzy logic, and then proper statistical reasoning, particularly Bayesian approaches) appeared and showed that truth and failure just don't cut it any more. Secondly, I don't know if anyone has done the research, but I wouldn't be surprised if Blub programmers are just better at thinking imperatively; Prolog tends to kind of warp the brain away from that, which would put off Blub programmers, but it doesn't provide the kind of killer power that makes expert programmers want to use it either. Thirdly, Prolog is hard to optimise well, and hard to predict the performance characteristics of. In the 80's and 90's, where apps were getting written in C, this was killer.
Prolog 被寄予了「只写规格就自动求解」的不切期望,期望落空后人们便弃用它。
人们想让 Prolog 做的事它做不到。人们想摆脱命令式的控制流和 OOP 的消息传递,只给编译器一份「完成后的系统应满足的约束」就让机器自己求解。Prolog 做不到,因为它不是强人工智能。当人们意识到这一点就放弃了它——因为告诉计算机如何分支,比费力地引导笨拙的启发式要容易得多。等哪天出现了大规模通用的「常识库」,即人类靠多年童年感官经验积累的那种东西,声明式编程才会回归。
derefr查看英文原文
What people wanted Prolog to do, it couldn't do. People wanted to step away from the control flow specification of imperative language, the message-passing of OOP, and let the compiler solve your problem for you by feeding it a specification of the constraints the completed system would follow. Prolog did not, and cannot do this, because it is not strong AGI. When people realized this, they gave up on it, because it is easier to tell the computer how it should branch than to forcefully guide stupid heuristics around. When there exists a large, universal library of "common sense", of the kind people build up from years of childhood sensory experience, declarative programming will come back. But not until then.
逻辑语言正以概率逻辑等形式与现代机器学习结合而回暖。
近来逻辑语言确实有升温之势,多半是作为深度学习/机器学习路线的延伸——比如概率逻辑。用 Prolog 搭建概率系统出乎意料地容易。
xvilka查看英文原文
There is some increasing interest in logic languages recently, mostly as an extension of DL/ML approach - probabilistic logic for example. Surprisingly easy probabilistic systems can be built with Prolog [1]. [1] https://www.metalevel.at/prolog/ai
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选