1. Homepage
  2. Writing
  3. COMPSYS 705 Formal Methods for Safety Critical Software Test
This question has been solved

COMPSYS 705 Formal Methods for Safety Critical Software Test

Get in Touch with Our Experts
AucklandCOMPSYS 705Formal Methods for Safety Critical Software

The University of Auckland
Department of Electrical, Computer and Software Engineering
Assignment Writing Service

COMPSYS 705 Formal Methods for Safety Critical Software Test, 17 October 2023 Assignment Writing Service

Question Mark Q1 Assignment Writing Service

Q2 Q3 Q4 Q5 Q6 Total Assignment Writing Service

Last name Name ID
Assignment Writing Service

1. Answer ALL questions. Part I (Partha’s part) covers Assignment Writing Service

70 marks, while Part II (Avinash’s Part) covers 30 marks in this test.
Assignment Writing Service

2. Questions 1-4 are for Part I and the rest are Part II.
Assignment Writing Service

  1. The maximum score on this test is 100 marks. Assignment Writing Service

  2. Weighting is 50%. Assignment Writing Service

  3. Show all code for Questions 5 and 6. Assignment Writing Service

  4. Write answer in the box provided. Assignment Writing Service

  5. Answers should be legible. Assignment Writing Service

1. Answer the following questions related to the process algebra CCS (20 Marks): Assignment Writing Service

(a) Consider two processes P,Q shown in Figure 1. Are these processes bisimilar, weakly bisimilar, similar or there is no relationship between them? Justify your selection mat- hematically by either finding the corresponding relation or showing the absence of any such relation. (5 Marks) Assignment Writing Service

(b) Consider two processes P and Q defined using system of Equations 1 and Equations 2 respectively. Draw the label transition system (LTS) corresponding to these two pro- cesses and then draw the LTS corresponding to P||Q (draw only up to the second-level successors). (10 Marks) Assignment Writing Service

P=a.P1+b.c.P2
Assignment Writing Service

P 2 =b . PQ =a . Q 1 Q 1 =a . Q
Assignment Writing Service

(c) Which is stronger: simulation or bisimulation and why? Justify using a suitable example. (5 Marks) Assignment Writing Service

2. Temporal logic and model checking (20 Marks) Assignment Writing Service

(a) Show all the steps of model checking the formula AF(¬P1∧¬P2)P3 over the model shown in Figure 2. Does, the model satisfy this property? (10 Marks) Assignment Writing Service

Figure 2: An example Kripke model
(b) Identify valid CTL formulae from the following with suitable justification. Convert the
Assignment Writing Service

valid formulae you identified into their equivalent forms that are just using adequate sets. Here, AP = {p1, p2, p3} and the converted formulae can only include temporal operators EX,EG,EU. (10 Marks)
Assignment Writing Service

(AG(p1AX(1p2)))AF(p1FG(p1Up2))
AF(p1AXp2) Assignment Writing Service

((AFpEGq)UEFp) Assignment Writing Service

3. Real-time systems and automata (20 Marks) Assignment Writing Service

Figure 3: Two automata Assignment Writing Service

(a) Let Σ = {a,b,c,d} and let A1,A2 be two automata as shown in Figure 3. Answer the following questions: (10 Marks) Assignment Writing Service

Draw the product automaton.
bbababis accepted by A1? Is this true or false? Justify.
bdabis accepted by A2? Is this true or false? Justify.
bbbbadcis accepted by A1TA2? Is this true or false? Justify. aabcdb Σ. Is this true or false? Justify. Assignment Writing Service

(b) In a timed automata which of the following are valid clock constraints and why? Assume that x,y,z are clocks. (5 Marks) Assignment Writing Service

i. z>=12x==20 Assignment Writing Service

iii. xy<=z iv. z==x+5 Assignment Writing Service

v. xz>=1000
(c) Distinguish between run-time verification and run-time enforcement. Which one is more suitable for securing pacemakers and why? (5 Marks) Assignment Writing Service

4. Short answer questions (10 Marks) Assignment Writing Service

  1. (a)  We studied some approaches for using run-time verification for securing pacemakers. Using a suitable diagram, explain how such a monitor works, without being able to access the pacemaker directly. Assignment Writing Service

  2. (b)  Provide an example property as a timed automaton, which can be used by a run-time verification monitor, to determine if a pacemaker has been hacked by using an ECG sensor? Assignment Writing Service

5. Prove that the swap1 and swap2 functions below return the same swapped values for all the same inputs a and b of type int. Encode the equivalence (validation) problem as SMT constraints in Z3 Python API. Show the Python code. (15 marks) Assignment Writing Service

def swap1(a, b): def swap2(a, b): tmp = b a = a + b
b=a b=a-b
a = tmp a = a - b return a, b return a, b
Assignment Writing Service

6. Figure 4 gives two FSMs executing currently on a single CPU. (1) Draw/give the asynchronous product of the two FSMs as a single FSM. (2) Model all the traces/paths of the asynchronous product FSM from (1) using Python Z3 API (see appendix later/below for API functions and their usage). (3) Pose the LTL safety property (¬((S1 == 1) (S2 == 1))), where S1 and S2 are integer (int) state variables, to Z3 using the Python API, so that it can check this property on the modelled traces from (2). Show all Python code and figures. (15 marks) Assignment Writing Service

Note: Assignment Writing Service

(a) You should need no more than 4 variables to model the traces and property. (b) This problem is called symbolic bounded model-checking. Assignment Writing Service

Figure 4: Two Finite State Machines (FSMs) running asynchronously on a single CPU. Integer type variables S1 and S2 capture the state value of FSMs. Assignment Writing Service

Example Z3 API function and usage Assignment Writing Service

from z3 import IntSort, Solver, sat, DeclareSort, Consts, ForAll, from z3 import Function, sat, Or, And, RealSort, Implies, Exists # Defining a new sort (type)
T = DeclareSort('T') Assignment Writing Service

# Defining a binary function that works with type T and returns int type

f = Function('f', T, T, IntSort()) # New object of type Solver
s = Solver()
# Defining two variables of type T a, b = Consts('a b', T) Assignment Writing Service

# Adding a forall example constraint to solver

s.add(ForAll([a, b], a >= b))
# Example of using Exists
s.add(Exists([a, b], a < b)
# Example of using Implies (a > 0 => b < 10) s.add(Implies(a > 0, b < 10)) Assignment Writing Service

# Example of using implies inside another operator

s.add(ForAll([a, b], Implies(a > 10, b < 100)))
# Defining Variables of type Int
x, y = Consts('x y', IntSort())# Defining Variables of type Real (float)
Assignment Writing Service

j, k = Consts('j k', RealSort())  Assignment Writing Service

# Adding example constraint of variables j and k

s.add(And(Or(j + k > 10.90, j - k < 10/80), j * k == 90.3)) # Checking if a solution exists Assignment Writing Service

ret = s.check() if ret == sat: Assignment Writing Service

print(s.model()) # Print the result of check if sat Assignment Writing Service

联系辅导老师!
私密保护
WeChat 微信
Auckland代写,COMPSYS 705代写,Formal Methods for Safety Critical Software代写,Auckland代编,COMPSYS 705代编,Formal Methods for Safety Critical Software代编,Auckland代考,COMPSYS 705代考,Formal Methods for Safety Critical Software代考,Auckland代做,COMPSYS 705代做,Formal Methods for Safety Critical Software代做,Aucklandhelp,COMPSYS 705help,Formal Methods for Safety Critical Softwarehelp,Auckland作业代写,COMPSYS 705作业代写,Formal Methods for Safety Critical Software作业代写,Auckland编程代写,COMPSYS 705编程代写,Formal Methods for Safety Critical Software编程代写,Auckland作业答案,COMPSYS 705作业答案,Formal Methods for Safety Critical Software作业答案,