in Mathematical Logic edited by
9,324 views
42 votes

"If $X$ then $Y$ unless $Z$" is represented by which of the following formulas in propositional logic? ("$\neg$" is negation, "$\land$" is conjunction, and "$\rightarrow$" is implication)

  1. $(X\land \neg Z) \rightarrow Y$
  2. $(X \land Y) \rightarrow \neg Z$
  3. $X \rightarrow(Y\land \neg Z)$
  4. $(X \rightarrow Y)\land \neg Z$
in Mathematical Logic edited by
9.3k views

4 Comments

X→ (¬ZY)

5
edited by

Basic Concept$:$  $ A$ Unless $B \Leftrightarrow  \neg B\rightarrow A$ (Conditional Statement)

                                                     $ \Leftrightarrow \neg(\neg B ) \vee A$

                                                    $ \Leftrightarrow  B \vee A$

                                                    $ \Leftrightarrow  A \vee B$

---------------------------------------------------------------------------------------------------

  • $P\rightarrow Q\equiv\neg P \vee Q$
  • $Q$ Unless $\neg P\equiv P\rightarrow Q$                                       
39
good trick sir ...thanks lakshman sir
1
it helped me thanks..!
1

Subscribe to GO Classes for GATE CSE 2022

9 Answers

69 votes
 
Best answer

Answer is a) $(X \land \lnot Z)\to Y$

(refer page 6,7 Discrete Math,ed 7, Kenneth H Rosen)

Implication "$P$ implies $Q$" i.e., $(p \to Q)$, where $P$ is Premise and $Q$ is Conclusion, can be equivalently expressed in many ways. And the two equivalent expression relevant to the question are as follows:

  1. "If $P$ then $Q$"
  2. "$Q$ unless $\lnot P$" 


Both of these are equivalent to the propositional formula $(P \to Q)$,

Now compare "If $X$ then $Y$ unless $Z$" with  "$Q$ unless $\lnot P$" , here $(\lnot P = Z)$ so $(P = \lnot Z)$ and $(Q = Y)$

Compare with "if $P$ then $Q$", here $(P = X) , (Q= Y)$

So we get premise $P= X \text{ and } \lnot Z,$ conclusion $Q = Y$

Equivalent propositional formula $(X \land \lnot Z) \to Y$

PS: Someone messaged me that i have taken "If $X$ then ($Y$ unless $Z$)" in above explanation and how to know if we take "(If $X$ then $Y$) unless $Z$" or "If $X$ then ($Y$ unless $Z$)". So let me show that both way gives the same answer.

"(If $X$ then $Y$) unless $Z$"  $\equiv (X\to Y)$ unless $Z$

$$\begin{align}
&\equiv \lnot Z \to (X\to Y) \\
&\equiv \lnot Z\to (\lnot X \lor Y) \\
&\equiv Z \lor \lnot X \lor Y \\
&\equiv \lnot (X \land \lnot Z) \lor Y \\
&\equiv (X \land \lnot Z) \to Y
\end{align}$$

selected by

8 Comments

In Rosen, page:17,example:2, there is a similar question.

q:"you can ride roller coaster"
r:"you are under 4feet tall"
s:"you are older than 16"

For representing" you cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old"

(-q) if (r unless s)
(-q) if (-s --> r)
( -s --> r ) --> (-q) is the answer I"m getting, however, in the example he replaced unless with and not and gave answer (r ^ -s ) --> -q;

Now, which is correct?
2
Best explanation for this question.Thanks sourav.
0
edited by
Better Explanation ... Unless Can be treated as "OR"
3

@ShanthanK

Same problem with me

anyone explain??

1
edited by

@Lakshman Patel RJIT Found the explanation to this yet??

0
edited by

@

If you are riding a roller coaster either you are taller than 4 feet or older than 16 years old.

https://math.stackexchange.com/questions/1003705/how-can-this-english-sentence-be-translated-into-a-logical-expression

1

@ShanthanK and @Lakshman Patel RJIT

I am interpreting the sentence as (you cannot ride the roller coaster if you are under 4 feet tall) unless (you are older than 16 years old)

which gives (~q if r) unless (s)

which gives (r→ ~q) unless (s)

which gives (~s)→ (r→ ~q)          (using p→ q: q unless ~p)

which gives (~s ^ r )→ ~q           (using p→ (q→ r) = (p ^ q) → r )

which is the same as the ans given in Rosen book, i.e (r ^ ~s)→ ~q

NOTE: The only trick( that I feel) was in the last step

i.e, p→(q→r) = (p ^ q)→r  

This is also called as Exportation Law . ( You can google it  ;) )

If someone wants the proof of above, I am giving it here-

LHS:  p→ (q→ r) = p→ (~q v r)

                             =~p v (~q v r)

                             =(~p v~q) v r

                             =~(p ^ q) v r

                             =(p ^ q)→ r  : RHS

Correct me if I am wrong. Happy Learning guys.

5
Thanks for letting me know the exportation law.
0
68 votes
while ( not z )
{
if (X) then
    Y
}
or
unless( z ) 
{
if (X) then
    Y
}

this is what it means in programming. if you want to execute statement $Y$ then $X$ must be $\text{True}$ and $Z \text{False}$, which is equivalent to $(X\wedge \neg Z)Y.$

option (A).

edited by

7 Comments

Well explained
1
Someone please explain me this.
0
Cann't i write it as $xy + x'z$, if x is true then y else z
0
very beautifull & crisp explanation thank you @Vikrant sir
0
your code is not quite correct
0
Above code is a pseudo code → It is correct.
0

@aryavart

if, unless indicates conditional statements

while, until indicates loop statements

 

0
17 votes
The statement "If X then Y unless Z" means, if Z doesn't occur, X implies Y
i.e. ¬ Z→ (X→ Y), which is equivalent to Z∨ (X→ Y) (since P→ Q ≡ ¬ P∨ Q),
Which is then equivalent to Z∨ ( ¬X∨ Y). Now we can look into options which one matches with this.
So option A is (X∧ ¬ Z)→ Y = ¬ ((X∧ ¬ Z))∨ Y = ( ¬X∨ Z)∨ Y, which matches our expression.

So option A is correct.
by

1 comment

Z∨ ( ¬X∨ Y) =  (¬X∨ Z)∨ Y because OR is associative.

0
8 votes
I just to tried to simplify it more

Statement : IF X THEN Y UNLESS Z

we can write it like this (IF X THEN Y) UNLESS Z

whenever you see UNLESS  operator just keep in mind to replace it with "IF NOT " your work is half done

=> (IF X THEN Y) IF NOT Z

=> (IF X THEN Y) IF (NOT Z)

now see it falls in the form of Q if P which is another form of P->Q

=> ~Z -> (IF X THEN Y )

=> ~Z -> (X -> Y)

=> ~Z -> ( ~X ∨ Y)

=>~(~Z) ∨ ( ~X ∨ Y)

=> Z ∨ ~X ∨ Y

=> (Z ∨ ~X ) ∨ Y

=> ~ (~Z ∧ X ) ∨ Y

=>  (~Z ∧ X ) -> Y
3 votes
The statement “If X then Y unless Z” means, if Z doesn’t occur, X implies Y i.e. ¬Z→(X→Y), which is equivalent to Z∨(X→Y) (since P→Q ≡ ¬P∨Q), which is then equivalent to Z∨(¬X∨Y). Now we can look into options which one matches with this.

So option (a) is (X∧¬Z)→Y = ¬((X∧¬Z))∨Y = (¬X∨Z)∨Y, which matches our expression. So option A is correct.
3 votes

Option A is correct.

2nd interpretation....it is saying that if X happens then Y will happen otherwise Z will happen..So can we say that it means X and Z can not happen simultaneously because if X happens then output will be be Y not Z so can we also say that X happen and Z does not happen then output will be Y

( X ^ ~Z ) -> Y

edited by
1 vote

The statement “If X then Y unless Z” means, if Z doesn’t occur, X implies Y i.e. ¬Z→(X→Y), which is equivalent to Z∨(X→Y) (since P→Q ≡ ¬P∨Q), which is then equivalent to Z∨(¬X∨Y). Now we can look into options which one matches with this.

So option (a) is (X∧¬Z)→Y = ¬((X∧¬Z))∨Y = (¬X∨Z)∨Y, which matches our expression. So option A is correct.

1 vote

      X →(¬Z→Y)

⟹ ¬X ∨ (Z ∨ Y)

⟹ (¬ X ∨ Z) ∨ Y

⟹ ¬(X ∧ ¬Z) ∨ Y

⟹ (X ∧ ¬Z) → Y  So , (A)

1 vote

refer @varsha394 comment for knowing about exportation law. Now let's see its application in programming.

//(if X then Y) unless Z 
//(if X then Y) if not Z
//(if X then Y) if ~Z
//if ~Z then(if X then Y)

if(Z is not true)
{
    if(X is true)
    {
        print("Y is true") //Y is true
    }
}

//if X then (Y unless Z)
//if X then (Y if not Z)
//if X then (Y if ~Z)
//if X then (if ~Z then Y)

if(X is true)
{
    if(Z is not true)
    {
        print("Y is true") //Y is true
    }
}

//By Exportation law,we can write
//if X^~Z then Y
// X^~Z -> Y
if(X is true and Z is not true)
{
    print("Y is true")//Y is true
}

 

edited by
Answer:

Related questions

Ask
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true