简体   繁体   中英

How does prolog resolution use proof by contradiction?

I'm learning prolog, and I'm confused by the claim that prolog uses proof by contradiction:

The resolution proof process makes use of a technique that is known as reduction to the absurd: suppose that the formula to be proved is false, and show that this leads to a contradiction, thereby demonstrating that the formula to be proved is in fact true.

They show the following proof diagram ( based on rules and facts established one section earlier ):

证明图

But if I read these steps backwards it's a straightforward direct proof:

/* axiom: tottenham_court_road is connected to leicester_square by northern road */
connected(tottenham_court_road, leicester_square, northern)

/* therefore it's connected to something on some road */
connected(tottenham_court_road, W, L)

/* being connected to something also means it's nearby */
nearby(X,Y):-connected(X,Y,L)

/* Therefore tottenham_court_road is near something */
nearby(tottenham_court_road, W)

How is this a proof by contradiction? Why would that be a more useful framework than chaining reasoning from axioms?

You should probably ask the textbook authors what exactly they are talking about. They for example say "In logic, this is achieved by writing the statement as a rule with an empty conclusion, ie a rule for which the truth of its premises would lead to falsity" but do they mean that this is strictly in the world of logic but not in the world of Prolog programming? The example they show:

:- nearby(tottenham_court_road, W)

Doesn't exactly make sense in Prolog, ie, you can write it and it might even do something but it doesn't seem to be the thing that they are talking about "in logic". This sentence specifically gets more unclear the more times I read it:

Thus, the symbols "?-" and ":-" are in fact equivalent. A contradiction is found if resolution leads to the empty rule, of which the premises are always true (since there are none), but the conclusion is always false.

Maybe it made sense in their head when they wrote it but they failed miserably at the exercise of writing a textbook.

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