Pages

Tuesday, March 19, 2013

IMP operator

IMP operator

Purpose

The IMP operator works as both a logical and a bitwise arithmetic operator.

Syntax

p IMP q

Remarks

IMP as a logical operator

The IMP operator returns FALSE (zero) if and only if its first operand is TRUE (non-zero), and its second operand is FALSE.  In all other cases, it returns TRUE.

Truth table

x

y

x IMP y

T

T

T

T

F

F

F

T

T

F

F

T

Using IMP as a bitwise arithmetic operator

IMP is seldom used as a bitwise arithmetic operator, but here is a sample:

 

 

The IMP (IMPlies) operator is used when you want to limit access to a certain "privilege". For example, if you have a swimming pool but you don't want anyone entering it when the guard is not present. So you let Q=Guard is Present and P=Pool is accessible. If Q is false (guard is not there), the formula (P IMP Q) will always be false, ensuring safety of pool users.

No comments:

Post a Comment