CS计算机代考程序代写 116 (a) §

116 (a) §
Prove or disprove
R. if b then P else Q fi = if b then R. P else R. Q fi
Let binary variable b be the only variable, let it initially be ⊥ , and let R = b:= ⊤ , let P = b:= ⊤ , let Q = b:= ⊥ . Then
(b) § (c) §
ifbthenP⇒QelseR⇒Sfi = ifbthenPelseRfi⇒ifbthenQelseSfi This is a case distributive law.
ifbthenP.QelseR.Sfi = ifbthenPelseRfi. ifbthenQelseSfi
Let binary variable b be the only variable, let it initially be ⊤ , let P be b:= ⊥ , Q be b:= ⊤ , R be ok , and S be b:= ⊥ . Then the left side is
if b then P. Q else R. S fi
= if⊤thenb:=⊥. b:=⊤elseok. b:=⊥fi
= b:=⊥.b:=⊤
= bʹ
And the right side is
ifbthenPelseRfi. ifbthenQelseSfi
= if⊤thenb:=⊥elseokfi. ifbthenb:=⊤elseb:=⊥fi
= b:=⊥. ifbthenb:=⊤elseb:=⊥fi
= if⊥thenb:=⊤elseb:=⊥fi
= b:=⊥
= ¬bʹ
= = = = = But
= = =
R. ifbthenPelseQfi
b:=⊤. ifbthenb:=⊤elseb:=⊥fi
ifb:=⊤. bthenb:=⊤. b:=⊤elseb:=⊤. b:=⊥fi if⊤thenb:=⊤elseb:=⊥fi
b:=⊤

if b then R. P else R. Q fi
if ⊥ then b:= ⊤. b:= ⊤ else b:= ⊤. b:= ⊥ fi b:=⊤.b:=⊥
¬bʹ