sequence of simple stack code instructions, such as those used in…

Question Answered step-by-step sequence of simple stack code instructions, such as those used in…  sequence of simple stack code instructions, such as those usedin your answer to part (b) above, can be translated into a sequence ofinstructions for a register-oriented architecture of your choice, for exampleARM or Pentium. [7 marks]5[TURN OVERCST.2002.5.67 Prolog for Artifificial Intelligence(a) Give a simple defifinition of the Prolog predicate dfx that can perform symbolicdifffferentiation with respect to the variable x of expressions composed ofintegers (e.g. 0, 1, . . .), symbolic constants (e.g. a, b, . . .), symbolic variables(e.g. x, y, . . .) and the operators +, – and *, for addition, subtraction andmultiplication. The fifirst argument of dfx is the expression to difffferentiateand the second argument is the result. Your defifinition need not perform anysimplifification of the result. [6 marks](b) Trace the execution of the call: dfx(x*x-2, R). [2 marks](c) Now modify your defifinition so that it simplififies the result by the applicationsof rewriting rules such as: 1*x?x and x-0?x. [8 marks](d) Discuss to what extent, if any, either of your predicates could be used tointegrate an expression. [4 marks]8 Databases(a) Describe the relational model of data. [6 marks](b) Explain the following concepts in relational databases:(i) entity integrity constraint; [1 mark](ii) foreign key and how it can specify a referential integrity constraintbetween two relations; [4 marks](iii) semantic integrity constraint. [1 mark](c) (i) What is a functional dependency? [1 mark](ii) Defifine Boyce-Codd Normal Form (BCNF). [3 marks](iii) Defifine Third Normal Form (3NF). [3 marks](iv) What is the relationship between BCNF and 3NF? [1 mark]6CST.2002.5.7SECTION C9 Semantics of Programming Languages(a) The integer expressionseof a C-like language take the forme ::= n | x | x++ | ++x | e + e, where n ranges over integer constants andx over integer storage variables. The expression x++ returns the value storedin the integer variable x and then increments the stored value by one; whereas++x fifirst increments the stored value by one and then returns it. Assuminga left-to-right evaluation order, give an operational semantics for all theseexpressions, in the form of an evaluation relation h s, ei ? hs0 , ni , where s, s0range over states which are fifinite functions from integer storage variables tointegers. [5 marks](b) The commands (statements) c of this same language take the formc ::= x = e | x += e | c;c. The fifirst form is assignment and the last issequencing; the command x += e evaluates e, adds the result to the valuestored in x and stores the result there. Give an operational semantics for thesecommands in the form of an evaluation relation h s, ci ? s0 (where s, s0 are asabove). [4 marks](c) Defifine the notion of semantic equivalence for these expressions and commands.[3 marks](d) For each of the following pairs of expressions or commands, state, withjustifification, whether or not they are semantically equivalent.(i) ++x and x++ + 1[2 marks](ii) x = ++x and x = x++[2 marks](iii) x = ++x and x += 1[2 marks](iv) x += e and x = x + e, for any e[2 marks]7[TURN OVERCST.2002.5.810 Foundations of Functional Programming(a) Explain how a lambda-term can be converted into a form that uses only thecombinators S and K. [4 marks](b) Illustrate your method by writing down a lambda term for each of the followingfunctions and then expressing it in terms of just S and K.(i) fun I x = x(ii) fun B f g x = f (g x)(iii) fun C f x y = f y x(iv) fun A x y = y (x x y)[4 marks each]11 Logic and Proof(a) For each of the following formulae, state (with justifification) whether it issatisfifiable, valid or neither:((Q ? R) ? Q) ? ¬Q[2 marks]((P ? Q) ? P) ? Q[2 marks]?xy [P(x, y) ? ?xy P(x, y)] [3 marks][?x (P(x) ? Q(x)) ? ?x P(x)] ? ?x Q(x) [3 marks](b) Brieflfly outline the semantics of fifirst-order logic, taking as an example theformula ?xy f(x, y) = f(y, x). [6 marks](c) Exhibit a model that satisfifies both of the following formulae (a is a constant):?x g(x)6=a?xy [g(x) = g(y) ? x = y][4 marks]8CST.2002.5.912 Complexity Theory(a) Give a precise defifinition of what is meant by the statement that a decisionproblem A is polynomial-time reducible to a decision problem B. [2 marks](b) Consider the following three decision problems on graphs.Connect—the collection of graphs G such that there is a path betweenany two vertices of G.Image transcription text8. Which of the following Java mathoperators has the incorrect symbol?A)Addition (+) BJMultiplic… Show more… Show more  Computer Science Engineering & Technology Networking COM ISM3220 Share QuestionEmailCopy link Comments (0)