Question: The transaction processing system for a banking…

QuestionAnswered step-by-stepQuestion: The transaction processing system for a banking…Question:The  transaction processing system for a banking application is to be implemented using object semantics. Bank account objects include the follorrwing among their operations: credit (account id, amount) debit (account id, amount) add interest (account id) By defining “transactions” based on this example, show what is meant by (a) a non-serialisable execution schedule [3 marks] (b) a non-strict execution schedule leading to a cascading abort [3 marks] Explain the ACID properties of transactions, drawing on the above application for examples. Indicate which properties are concerned with failure resilience and which with concurrency control. [8 marks] Again using the above application for examples, explain codncurrency control based on (a) two-phase locking [3 marks] (b) time-stamp orderingName the four necessary conditions for deadlock. [2 marks] (ii) Which of these conditions is frequently precluded in operating-system kernel designs in order to prevent deadlocks and why? [2 marks] (b) Deadlocks are not limited to locks; cycles of waiting on condition variables can also lead to the “deadly embrace”. (i) Explain why it might be more difficult to debug deadlocks involving condition variables than those simply involving locks. [2 marks] (ii) Briefly describe a condition-variable API change that might allow this problem to be solved in some cases; explain why it cannot always help. [2 marks] (c) FreeBSD’s WITNESS feature checks statically defined and dynamically discovered lock orders. Each time a lock is acquired, any previously undiscovered graph edges involving lock types currently held by the thread and the newly acquired lock type will be added to the graph. Cycle detection is performed, and debug information is printed if a previously unreported cycle is discovered. (i) Describe a common code structure in which programmers are likely to be able to define a static order between two lock types. [2 marks] (ii) Describe a common case in which programmers are likely to rely instead on dynamic discovery of an order between two lock types. [2 marks] (iii) Unlike the deadlock-detection algorithm presented in lecture, thes not remove edges when locks are released. Explain why WITNESS’s behaviour might be more useful in practice. [2 marks] (iv) WITNESS is subject to false positives: warnings can be emitted due to legitimate cycles even though, by design, the cycle could never trigger an actual deadlock. Describe a situation in which this might arise, and explain why deadlock could never occur. [3 marks] (v) WITNESS, as written, is intended to be used with mutexes and other lock types providing mutual exclusion. A developer might na¨?vely extend WITNESS to support reader-writer locks (rwlock) by introducing graph edges for both read and write acquires as it does for mutex acquires. Explain why this might not always lead to the desired result. [3 marks]Remote Procedure Call (RPC) allows procedures (functions, methods) to be forwarded over the network, and is a fundamental building block of distributed systems such as the Network File System (NFS). a client, what it means for an RPC call to be: (i) Synchronous [1 mark] (ii) Asynchronous [1 mark] (iii) Idempotent [1 mark] (b) Distributed-filesystem clients utilize different tradeoffs between performance and consistency for operations on the directory namespace (e.g., file or directory creation) versus those on file data itself. The following program creates and opens a file foo, writes some data to it, and closes it, via NFSv3: fd = open(“foo”, O_CREAT | O_RDWR, 0755); // POINT A write(fd, data, sizeof(data)); // POINT B close(fd); // POINT C For each of points A, B, and C in the program, discuss whether or not another NFSv3 client is guaranteed to be able to see the results of each of open and (if it has been called) write. [5 marks] (c) The developers of a new distributed filesystem use a persistent log to ensure all-or-nothing retry semantics for filesystem operations. However, this comes at a substantial performance cost. Describe two circumstances under which filesystem RPCs can be excluded from the log while maintaining correctness, and give an example of each. [4 marks] (d) The distributed filesystem’s persistent RPC log is maintained in a write-ahead log stored in local disk blocks. Explain why large RPCs may require special care in the server-side log implementation. [2 marks] (e) RPC protocols and write-ahead logging both rely on unique ID numbers. Explain why reusing client-generated RPC IDs for server log transaction IDs could harm each of correctness, scalability, and security. [6 marks] (a) Write  immutable Java class Complex that represents a complex number with integer real and imaginary components. [Note: Your class should contain only methods that are essential for its use. Do not incorporate any mathematical operations in the class.] [4 marks] (b) Without using Generics, adapt the class to support the use of arbitrary types to store the real and imaginary components. Give three disadvantages of this approach and comment on the immutability of the new class. [7 marks] (c) Rewrite your class from part (b) using Generics. Discuss the extent to which this new version addresses the problems identified in part (b). [7 marks] (d) Explain carefully why the following code cannot be used to print out an object of type LinkedList>. You may assume the existence of a working print method within each Complex object. void printAll(LinkedList> list) { for (Complex c : list) c.print();  Cons cumulative reward, a policy, and an optimal policy for a problem of this kind. [5 marks] (b) Give a detailed derivation of the Q-learning algorithm. [5 marks] (c) In the reinforcement learning problem shown in the diagram, states are positions on a grid and actions are down and right. The initial state is s1. The only way an agent can receive a (non-zero) reward is by moving into one of two special positions, one of which has reward ?50 and the other 150. s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 sossible sequence of actions (sequence 1) is shown by solid arrows, and another (sequence 2) by dashed arrows. Assume that all Q values are initialised at 0. Explain how the Q values are modified by the Q-learning algorithm if sequence 1 is used once, followed by two uses of sequence 2, and then one final use of sequence 1. [10 marks]The following code has been written by a novice Java programmer. You are not required either to understand or to debug the details of how this code draws some particular pattern (a “Dragon”). The programmer finds that the Java compiler complains. Identify any errors and comment on any issues that (even if not strictly invalid Java) are liable to cause problems. You are not required to provide corrections.pper class Dragon extends JApplet throws Exception { import javax.swing.*; public paint(Graphics g) { this.g = g; drawDragon(DRAWDEPTH,100,200,300,200); } /** @title: drawDragon Function to draw a dragon curve between too points (x1,y1) and (x2,y2) with depth ‘depth’. */ void protected drawDargon(int depth, int x1,int y1,int x2,int y2) { if (x1 < 0 | x2 < 0) if (y1 < 0) raise new Exception("X & Y < 0"); else assert("Ok so far"); if (depth = 0) // bottom of recursion { (y2+y1-x2+x1)/2; ... and Y coord. */ printf("DEBUG: x= drawDragon(depth-1,mpx,mpy,x1,y1); drawDragon(depth+1,mpx,mpy,x2,y2); } static secret int DRAWDEPTH=15, Graphics g; (a) Show how you would create  Java array of 1000 integer values. [1 mark] (b) The values in an array could be used to represent digits in the decimal representation of a number. For example, the number 1 7 has decimal representation 0.142857 . . . and that could be stored in an array whose elements started {1, 4, 2, . . .}. For a number stored that way write code that multiplies the number by a given integer, returning the whole number part of the result and leaving the array updated to hold the fractional part of the product. [5 marks] (c) To convert a fraction to a representation base 16 (i.e. hexadecimal) you can multiply it by 16, and the resulting integer part is the first digit of the base-16 representation. Multiplying the fraction left over by 16 gets the second digit and so on. Write  method that accepts an array of digits (base 10) and creates and returns a new array representing the same fraction but now base 16. Your code should work for any length input array, not just one of length 1000, and you may make the output array have the same length as your input array. [6 marks] (d) Suppose the input to your method in part (c) was of length 1000 and started off with the decimal digits of 1 7 in it. Although the initial digits in the output array are the correct hexadecimal representation of 1 7 the last few end up looking odd. Explain. [3 marks] (e) One way to ensure that numerical results are correct is to use interval arithmetic. A value is represented as a pair of arrays, one representing a number less than (or equal to) the true value and one a value greater than it. So if using 6 decimal places the number 1 7 would be held as a pair { If the two final digits differ by at most 1 then the smaller of them can be viewed as fully accurate. Using this idea, write code that accepts a fraction in decimal form and returns a vector denoting the same value in another base n (now no longer necessarily 16) such that all the digits in the result vector are correct. Clarity in your code is to be preferred to performance, but if you are aware of particular ways in which the code you present is particularly inefficient, you should note and explain themFor each of the following pairs of concepts that are used in Java explain similarities and differences and discuss when you would use one rather than the other. If there are important syntactic differences, method names, degrees of generalisation possible or the like, then any code fragments you give in illustration should be as short as possible to make the desired point. (a) JApplet and simple Java applications [4 marks] (b) Vector and arrays of strings (String []) [3 marks] (c) class, abstract class and interface(a) In order to remove the overhead of a function call, a programmer decides to replace all calls to a function f with the macro F, where f and F are defined as follows: int f(int x) { return x+x;} #define F(X) (X)+(X) (i) Give two valid C expressions involving f which produce different results when F is substituted for f. Justify your answer. [4 marks] (ii) State the C language feature which can be used to correctly remove the overhead of a function call. [1 mark] (b) Consider the following: static struct link { int v; struct link *next; } *head=0; void convert(int a[], int len); Write  function definition for convert which updates head to point to a linked-list containing the elements of a in the same order. You may assume len contains the number of elements in a. [5 marks] (c) Consider the following C++ declaration: template int SumSquares(); (i) Using function specialisation, provide an implementation of SumSquares so that, given an integer N, SumSquares() returns: X N i=1 i 2 [5 marks] (ii) Compare and contrast the functionality of the C preprocessor and the C++ template system. Explain why it is not possible to write a C preprocessor macro to implement SumSquares. [5 marks] (a) An author writes: Most successful language design efforts share three important characteristics . . . 1. Motivating Application: The language was designed so that a specific kind of program could be written more easily. 2. Abstract Machine: There is a simple and unambiguous program execution model. 3. Theoretical Foundations: Theoretical understanding was the basis for including certain capabilities and omitting others. Briefly discuss the merits and/or shortcomings of one of the above three statements of your choice, giving examples and/or counterexamples from procedural, applicative, logical, and/or object-oriented programming languages. [6 marks] (b) For two programming languages of your choice amongst FORTRAN, Algol, Pascal and C, briefly discuss and evaluate their typing disciplines. Further compare the advantages and disadvantages that their designs impose on the programmer. [5 marks] (c) Consider the following two program fragments. ( defvar x 1 ) ( defun g(z) (+ x z) ) ( defun f(y) (+ (g 1) ( let ( ( x (+ y 3) ) ) ( g(+ y x) ) ) ) ) ( f 2 ) val x = 1 ; fun g(z) = x + z ; fun f(y) = g(1) + let val x = y + 3 in g(y+x) end ; f(2) ; What are their respective output values when run in their corresponding interpreters? Justify your answer, explaining it in a conceptual manner. [4 marks] (d) Outline the key features that a language must have to be called object-oriented. Further, briefly discuss to what extent one programming language of your choice amongst Simula, Smalltalk, C++, and Java has them. [5 marks(a) Many computer scientists believe that languages with strong compile-time type checking are better than those that are typeless, dynamically typed, or are weakly type checked. Discuss the reasons for this view. [7 marks] (b) If strictly-checked data types are seen as good, discuss whether augmenting a language with many more primitive data types is better. Consider, in particular, the possibility of incorporating into a language such as Java many new numerical types such as packed decimal of various precisions, scaled arithmetic, and new types to hold values representing distance, mass and time. How would these additions affect the readability and reliability of programs? [7 marks] (c) Some languages allow different modes of calling of function arguments, such as call by value, call by reference and call by name. Discuss the advantages and disadvantages of incorporating the argument calling modes into the data types of functions. [6 marks] (a) State what is meant by a directed graph and a strongly connected component.Illustrate your description by giving an example of such a graph with 8 verticesand 12 edges that has three strongly connected components. [5 marks](b) Describe, in detail, an algorithm to perform a depth-fifirst search over such agraph. Your algorithm should attach the discovery and fifinishing times to eachvertex and leave a representation of the depth-fifirst spanning tree embeddedwithin the graph. [5 marks](c) Describe an O(n) algorithm to discover all the strongly connected componentsof a given directed graph and explain why it is correct. You may fifind it usefulto use the concept of the forefathepathfrom v to u. [10 marks]2 Computer Design(a) What is a data cache and what properties of data access does it exploit?[5 marks](b) What is a direct mapped cache and under what conditions will it exhibit poorperformance? [5 marks](c) Under what circumstances might a word of data in main memory besimultaneously held in two separate fifirst-level cache lines? [5 marks](d) A translation look aside buffffer is a specialised cache. What does it typicallystore and why is it often a factor of 1000 smaller than a data cache? [5 marks]2CST.2001.6.33 Digital Communication I(a) Defifine the terms circuit and packet in the context of communication systems.[5 marks](b) What sort of guarantee does circuit switching provide? [5 marks](c) What advantages does packet switching provide over circuit switching?[5 marks](d) Which of frequency division multiplexing, time division multiplexing and codedivision multiplexing lend themselves to circuit switching? Which to packetswitching? Explain why or why not in each case. [5 marks]4 Computer Graphics and Image Processing(a) Describe the z-buffffer polygon scan conversion algorithm. [10 marks](b) In ray tracing, once we have determined where a ray strikes an object, theillumination at the intersection point can be calculated using the formula:I = Iaka +XiIikd(Li · N) +XiIiks(Ri · V)nExplain what real effffect each of the three terms is trying to model and explainwhat each of the following symbols means, within the context of this formula:I, Ia, i, Ii , ka, kd, ks,Li, N, Ri, V, n[10 marks]3[TURN OVERCST.2001.6.4SECTION B5 Comparative Programming Languages(a) Brieflfly explain the concept of coroutines as used in BCPL and outlinethe effffect of the library functions createco(f, size), deleteco(ctpr),callco(cptr, val) and cowait(val). [10 marks](b) Outline how you would design a coroutine to merge, in increasing order, twoinfifinite streams of increasing integers supplied by two other coroutines.[5 marks](c) Brieflfly outline how you would implement an analogous merging mechanism inan object-oriented language, such as Java, that does not provide a coroutinemechanism. [5 marks]6 Compiler Construction(a) Describe one possible structure (e.g. ELF) of an object fifile. Illustrate youranswer by considering the form of object fifile which might result from thefollowing C program.int a = 1, b = -1;extern int g(int);extern int c;int f() { return g(a-b) + c; }It is not necessary to consider the exact instruction sequence, just issuesconcerning its interaction with the object fifile format. [10 marks](b) Describe how a linker takes a sequence of such programs and produces anexecutable fifile. [4 marks](c) Compare and contrast static and dynamic linking in a system using your objectfifile format. [6 marks]4CST.2001.6.57 Prolog for Artifificial IntelligenceA weighted binary tree can be defifined using compound terms in the following way.A node of the tree is represented by the term n(V, L, R), where V stands for thevalue of the node, and L and R stand for the left and right branches, respectively.A terminal node has the R and L components instantiated to the null list.Given an input tree T, write a Prolog program that constructs a tree of the sameshape as T, but in which the value of each node has been set to the value of themaximum value node in T.[Note: Maximum marks are available only for programs that perform this task inone recursive descent of the input tree, and which use no more than four clauses.][20 marks]5[TURN OVERCST.2001.6.68 DatabasesThe environmental agency is setting up an SQL database to monitor long-termtrends in the climate. Data are collected from observatories of a number of difffferentkinds.Flood risk is of particular concern. Each water authority measures river levels andrates of flflow hourly at major points, and records reservoir levels daily.In addition, the agency maintains weather stations both inland and at sea. Theserecord precipitation (rainfall etc.), temperature, sunshine, air pressure and wind.Values of new precipitation, temperature, pressure, and wind speed and directionare taken hourly; gusts of over 60 m.p.h. are noted whenever they occur.Maximum and minimum temperature and pressure, the total number of hours ofsunshine and the total precipitation are recorded daily. Inland stations can begrouped by water authority.By default these primary data will be relegated to archive after 2 years. Selectedinformation is retained permanently in a data warehouse. This serves two purposes.First, it holds monthly summary data consisting of the maximum (and minimumas appropriate) day value for each statistic, together with the monthly totals ofsunshine and precipitation. The warehouse also keeps detailed information relatingto periods of extreme weather from the relevant observatories, with one or morekeywords describing the nature of the incident (flflood, blizzard, hurricane etc.) andan optional comment.Write notes to assist in the design of the schema for the relational data warehouse,including any diagrams that you fifind helpful. Explain how your design will enablemeteorologists to fifind relevant past records, noting any assumptions that you makeabout the nature of the data.[You should not go into unnecessary detail about the structure of the primarydatabase. You may assume that expert meteorologists will select the data for thewarehouse.][20 marks]6CST.2001.6.7SECTION C9 Semantics of Programming LanguagesWrite short notes on four of the following fifive topics.(a) The relationship between three forms of operational semantics of the Languageof Commands (LC) given by• an evaluation relation h P, si ? hV, s0 i• a transition relation h P, si ? hP0 , s0 i• a transition relation between the confifigurationsh c, r, si of theSMC-machine(b) The notion of semantic equivalence of LC phrases and its congruence property.(c) Call-by-name and call-by-value rules for evaluating function applications in theLanguage of Functions and Procedures (LFP) and the relationship between theevaluation relations for LFP based upon each of them.(d) The notion of bisimilarity of two confifigurations in a labelled transition system.(e) The rules defifining the possible labelled transitions of parallel composition(P1|P2) and restriction (? c . P) in the Language of Communicating Processes(LCP).[5 marks each]7[TURN OVERCST.2001.6.810 Foundations of Functional ProgrammingThe following are some concepts that have flflourished in the context of functionalprogramming but which have (so far) been less heavily used in main-streamlanguages even when they have been available:(a) polymorphic types(b) type reconstruction(c) higher-order functions(d) lazy evaluation(e) continuationsFor each case give a brief explanation of the facility referred to, suggest acircumstance in which it might be useful and comment on how immediately relevantto non-functional languages it seems.[4 marks per part]8CST.2001.6.911 Logic and Proof(a) In the context of clause-based proof methods, defifine the notion of pure literaland describe what should be done if the set of clauses contains pure literals.[3 marks](b) Use the Davis-Putnam method to discover whether the following set of clausesis satisfifiable. If they are satisfifiable, show a satisfying interpretation.{P, R} {¬P, ¬R} {P, ¬Q} {¬Q, R} {¬P, Q, R}[6 marks](c) The three-fifingered inhabitants of the planet Triterra build base-3 computers.A Triterran named Randal Tryant has found a way of verifying base-3combinational logic. His Ordered Ternary Decision Diagrams (OTDDs) arethe same as a technology used on planet Earth except that all variables andexpressions range over the values 0, 1 and 2 instead of just 0 and 1.(i) Describe how a full ternary decision tree can be reduced to an OTDDwithout regard for effiffifficiency. [2 marks](ii) Sketch an effiffifficient algorithm to convert a ternary expression directly to anOTDD without constructing the full decision tree. For a typical ternaryconnective use modulo-3 multiplication, written as ?. [6 marks](iii) Demonstrate your algorithm by applying it to the ternary expression((i ? i) ? j) ? 2. [3 marks]9[TURN OVERCST.2001.6.1012 Complexity Theory(a) Show that any language that can be accepted by a nondeterministic machinein time f(n) can also be decided by a deterministic machine in space O(f(n)).[4 marks](b) Show that any language that can be accepted by a nondeterministic machinein space f(n) can also be decided by a deterministic machine in timeO(c(f(n)+log n) ), for some constant c. [6 marks](c) Explain what the above results tell us about the inclusion relationships amongthe complexity classes:NL, co-NL, P, NP, PSPACE and NPSPACE[4 marks](d) It has been proved that the graph reachability problem is in co-NL. Whatfurther inclusions can you derive among the above complexity classes usingthis fact? Explain your answer.(a) State what is meant by a directed graph and a strongly connected component.Illustrate your description by giving an example of such a graph with 8 verticesand 12 edges that has three strongly connected components. [5 marks](b) Describe, in detail, an algorithm to perform a depth-fifirst search over such agraph. Your algorithm should attach the discovery and fifinishing times to eachvertex and leave a representation of the depth-fifirst spanning tree embeddedwithin the graph. [5 marks](c) Describe an O(n) algorithm to discover all the strongly connected componentsof a given directed graph and explain why it is correct. You may fifind it usefulto use the concept of the forefather ?(v) of a vertex v which is the vertex, u,with highest fifinishing time for which there exists a (possibly zero length) pathfrom v to u. [10 marks]2 Computer Design(a) What is a data cache and what properties of data access does it exploit?[5 marks](b) What is a direct mapped cache and under what conditions will it exhibit poorperformance? [5 marks](c) Under what circumstances might a word of data in main memory besimultaneously held in two separate fifirst-level cache lines? [5 marks](d) A translation look aside buffffer is a specialised cache. What does it typicallystore and why is it often a factor of 1000 smaller than a data cache? [5 marks]2CST.2001.6.33 Digital Communication I(a) Defifine the terms circuit and packet in the context of communication systems.[5 marks](b) What sort of guarantee does circuit switching provide? [5 marks](c) What advantages does packet switching provide over circuit switching?[5 marks](d) Which of frequency division multiplexing, time division multiplexing and codedivision multiplexing lend themselves to circuit switching? Which to packetswitching? Explain why or why not in each case. [5 marks]4 Computer Graphics and Image Processing(a) Describe the z-buffffer polygon scan conversion algorithm. [10 marks](b) In ray tracing, once we have determined where a ray strikes an object, theillumination at the intersection point can be calculated using the formula:I = Iaka +XiIikd(Li · N) +XiIiks(Ri · V)nExplain what real effffect each of the three terms is trying to model and explainwhat each of the following symbols means, within the context of this formula:I, Ia, i, Ii , ka, kd, ks,Li, N, Ri, V, n[10 marks]3[TURN OVERCST.2001.6.4SECTION B5 Comparative Programming Languages(a) Brieflfly explain the concept of coroutines as used in BCPL and outlinethe effffect of the library functions createco(f, size), deleteco(ctpr),callco(cptr, val) and cowait(val). [10 marks](b) Outline how you would design a coroutine to merge, in increasing order, twoinfifinite streams of increasing integers supplied by two other coroutines.[5 marks](c) Brieflfly outline how you would implement an analogous merging mechanism inan object-oriented language, such as Java, that does not provide a coroutinemechanism. [5 marks]6 Compiler Construction(a) Describe one possible structure (e.g. ELF) of an object fifile. Illustrate youranswer by considering the form of object fifile which might result from thefollowing C program.int a = 1, b = -1;extern int g(int);extern int c;int f() { return g(a-b) + c; }It is not necessary to consider the exact instruction sequence, just issuesconcerning its interaction with the object fifile format. [10 marks](b) Describe how a linker takes a sequence of such programs and produces anexecutable fifile. [4 marks](c) Compare and contrast static and dynamic linking in a system using your objectfifile format. [6 marks]4CST.2001.6.57 Prolog for Artifificial IntelligenceA weighted binary tree can be defifined using compound terms in the following way.A node of the tree is represented by the term n(V, L, R), where V stands for thevalue of the node, and L and R stand for the left and right branches, respectively.A terminal node has the R and L components instantiated to the null list.Given an input tree T, write a Prolog program that constructs a tree of the sameshape as T, but in which the value of each node has been set to the value of themaximum value node in T.[Note: Maximum marks are available only for programs that perform this task inone recursive descent of the input tree, and which use no more than four clauses.][20 marks]5[TURN OVERCST.2001.6.68 DatabasesThe environmental agency is setting up an SQL database to monitor long-termtrends in the climate. Data are collected from observatories of a number of difffferentkinds.Flood risk is of particular concern. Each water authority measures river levels andrates of flflow hourly at major points, and records reservoir levels daily.In addition, the agency maintains weather stations both inland and at sea. Theserecord precipitation (rainfall etc.), temperature, sunshine, air pressure and wind.Values of new precipitation, temperature, pressure, and wind speed and directionare taken hourly; gusts of over 60 m.p.h. are noted whenever they occur.Maximum and minimum temperature and pressure, the total number of hours ofsunshine and the total precipitation are recorded daily. Inland stations can begrouped by water authority.By default these primary data will be relegated to archive after 2 years. Selectedinformation is retained permanently in a data warehouse. This serves two purposes.First, it holds monthly summary data consisting of the maximum (and minimumas appropriate) day value for each statistic, together with the monthly totals ofsunshine and precipitation. The warehouse also keeps detailed information relatingto periods of extreme weather from the relevant observatories, with one or morekeywords describing the nature of the incident (flflood, blizzard, hurricane etc.) andan optional comment.Write notes to assist in the design of the schema for the relational data warehouse,including any diagrams that you fifind helpful. Explain how your design will enablemeteorologists to fifind relevant past records, noting any assumptions that you makeabout the nature of the data.[You should not go into unnecessary detail about the structure of the primarydatabase. You may assume that expert meteorologists will select the data for thewarehouse.][20 marks]6CST.2001.6.7SECTION C9 Semantics of Programming LanguagesWrite short notes on four of the following fifive topics.(a) The relationship between three forms of operational semantics of the Languageof Commands (LC) given by• an evaluation relation h P, si ? hV, s0 i• a transition relation h P, si ? hP0 , s0 i• a transition relation between the confifigurationsh c, r, si of theSMC-machine(b) The notion of semantic equivalence of LC phrases and its congruence property.(c) Call-by-name and call-by-value rules for evaluating function applications in theLanguage of Functions and Procedures (LFP) and the relationship between theevaluation relations for LFP based upon each of them.(d) The notion of bisimilarity of two confifigurations in a labelled transition system.(e) The rules defifining the possible labelled transitions of parallel composition(P1|P2) and restriction (? c . P) in the Language of Communicating Processes(LCP).[5 marks each]7[TURN OVERCST.2001.6.810 Foundations of Functional ProgrammingThe following are some concepts that have flflourished in the context of functionalprogramming but which have (so far) been less heavily used in main-streamlanguages even when they have been available:(a) polymorphic types(b) type reconstruction(c) higher-order functions(d) lazy evaluation(e) continuationsFor each case give a brief explanation of the facility referred to, suggest acircumstance in which it might be useful and comment on how immediately relevantto non-functional languages it seems.[4 marks per part]8CST.2001.6.911 Logic and Proof(a) In the context of clause-based proof methods, defifine the notion of pure literaland describe what should be done if the set of clauses contains pure literals.[3 marks](b) Use the Davis-Putnam method to discover whether the following set of clausesis satisfifiable. If they are satisfifiable, show a satisfying interpretation.{P, R} {¬P, ¬R} {P, ¬Q} {¬Q, R} {¬P, Q, R}[6 marks](c) The three-fifingered inhabitants of the planet Triterra build base-3 computers.A Triterran named Randal Tryant has found a way of verifying base-3combinational logic. His Ordered Ternary Decision Diagrams (OTDDs) arethe same as a technology used on planet Earth except that all variables andexpressions range over the values 0, 1 and 2 instead of just 0 and 1.(i) Describe how a full ternary decision tree can be reduced to an OTDDwithout regard for effiffifficiency. [2 marks](ii) Sketch an effiffifficient algorithm to convert a ternary expression directly to anOTDD without constructing the full decision tree. For a typical ternaryconnective use modulo-3 multiplication, written as ?. [6 marks](iii) Demonstrate your algorithm by applying it to the ternary expression((i ? i) ? j) ? 2. [3 marks]9[TURN OVERCST.2001.6.1012 Complexity Theory(a) Show that any language that can be accepted by a nondeterministic machinein time f(n) can also be decided by a deterministic machine in space O(f(n)).[4 marks](b) Show that any language that can be accepted by a nondeterministic machinein space f(n) can also be decided by a deterministic mac