, ,

[SOLVED] Compsys705 exam p0

$25

File Name: Compsys705_exam_p0.zip
File Size: 169.56 KB

Categories: , , Tags: , ,
5/5 - (1 vote)

2. Questions 1-4 are for Part I and the rest are Part II.Add
4. Weighting is 50%.
5. Show all code for Questions 5 and 6.
6. Write answer in the box provided.
7. Answers should be legible.

Figure 1: Two CCS Processes


P=a.P1+b.c.P2
https://.comP.P (1)

P2=b.P
Add
Q
(2)

Q1=a.Q
Answer box for Q1

Add
Answer box for Q1 continued

Add

Figure 2: An example Kripke model
(b) Identify valid CTL formulae from the following with suitable justification. Convert the 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
• (AG(p1 ⇒https://.comAX(p1∧ p2)))
• AF(p1 ⇒ FG(p1Up2))
• AF(p1 ⇒ AXp2) • ((AFp ⇒Add assignmentchefEGq)UEFp)
Answer box for Q2

Add
Answer box for Q2 continued

Add

Figure 3: Two automata
(a) Let Σ= {a,b,c,d} and let A1,A2 be two automata as shown in Figure 3. Answer the following questions:
• bbabab∗ is accepted by A1? Is this true or false? Justify.
• b∗d∗a∗b∗ is accepted by A2? Is this true or false? Justify.
• bbbb∗a∗d∗c∗ is accepted by A1TA2? Is this true or false? Justify.
• aabc∗d∗b ∈ Σ∗. Is this true or false? Justify.
(b) In a timed automata which of the following are valid clock constraints and why? AssumeAssignment
i. z >=12∧x==20
ii. x iv. z==x+Add assignmentchef5
iii. x−y <=z
v. x−z >=1000
Answer box for Q3

Add
Answer box for Q3 continued

Add
(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.
(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?

Add
Answer box for Q4

Add
Answer box for Q4 continued

Add
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

Add
Answer box for Q5

Add
Answer box for Q5 continued

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

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.

Add
Answer box for Q6

Add
Answer box for Q6 continued

Add
Example Z3 API function and usage
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’)
# 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)
# 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))
# 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())
# Adding example constraint of variables x and yAssignment Project Exam Help s.add(And(Or(x + y > 10, x – y < 100), x * y == 90))
# Defining Variables of type Real (float) j, k = Consts(‘j k’, RealSort())
# 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 existsAdd ret = s.check() if ret == sat:
print(s.model()) # Print the result of check if sat Scratch Pad

Add
Scratch Pad

Add

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Compsys705 exam p0[SOLVED] Compsys705 exam p0
$25