Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider an ML-style language with types and type schemes ? ::= ? | bool | ? ? ? | ? list ? ::= ?A (?

Consider an ML-style language with types and type schemes ? ::= ? | bool | ? ? ? | ? list ? ::= ?A (? ) Give the typing rules for variables, function abstraction, function application, and let-binding. Make the form of the typing judgement clear. [5 marks] Give terms M1 and M2 such that N1 is typable (in the empty context) and N2 is not, where N1 def = letvalf = M1 inM2 end N2 def = (fn f ? M2) M1 Give all uses of ? ? required in a typing derivation for N1; prove that there does not exist a typing derivation for N2. [7 marks] What is a principal type scheme? Give the principal type scheme for N1, or explain informally why it does not have one. [4 marks] 8 CST.99.7.9 13 Communicating Automata and Pi Calculus Concurrent processes are defined by the syntax P ::= Ahb1, . . . , bni

??i .Pi

P1 | P2

newa P where each process identifier A is equipped with a defining equation A(a1, . . . , an) def = PA. Give the transition rules from which transitions of the form P ?? P 0 can be inferred, where ? is of the form a, a or ? . The rules should not use structural congruence (?). [5 marks] Enumerate the ways in which a transition of the form P|Q ?? R can be inferred from transitions of P and/or Q, and indicate the form of R in each case. [5 marks] Hence show that if P|Q ?? R1, then there exists R2 such that Q|P ?? R2 and R1 ? R2. [5 marks] Give an example of P and Q for which newa(P|Q) has a ? -transition but P|newa Q has no ? -transition. Now suppose that newa(P|Q) ?? R1; what syntactic condition on P ensures that P|newa Q ?? R2 for some R2 with R1 ? R2? Justify your answer. [5 marks] 14 Additional Topics List some intrinsic properties of wearable computers and how they may develop in future. [6 marks] What is an Active Badge and how can it be used to locate personnel and equipment? [6 marks] Give four other applications of the Active Badge and write brief notes on each. [4 marks] Choose one of these four applications and explain how the underlying distributed system can ensure that the appropriate quality of service is available to the user.

Justify each of the following statements, with the help of some formal details and examples. "The dynamic behaviour of programs in a programming language can be defined in terms of a formal logical system, in which each sentence which can be inferred in the logic represents the evaluation of a piece of program." "The type discipline of a programming language can be defined in terms of a formal logical system, in which each sentence which can be inferred in the logic represents the assertion that a piece of program obeys the discipline." [15 marks] Give and explain two examples of theorems about the behaviour of Standard ML programs which can be expressed and proved in terms of either or both of the two logical systems described above.

Show how to encode a general register machine program and the initial configuration of one of its computations into a pair of natural numbers. [6 marks] Outline the design of a register machine that simulates a general register machine computation specified by a single natural number. Your machine should take appropriate action for all possible inputs. [6 marks] 6 CST.99.3.7 10 Numerical Analysis I Define absolute error, relative error and machine epsilon ?m. Although ?m is defined in terms of absolute error, why is it useful as a measurement of relative error?

For a floating-point implementation with p = 4, ? = 10, explain the round to even method of rounding using the half-way cases 7.3125, 7.3175 as examples.

imageimage

Python Add exception handling to the following code, so that: (1) if the data file can't open, a file not found exception will be raised and a message would print out; (2) if the version number entered not an integer, try to catch it (don't use default catch all handler) and set the version to 0. (3) add code after exception handler so that if no exception, a message "Good" will be printed out. (4) close the file (as part of exception handling construct) so in any case (i.e. with or without exception) the file will be closed. #add exception handling to this piece of code filename = input ("please enter the data file name") version = int(input("please enter an integer to indicate the version of data file")) infile= open(filename, "r")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

An Introduction To Statistical Methods And Data Analysis

Authors: R. Lyman Ott, Micheal T. Longnecker

7th Edition

1305269470, 978-1305465527, 1305465520, 978-1305269477

More Books

Students also viewed these Computer Network questions

Question

Can hydrogen or deuterium emit an particle? Explain.

Answered: 1 week ago