Questions tagged «logic-programming»


4
Prolog可以解决约束满足问题吗?
是“晚会上”之类的问题可解的Prolog的?例如: Burdock Muldoon和Carlotta Pinkstone都说如果Albus Dumbledore来,他们会来的。阿不思·邓布利多(Albus Dumbledore)和黛西·多德里奇(Daisy Dodderidge)都表示,如果卡洛塔·平石(Carlotta Pinkstone)来,他们会来的。阿不思·邓布利多(Albus Dumbledore),牛d(Burdock Muldoon)和卡洛塔·平斯通(Carlotta Pinkstone)都说,如果埃尔弗里达·克拉格(Elfrida Clagg)来,他们会来的。卡洛塔·平斯通斯通(Carlotta Pinkstone)和黛西·多德里奇(Daisy Dodderidge)都说,如果法尔科·埃萨隆(Falco Aesalon)来,他们会来的。Burdock Muldoon,Elfrida Clagg和Falco Aesalon都说,如果Carlotta Pinkstone和Daisy Dodderidge都来,他们会来的。黛西·多德里奇(Daisy Dodderidge)表示,如果阿不思·邓布利多(Albus Dumbledore)和Burdock Muldoon都来,她会来的。需要说服谁参加聚会,以确保所有受邀者都参加? 我试图在GNU Prolog中表达这一点: attend(BM) :- attend(AD). attend(CP) :- attend(AD). attend(AD) :- attend(CP). attend(DD) :- attend(CP). attend(AD) :- attend(EC). attend(BM) :- attend(EC). attend(CP) :- attend(EC). attend(CP) :- attend(FA). attend(DD) …

2
是什么使PROLOG Turing完整?
我知道可以通过构建一个模拟图灵机的程序来证明PROLOG是图灵完备的: turing(Tape0, Tape) :- perform(q0, [], Ls, Tape0, Rs), reverse(Ls, Ls1), append(Ls1, Rs, Tape). perform(qf, Ls, Ls, Rs, Rs) :- !. perform(Q0, Ls0, Ls, Rs0, Rs) :- symbol(Rs0, Sym, RsRest), once(rule(Q0, Sym, Q1, NewSym, Action)), action(Action, Ls0, Ls1, [NewSym|RsRest], Rs1), perform(Q1, Ls1, Ls, Rs1, Rs). symbol([], b, []). symbol([Sym|Rs], Sym, …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.