Exercises

10 i think

UPPAAL says it is.

task 2

flowchart LR

boolIN --> x(if y)
x -->|true| x1(out = x)
x -->|false| x2(out = 0)
x1 --> x3(x = in)
x2 --> x3
x3 --> invertY(y = !y)


flowchart LR

start(bool x = 0) -.-> O
O(0) -->|out:= 0; x:=in| I(1)
I -->|out:=x; x:=in| O

Valid uppaal file located here play with it to figure things out

task 3

So what they are asking us to do is make a new machine thingy called a mealy machine. Its stupid and looks like this, Where the LEFT = 0, and the RIGHT = 1

If you look at the bottom left arrow and the top middle arrow you can see that if you get a “1” you can either replace x value with 1 which moves us to the right, or you can keep the old x value 0 and stay at 0.

Same for the bottom right and bottom middle. If you get a “0” you can either keep x at 1, or change it to a 0.

task 4

if req1 == true:
	if req2 == true:
		b = choose(1,2)
		if b == 1:
			grant1
		else:
			grant2
	else:
		return grant1
else if req2 == true:
	return grant2