CutNotFail 4 - The cut-fail combination fail is a built-in...

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

View Full Document Right Arrow Icon
The cut-fail combination fail is a built-in predicate, w/o any arguments, which always fails. a:- b,c, !, fail. a:- d. If b and c can be satisfied, a will fail and no more attempts will be made to re-satisfy a. York University- CSE 3401- V. Movahedi 16 07_CutNotFail
Background image of page 1

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

View Full DocumentRight Arrow Icon
!, fail. Example The average tax payer average_taxpayer(X) :- foreigner(X), !, fail. average_taxpayer(X) :- spouse(X, Y), gross_income(Y, Inc), Inc > 3000, !, fail. average_taxpayer(X) :- gross_income(X, Inc), 2000 < Inc, 20000> Inc. Hard to write with not: average_taxpayer(X) :- \+foreigner(X), \+((spouse(X,Y), gross_income(Y, Inc), Inc>3000)), gross_income(X, Inc), 2000 < Inc, 20000> Inc. York University- CSE 3401- V. Movahedi 17 07_CutNotFail
Background image of page 2
!, fail. Example Actually not is defined using fail: not(P):- call(P), !, fail. not(_). ‘call’ queries the database with the predicate P. If P succeeds, not(P) will fail.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
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 4 - The cut-fail combination fail is a built-in...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online