(www) (a) The meta-logical operator var(X) in Prolog is de?ned to succeed…

(www) (a) The meta-logical operator var(X) in Prolog is de?ned to succeed ifXiscurrentlyanunboundvariableandtofailotherwise.Howcanthisoperatorbe implemented in compiled Prolog? (b) The meta-logical arithmetical in?x operator is in Prolog requires its right operandtobeastructureE thatrepresentsanarithmeticexpressioninsomespeci?c format. All variables in E must be bound. If V is currently an unbound variable, the operation succeeds and V is bound to the arithmetic value of E. IfV is bound and its value is equal to the arithmetic value of E, the operation succeeds. Otherwise it fails. How can

»(www) (a) The meta-logical operator var(X) in Prolog is de?ned to succeed ifXiscurrentlyanunboundvariableandtofailotherwise.Howcanthisoperatorbe implemented in compiled Prolog? (b) The meta-logical arithmetical in?x operator is in Prolog requires its right operandtobeastructureE thatrepresentsanarithmeticexpressioninsomespeci?c format. All variables in E must be bound. If V is currently an unbound variable, the operation succeeds and V is bound to the arithmetic value of E. IfV is bound and its value is equal to the arithmetic value of E, the operation succeeds. Otherwise it fails. How can this operator be implemented in compiled Prolog? Assume theexistenceofaroutine Term *evaluate_expression() thatevaluatesanexpression in the speci?c format to a term of type Constant, or gives an error message if the expression is in error. Also assume single-length integer arithmetic.

»