CutNotFail 3

# CutNotFail 3 - 3 reasons to use cut 1 Confirming the choice of a rule if you get to here you have picked the correct rule for this goal Don't try

This preview shows pages 1–4. Sign up to view the full content.

3 reasons to use cut ! 1. Confirming the choice of a rule “if you get to here, you have picked the correct rule for this goal.” Don't try any other! 2. The cut-fail combination “if you get to here, you should stop trying to satisfy this goal.” Return false. 3. Terminating generation of multiple solutions “If you get to here, you have found the only solution to this problem.” Don’t try to find alternatives. York University- CSE 3401- V. Movahedi 11 07_CutNotFail

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Notes The cut always has only one meaning to Prolog Instruction about where to and not to backtrack The 3 mentioned, are just to make it easy to apply cut. foo:- a, b, c, !, d, e, f. Can backtrack among goals a,b, c Success of c causes the “fence” to be crossed Can backtrack among d, e, f If d fails, no attempt to re-satisfy c, foo will also fail. York University- CSE 3401- V. Movahedi 12 07_CutNotFail
Confirming the choice of a rule Example: sum_to(1,1):- ! . sum_to(N, R):-

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/14/2012 for the course CSE 3401 taught by Professor Movahedi during the Fall '11 term at York University.

### Page1 / 5

CutNotFail 3 - 3 reasons to use cut 1 Confirming the choice of a rule if you get to here you have picked the correct rule for this goal Don't try

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online