简体   繁体   中英

Prolog programming language and proof trees

Recall this proof meta-circular

solve(true, true).
solve([], []). 
solve([A|B],[ProofA|ProofB]) :-
   solve(A,ProofA),
   solve(B, ProofB).
solve(A, node(A,Proof)) :-
   rule(A,B),
   solve(B,Proof).

Assume that the third rule of the interpreter is altered, while the other rules of the interpreter are unchanged, as follows:

% Signature: solve(Exp, Proof)/2 solve(true, true). 
solve([], []).                                      
solve([A|B], [ProofA|ProofB]) :-
   solve(B, ProofB),   %3
   solve(A, ProofA). 
solve(A, node(A, Proof)) :-
   rule(A, B),
   solve(B, Proof). 

Consider the proof tree that will be created for some query in both versions. Can any variable substitution be achieved in one version only? Explain. Can any true leaf move to the other side of the most left infinite branch? Explain. In both questions give an example if the answer is positive. How will this influence on the proof?

please help me ! tx

(I have a lot of reservations against your meta-interpreter. But first I will answer the question you had)

In this meta-interpreter you are reifying (~ implementing) conjunction. And you implement it with Prolog's conjunction. Now you have two different versions how you interpret a conjunction. Once you say prove A first, then B. Then you say the opposite.

Think of

p :- p, false.

and

p :- false, p.

The second version will produce a finite failure branch, whereas the first will produce an infinite failure branch. So that will be the effect of using one or the other meta-interpreter. Note that this "error" might again be mitigated by interpreting the meta-interpreter itself!

See also this answer which might clarify the notions a bit.

There are also other ways to implement conjunction (via binarization) ; such that the next level of meta-interpreter will no longer able to compensate.


Finally a comment on the style of your meta-interpreter: You are mixing lists and other terms. In fact [true|true] will be true. Avoid such a representation by all means. Either stick with the traditional "vanilla" representation which operates on the syntax tree of Prolog rules. That is, conjunction is represented as (',')/2 . Or stick to lists. But do not mix lists and other representations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM