Integer equivalent of If-conditions

60 Views Asked by At

I had found the following statements to find integer equivalent of the if statement which I have lost. However, I have tried to recall those statements and tried to prove them all. Can the community check whether all these statements and proofs are correct or not?

suppose, $~m \leq x-y \leq M$, $~m \in (-\infty,0]$, $~M \in [0,\infty)$, $~\epsilon \rightarrow 0^{+}$, and, $~ z \in \lbrace 0,1\rbrace$.

(i) $\text{if}~ x \geq y,~ \text{then,}~ z = 1$; equivalent to, $x - y \leq Mz -\epsilon (1-z)$

Proof: $Mz -\epsilon (1-z) \geq x - y \geq 0 ~~\text{(suppose by definition)} \implies (M + \epsilon)z -\epsilon \geq 0 \implies z = 1$

(ii) $\text{if}~ x < y,~ \text{then,}~ z = 0$; contrapositive to, $\text{if}~ z = 1,~ \text{then,}~ x \geq y$; equivalent to, $x - y \geq m(1 - z)$

Proof: $x - y \geq m(1 - z) = 0~~\text{(suppose by definition)} \implies x \geq y$

(iii) $\text{if}~ x \leq y,~ \text{then,}~ z = 1$; equivalent to, $x - y \geq mz +\epsilon (1-z)$

Proof: $0 \geq x - y \geq mz +\epsilon (1-z) ~~\text{(suppose by definition)} \implies 0 \geq (m - \epsilon)z +\epsilon \implies z = 1$

(iv) $\text{if}~ x > y,~ \text{then,}~ z = 0$; contrapositive to, $\text{if}~ z = 1,~ \text{then,}~ x \leq y$; equivalent to, $x - y \leq M(1 - z)$

Proof: $x - y \leq M(1 - z) = 0~~\text{(suppose by definition)} \implies x \leq y$

(v) $\text{if}~ x \leq y,~ \text{then,}~ z = 0$; equivalent to, $x - y \geq m(1-z) +\epsilon z$

Proof: $0 \geq x - y \geq m(1-z) +\epsilon z ~~\text{(suppose by definition)} \implies 0 \geq -(m - \epsilon)z + m \implies z = 0$

(vi) $\text{if}~ x > y,~ \text{then,}~ z = 1$; contrapositive to, $\text{if}~ z = 0,~ \text{then,}~ x \leq y$; equivalent to, $x - y \leq Mz$

Proof: $x - y \leq Mz = 0~~\text{(suppose by definition)} \implies x \leq y$

(vii) $\text{if}~ x \geq y,~ \text{then,}~ z = 0$; equivalent to, $x - y \leq M(1 - z) -\epsilon z$

Proof: $M(1 - z) -\epsilon z \geq x - y \geq 0 ~~\text{(suppose by definition)} \implies -(M + \epsilon)z +M \geq 0 \implies z = 0$

(viii) $\text{if}~ x < y,~ \text{then,}~ z = 1$; contrapositive to, $\text{if}~ z = 0,~ \text{then,}~ x \geq y$; equivalent to, $x - y \geq mz$

Proof: $x - y \geq mz = 0~~\text{(suppose by definition)} \implies x \geq y$

Tabularizing all the results:

\begin{array}{|c|c|c|} \hline \text{if-condition} & \text{Contrapositive statement for strict inequality} & \text{Integer equivalent} \\ \hline \text{if}~ x \geq y,~ \text{then,}~ z = 1 & & x - y \leq Mz -\epsilon (1-z) \\ \hline \text{if}~ x \geq y,~ \text{then,}~ z = 0 & & x - y \leq M(1 - z) -\epsilon z \\ \hline \text{if}~ x \leq y,~ \text{then,}~ z = 1 & & x - y \geq mz +\epsilon (1-z) \\ \hline \text{if}~ x \leq y,~ \text{then,}~ z = 0 & & x - y \geq m(1-z) +\epsilon z \\ \hline \text{if}~ x < y,~ \text{then,}~ z = 0 & \text{if}~ z = 1,~ \text{then,}~ x \geq y & x - y \geq m(1 - z) \\ \hline \text{if}~ x < y,~ \text{then,}~ z = 1 & \text{if}~ z = 0,~ \text{then,}~ x \geq y & x - y \geq m z \\ \hline \text{if}~ x > y,~ \text{then,}~ z = 0 & \text{if}~ z = 1,~ \text{then,}~ x \leq y & x - y \leq M(1 - z) \\ \hline \text{if}~ x > y,~ \text{then,}~ z = 1 & \text{if}~ z = 0,~ \text{then,}~ x \leq y & x - y \leq Mz \\ \hline \end{array}

N.B.: If someone knows of any reference, please let me know. I will appreciate that.