Prolog_Part_2

# Prolog_Part_2 - defined by a predicate An object constant A...

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

In Prolog consult(user). student(john, 3401). student(mary, 3401). study_hard(john). pass_3401(X):- student(X, 3401), study_hard(X). Ctrl+D York University- CSE 3401 6 :-pass_3401(john). true. :- pass_3401(mary). false. 03_Prolog

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

View Full Document
Introductory notes Predicates shown by a name starting with lower case letters. Arguments are written in parentheses, separated by commas. A dot (period) comes at the end of each clause. The predicate name and the number of arguments is decided by the user. Queries are answered by matching with the knowledge given (facts and rules). A false means ‘not enough knowledge to prove it’ (does not mean it is actually false, maybe not enough knowledge given to Prolog). York University- CSE 3401 7 03_Prolog
In Prolog consult(user). student(john, 3401). student(mary, 3401). study_hard(john). pass_3401(X):- student(X, 3401), study_hard(X). Ctrl+D York University- CSE 3401 8 :-pass_3401(john). true. :- pass_3401(mary). false. Facts A rule A relationship

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.

Unformatted text preview: defined by a predicate An object constant A satisfiable goal An unsatisfiable goal or ‘not able to prove satisfiable ’ Goals An object variable 03_Prolog Prolog- Syntax • Characters – Upper case A, B, . .., Z – Lower case a, b, . .., z – Digits 0, 1, . ..,9 – Sign characters +, -, . ..\$, & • Object Variables – Their names begin with a capital letter or ‘_’ – The anonymous variable: _ (with a peculiar characteristic!) York University- CSE 3401 9 03_Prolog Prolog- Syntax (cont.) • Object Constants – Two categories: Atoms and Numbers – Numbers, such as 25, 9.99, -30, 7.08e-15 – Symbols used for atoms are made up of letters and digits, must normally begin with a lower case, e.g. mary , john, … – If enclosed in single quotes, may have any character, e.g. ‘George-Smith’, ‘23g’, . .. – Underline symbol ‘_’ may be anywhere except the first letter – Some constants are made from signs only York University- CSE 3401 10 03_Prolog...
View Full 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

Prolog_Part_2 - defined by a predicate An object constant A...

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

View Full Document
Ask a homework question - tutors are online