# Homework 3 (FCS)
# Ex 1

This system is not secure because any commands executed by either H or L will affect the end state of L. For example, if H executes xor1 it will change the state of L, while also changing its own state.
The diagram covers all possible states that is mentioned in the table. Example: At the start the initial input state s1 is (0,0) and H inputs a command of xor1, the state changes to s2 where it is (1,1). If another command xor0 is executed by L, the state will return to (1,1) which is in this case s2.
# Ex 2

This system seem to be secure for all cases as the commands that H executes do not change the state of L and vice versa. There is no possible path for H or L to change each other's states using only their alloted commands.
For an example, assume that the initial state is (0H,0L), if H were to execute xor1 only H the state of H would be changed in the process making the next state (1H,0L). From there, if L were to execute xor0 the next state would be (1H,0L) as there is no change for H and the end state for L would be the same.
# Ex 3
$S = \{ Heidi, Lucy \}$, where
>Heidy can read both high and low bits
>Lucy can only read low bits
$Σ = \{{ (0,0), (0,1), (1,0), (1,1) }\}$ are the state space.
$C = \{ xor0, xor1 \}$
Let $σ0 = (1,0)$
$c_s = \{(Heidi, xor1), (Lucy, xor0), (Lucy, xor1), (Heidi, xor0)\}$
$proj(Heidi, c_s, σ_0)$ = $01$ $01$ $10$ $10$
$π_{Lucy, xor0} (c_s)$ = $\{(Heidi, xor1), (Lucy, xor1), (Heidi, xor0)\}$
# Ex 4

allie has
>[HIGH, LOW] level
>[EAST, WEST] category
son has
>[TS, S, LOW] level
>[EAST, SOUTH] categories
Combined

# Ex 5
$x:= y + z$; where
• $y = 0$ or $1$ with equal probability
• $z = 1$ with probability $\frac{1}{2}$ while $z = 2$ or $3$ with probability $\frac{1}{4}$ each
s and t are states before and after command executed, respectively. Calculate
$H(y_s|x_t)$ and $H(z_s|x_t)$. Is there information flow from y to x, and from z to x?
```csvpreview
x Total, 1,2,2,3,3,4
y,0,0,1,0,1,1
z,1,2,1,3,2,3
```
Note:
$H(y_s|x_s)$ does not exists hence, $H(y_s|x_s) = H(y_s) = -2*0.5*lg(0.5) = 1$
$H(z_s|x_s)$ does not exists hence, $H(z_s|x_s) = H(z_s) = -0.5*lg(0.5)-2*0.25*lg(0.25) =1.5$
-------------------------------------------------------------------------
$H(y_s|x_t) =-Σ^4_{t=1} P(X=x_t) [ Σ^1_{s=0} P(Y=y_s|X=x_t) lg P(Y=y_s|X=x_t) ]$
$H(y_s|x_t) = -[0.25*(0 + 0)+ (0.375)* \frac{0.5*0.25 * lg(\frac{1}{3}) + 0.5*0.5 lg(\frac{2}{3})}{0.375}] +$
$(0.25)* \frac {0.5*0.25 lg (0.5)+ 0.5*0.25lg(0.5)} {0.25} + 0.5*0.25 *[0+0]$
$H(y_s|x_t) = -[0.5*0.25 * lg(\frac{1}{3}) + 0.5*0.5 lg(\frac{2}{3}) - 1/4]$
$H(y_s|x_t) = 0.594361$
-------------------------------------------------------------------------
$H(z_s|x_t)=-Σ^4_{t=1} P(X=x_t) [ Σ^3_{s=1} P(Z=z_s|X=x_t) lg P(Z=z_s|X=x_t) ]$
$H(z_s|x_t)= -[0.25*(\frac {0.5*0.5lg(0.5*0.5/0.25) + 0+0}{0.25}) +$
$(0.5*0.5 +0.5*0.25) *\frac {0.5*0.5 *lg(0.5*0.5/0.375)+0.25*0.5*lg(0.25*0.5/0.375) + 0 }{0.375} +$
$(0.5*0.25+0.5*0.25) * [0 + \frac {0.25*0.5 * lg (0.25*0.5/0.25) + 0.25*0.5 *lg (0.25*0.5/0.25)} {0.25}]] +$
$(0.5 * 0.25) *(\frac {0.5*0.25 lg(0.25*0.5/0.25*0.5)} {0.25*0.5})$
$H(z_s|x_t)=-[0 +0.25*lg(2/3) + 1/8 lg(1/3) + (- 1/4) + 0]$
$H(z_s|x_t)=0.5943609$
---------------------------------------------------------------------------
$H(y_s|x_t) < H(y_s|x_s)$ shows information flow from y to x
$H(z_s|x_t) < H(z_s|x_s)$ shows information flow from z to x