Logical operators

 BBS: Inland Empire Archive
Date: 04-07-92 (01:07)             Number: 179
From: MICHAEL POKRIEFKA            Refer#: NONE
  To: JIM WELLS @ 930/21            Recvd: NO  
Subj: Logical operators              Conf: (2) Quik_Bas
In a message of <Apr 03 18:12>, Jim Wells @ 930/21 (1:10/8) writes:

BW>     Could you shed some light on IMP?  I see how to use
BW>the others, but how is IMP used?  I've never seen it used
BW>(so maybe it isn't!)

 JW>   IMP, Bill, is both a logical and arithmatic operator. Its
 JW> logical function returns a value of false (0) only if its first
 JW> operand is true and its second operand is false.

 JW>   Here's a truth table for it:

 JW>         x        y        xIMPy
 JW>        -------------------------
 JW>         1        1          1
 JW>         1        0          0
 JW>         0        1          1
 JW>         0        0          1

 JW>   IMP stands for implication as in a statement is TRUE if the
 JW> value of the first operand implies the value of the second.

A point about the logical operators as they are used in formal logic:
The use of the word 'implication' is regretable. (This is no slam against you,
Jim, I know you're using terms is a way that has become standard. It's the
standard I want to inveigh against). As far as I know, this
use of the word
'implication' goes back to a pioneering work on formal
logic called _Principia Mathematica_ published by Alfred
North Whitehead and Bertrand Russell in 1910.
It invites confusion between two quite distinct notions:
logical implication and (borrowing another _Principia_
usage) material implication. What Jim describes above is
material implication. In formal languages developed for
logic this statement connective is often written using an
arrow (I'll type
'-->' as an approximation). Thus, where 'A' and 'B' are
'-->sentences, '(A --> B)',
is read "If A then B", or, as I prefer, "A only if B". The connective '-->'
has the truth table that Jim gives above. Just replace 'x' with 'A', 'y' with
'B', and 'xIMPy' with '(A --> B)'. Logical implication, by way of contrast, is
not a statement connective at all. It does not join two statements to make a
longer statement. It joins the names of statements and
asserts that a special logical relation holds between the

statements named. (The usual convention for naming
expressions is similar to the one used in QB programming.
We enclose the
expression in single quotes. Hence, 'Boston' names a word,
viz., the word within the quotes, whereas the word without
the quotes names a city). In formal logic, logical
implication is often written using a double arrow (I'll type
'==>' as an approximation). A statement 'A' logically implies a statement 'B'
just in case every assignment of truth to 'A' also assigns truth to 'B'.
There is a relationship between '-->' and '==>':

       'A' ==> 'B' if and only if '(A --> B)' is logically true

where a statement is _logically true_ just in case it is
assigned truth in every row of it's truth table. 'A OR NOT
A' is an example of a logical truth:

               A    NOT A    (A OR NOT A)
               --------------------------
               1     0           1
               0     1           1

Regards,
Michael

--- msgedsq 2.0.4
 * Origin: Michael's Bar and Grill (1:226/70.1)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET