Posts: 3226
Threads: 244
Joined: April 17, 2012
Reputation:
54
Inclusive OR? Wtf?
May 29, 2014 at 1:06 pm
I'm studying propositional logic and I learned that "or" means "at least one is true". So you could have "a or b" and even if both a and b were each true then "a or b" is still true. In everyday language however "or" means only one of two things can be true, not both hence the reason we have the phrase "and/or" to mean "at least one is true".
Why not just keep the traditional exclusive meaning of "or" in propositional logic and then have another symbol for "and/or"? Seems simpler to me.
My ignore list
"The lord doesn't work in mysterious ways, but in ways that are indistinguishable from his nonexistence."
-- George Yorgo Veenhuyzen quoted by John W. Loftus in The End of Christianity (p. 103).
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
46
RE: Inclusive OR? Wtf?
May 29, 2014 at 1:18 pm
(May 29, 2014 at 1:06 pm)Tea Earl Grey Hot Wrote: I'm studying propositional logic and I learned that "or" means "at least one is true". So you could have "a or b" and even if both a and b were each true then "a or b" is still true. In everyday language however "or" means only one of two things can be true, not both hence the reason we have the phrase "and/or" to mean "at least one is true".
Why not just keep the traditional exclusive meaning of "or" in propositional logic and then have another symbol for "and/or"? Seems simpler to me. In computers, there are usually 3 logic operators: OR, NOT, AND. There's also the bitwise operator, XOR, which is what you are talking about.
I think the way they have it makes sense. A girl will go out with a man if he has a sexy body or a lot of money. Saying she will also go out with him if he has a sexy body AND a lot of money seems a little too redundant.
Posts: 1152
Threads: 42
Joined: July 8, 2013
Reputation:
23
RE: Inclusive OR? Wtf?
May 29, 2014 at 1:52 pm
(May 29, 2014 at 1:06 pm)Tea Earl Grey Hot Wrote: I'm studying propositional logic and I learned that "or" means "at least one is true". So you could have "a or b" and even if both a and b were each true then "a or b" is still true. In everyday language however "or" means only one of two things can be true, not both hence the reason we have the phrase "and/or" to mean "at least one is true".
Why not just keep the traditional exclusive meaning of "or" in propositional logic and then have another symbol for "and/or"? Seems simpler to me.
I don't see the problem. I'm more experienced in programming logic and OR's usage is quite necessary, so lemme give you an example.
Let's say on a social networking site, I want the login/user system to distinguish Admins and Moderators from normal users, so as to allow entry to certain parts of the site only for the Admins and Mods. Well, one easy way I could do this is to only allow entry to the site if the user's row in the database has its user type set to either "admin" or "mod":
Quote:<?php
$usertype = $row['usertype'];
if($usertype === 'admin' || 'mod'){
// Do shit
}
else{ header('Location: home.php'); } // kick 'em to another file
?>
Using OR here allows me to set the parameters which to check for, though it's not the only.
"The reason things will never get better is because people keep electing these rich cocksuckers who don't give a shit about you."
-George Carlin
Posts: 31021
Threads: 204
Joined: July 19, 2011
Reputation:
141
RE: Inclusive OR? Wtf?
May 29, 2014 at 2:05 pm
(This post was last modified: May 29, 2014 at 2:13 pm by Jackalope.)
(May 29, 2014 at 1:06 pm)Tea Earl Grey Hot Wrote: I'm studying propositional logic and I learned that "or" means "at least one is true". So you could have "a or b" and even if both a and b were each true then "a or b" is still true. In everyday language however "or" means only one of two things can be true, not both hence the reason we have the phrase "and/or" to mean "at least one is true".
Why not just keep the traditional exclusive meaning of "or" in propositional logic and then have another symbol for "and/or"? Seems simpler to me.
It greatly simplifies things to have two different operators for OR and XOR. Otherwise, the nonexclusive OR would have to be written as " if (a or b) or (a and b)". In my experience, the nonexclusive OR is much more commonly used.
In computer languages, the lack of a non-exclusive or would also make some operations less optimal - something like:
if (null == s || s.equals("")) {
// some operation
}
Would be extremely cumbersome to write as a single check. You'd have to do something like this to make it's meaning apparent:
if (null == s) {
// some operation
} else if s.equals("") {
// same operation
}
There's no straightforward way to code it using a nonexclusive or without the code throwing a null pointer exception.
Posts: 3226
Threads: 244
Joined: April 17, 2012
Reputation:
54
RE: Inclusive OR? Wtf?
May 29, 2014 at 2:11 pm
(This post was last modified: May 29, 2014 at 2:13 pm by Tea Earl Grey Hot.)
(May 29, 2014 at 2:05 pm)Cthulhu Dreaming Wrote: (May 29, 2014 at 1:06 pm)Tea Earl Grey Hot Wrote: I'm studying propositional logic and I learned that "or" means "at least one is true". So you could have "a or b" and even if both a and b were each true then "a or b" is still true. In everyday language however "or" means only one of two things can be true, not both hence the reason we have the phrase "and/or" to mean "at least one is true".
Why not just keep the traditional exclusive meaning of "or" in propositional logic and then have another symbol for "and/or"? Seems simpler to me.
It greatly simplifies things to have two different operators for OR and XOR. Otherwise, the nonexclusive OR would have to be written as " if (a or b) or (a and b)". In my experience, the nonexclusive OR is much more commonly used. In propositional logic, you actually have to write "(a or b) and not (a and b)" to mean exclusive or. There's no symbol for it.
Quote:“(P v Q)” claims that at least one part is true. So “I went to Paris or I went to Quebec” is true just if I went to one or both places. Our “v” symbolizes the inclusive sense of “or”; English also can use “or” in an exclusive sense, which claims that at least one part is true but not both. Both senses of “or” can translate into our symbolism:
• Inclusive “or”: A or B or both = (A v B)
• Exclusive “or”: A or B but not both = ((A v B) · ~(A · B))”
Excerpt From: Harry J. Gensler. “Introduction to Logic: Second Edition.” iBooks. https://itunes.apple.com/WebObjects/MZSt...=495640131
My ignore list
"The lord doesn't work in mysterious ways, but in ways that are indistinguishable from his nonexistence."
-- George Yorgo Veenhuyzen quoted by John W. Loftus in The End of Christianity (p. 103).
Posts: 31021
Threads: 204
Joined: July 19, 2011
Reputation:
141
RE: Inclusive OR? Wtf?
May 29, 2014 at 2:17 pm
(May 29, 2014 at 2:11 pm)Tea Earl Grey Hot Wrote: In propositional logic, you actually have to write "(a or b) and not (a and b)" to mean exclusive or. There's no symbol for it.
Quote:“(P v Q)” claims that at least one part is true. So “I went to Paris or I went to Quebec” is true just if I went to one or both places. Our “v” symbolizes the inclusive sense of “or”; English also can use “or” in an exclusive sense, which claims that at least one part is true but not both. Both senses of “or” can translate into our symbolism:
• Inclusive “or”: A or B or both = (A v B)
• Exclusive “or”: A or B but not both = ((A v B) · ~(A · B))”
Excerpt From: Harry J. Gensler. “Introduction to Logic: Second Edition.” iBooks. https://itunes.apple.com/WebObjects/MZSt...=495640131
Formal propositional logic isn't my thing, but programming is - the above is precisely why I'm glad we have separate operators for the two classes of OR in programming languages.
It is inconvenient that the meaning is different from ordinary English usage, but that's not all that unexpected - it's not uncommon to find that words take more specific meanings in specialized disciplines (compare the common and scientific use of "theory", for example).
Posts: 15
Threads: 2
Joined: November 11, 2013
Reputation:
0
RE: Inclusive OR? Wtf?
June 4, 2014 at 4:50 am
(May 29, 2014 at 1:18 pm)bennyboy Wrote: (May 29, 2014 at 1:06 pm)Tea Earl Grey Hot Wrote: I'm studying propositional logic and I learned that "or" means "at least one is true". So you could have "a or b" and even if both a and b were each true then "a or b" is still true. In everyday language however "or" means only one of two things can be true, not both hence the reason we have the phrase "and/or" to mean "at least one is true".
Why not just keep the traditional exclusive meaning of "or" in propositional logic and then have another symbol for "and/or"? Seems simpler to me. In computers, there are usually 3 logic operators: OR, NOT, AND. There's also the bitwise operator, XOR, which is what you are talking about.
I think the way they have it makes sense. A girl will go out with a man if he has a sexy body or a lot of money. Saying she will also go out with him if he has a sexy body AND a lot of money seems a little too redundant.
There's also technically NAND and NOR, which are inverted, and XNOR, which is also inverted. Also, there's technically the ON and OFF gates which are always on or off, respectively.
Posts: 30102
Threads: 116
Joined: February 22, 2011
Reputation:
158
RE: Inclusive OR? Wtf?
June 4, 2014 at 3:24 pm
(This post was last modified: June 4, 2014 at 3:25 pm by Angrboda.)
Here I had been thinking to myself that it would be better for me to go after a degree in psychology rather than a degree in computer engineering, however the thought of designing logic circuits excites me. Back when I was in school, most logic assemblies were built out of NAND gates, as that was the simplest and most cost-efficient gate / transistor design. Maybe that's changed, I don't know.
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
46
RE: Inclusive OR? Wtf?
June 6, 2014 at 4:06 am
(June 4, 2014 at 3:24 pm)rasetsu Wrote: Here I had been thinking to myself that it would be better for me to go after a degree in psychology rather than a degree in computer engineering, however the thought of designing logic circuits excites me. Back when I was in school, most logic assemblies were built out of NAND gates, as that was the simplest and most cost-efficient gate / transistor design. Maybe that's changed, I don't know.
Ever played the game called Robot Oddyssey?
It's for the Apple IIe, and you can get it with an emulator. In this game, you have to design robots to take in more-and-more complex inputs from their environment, and produce puzzle-solving behaviors using the logic gates. Best game ever.
|