Bratko, Chapter 2: Syntax and Meaning - data objects in Prolog [Fig 2.1] - atoms - strings of letters/digits/_ starting with lowercase letter - yes, parent, female, tom, tom_jones - strings of special characters (some have predefined meanings) - strings of characters enclosed in single quotes - 'Tom Jones' - numbers: [-][0-9]*[.][0-9]* - 2.71, -100.5, 0.5 (but not .5) - variables - strings of letters/digits/_ starting with uppercase letter or _ - anonymous variable _ - haschild(X) :- parent(X,Y). - OR haschild(X) :- parent(X,_). - ?- parent(X,_). doesn' print children - parent(_,_) different from parent(X,X) - structures - functor(arg1,arg2,...) - e.g., date(2,october,1964) - arguments can be constants, variables or other structures - defined by Name and Arity, e.g., date/3 (differs from date/2) - e.g., X is *(4,3) same as X is 4*3 - e.g., binary_tree(binary_tree(a,b),binary_tree(c,binary_tree(d,e))). - matching: most general unifier - the '=' operator '=(Exp1,Exp2)' - e.g. | ?- date(D1,M1,1983) = date(D2,map,Y2). D1 = D2 = _8890, M1 = map, Y2 = 1983 ; no - no occurs checking (Y = foo(Y)) - problem-solving with just matching - disjunction - P :- Q. P :- R,S. --> P :- Q;R,S. - predecessor(X,Z) :- parent(X,Z); parent(X,Y), predecessor(Y,Z).