Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(5) Consider the following two fragments of code: Fragment 1 Fragment 2 if (-AV B) then { if (-AA-B) then {P{ } else { if
(5) Consider the following two fragments of code: Fragment 1 Fragment 2 if (-AV B) then { if (-AA-B) then {P{ } else { if (B) then {P2} else {P3} if (-A1-B) then {P1} else { if (-B) then {P{} else {P2} else {P4} (a) For Fragment 1, express in propositional logic the conditions under which each of the blocks of code P1, P2, P3, and P4 will be executed. Do not simplify for this part. (b) For Fragment 2, express in propositional logic the conditions under which each of the blocks of code P1, P2, P3, and P4 will be executed. Do not simplify for this part. (C) Give equivalence proofs to show that Fragment 1 and Fragment 2 have the same behavior. For any unreachable (dead) code, give an equivalence proof that the condition under which the code would be executed is a contradiction (equivalent to false). For any reachable code, give an equivalence proof that the conditions under which the code would be executed are equivalent in both fragments. State each law of propositional logic that you use. Provide detailed explanations for your answer, and justify any claim you make
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started