19

I'm reading some Perl documentation. I noticed that "=" is not expressed as "equals" but as "or". For example:

Perl provides the typical ordinary addition, subtraction, multiplication, and division operators, and so on. For example:
2 + 3 # 2 plus 3, or 5
5.1 – 2.4 # 5.1 minus 2.4, or 2.7
3 * 12 # 3 times 12 = 36
14 / 2 # 14 divided by 2, or 7

Why are they using "or" to express "equals"? Is this common in mathematics?

Note that the '#' symbol means everything after it is a comment. I'm only querying on the explanation of equal, not discussing Perl here, however if you're interested in that you may find the original e-book from here to take a deep reference: http://it-ebooks.info/book/361/

6
  • 1
    It is worth noting that the Perl compiler will optimize mathematical operations such as + on constant items (like magic numbers) at compile time, so it really doesn't matter much if the code says 2 + 3 or 5. It just gets calculated and optimzed out once, as opposed to calculating with variables, which happens at runtime.
    – simbabque
    Sep 8, 2015 at 11:30
  • 3
    Can you please attribute the source of this documentation? I'd like to take a look at it. You can edit your question.
    – simbabque
    Sep 8, 2015 at 11:31
  • 11
    It's not about Perl, it's about the construction "this expression, or X". Another way to word it is "this expression, which is equivalent to X".
    – ColleenV
    Sep 8, 2015 at 13:19
  • 1
    Good question. I remember finding that usage of "or" confusing when I first encountered it, and I'm a native American English speaker! Sep 8, 2015 at 17:00
  • @under my little excursion on perl was meant as an additional explanation of why this particular case of the English word or can be used in the given context.
    – simbabque
    Sep 9, 2015 at 4:37

5 Answers 5

60

In this document, "or" is being used according to the fifth definition listed by the Oxford Learner's Dictionaries:

used to introduce a word or phrase that explains or means the same as another

  • geology, or the science of the earth’s crust
  • It weighs a kilo, or just over two pounds.

It's saying that "2 + 3" means "2 plus 3," which means the same as "5."

The word "or" is not used to mean "equals" in mathematics. "Two plus three equals five" can be a complete sentence; it is a statement of an equality. "Two plus three, or five" cannot be a complete sentence; it is a noun phrase referring to a numerical quantity. You could use it as the answer to a question.

3
  • 5
    Speed limit on this road is 75mph, or 120kph. Sep 9, 2015 at 6:27
  • 3
    And to note that the documentation is inconsistent. It should use or in all four cases or use = not a mix. Sep 9, 2015 at 15:35
  • 2
    +1, but it's a bit misleading to say that "two plus three equals five" is a complete sentence and leave it at that. It's quite common to use expression = result in exactly the way that the OP has in mind; for example, a Google search for "there are 2 · 3 = 6" finds plenty of uses of this type.
    – ruakh
    Sep 10, 2015 at 8:08
8

It says that the expressions on the left-hand side of hash sign can be expressed by two ways, one way is the meaning of the expression and the other way is the result of the expression.

6

This is a response to the original question, namely, "Why does or mean = in mathematics?"

Your question is based on a false premise. In mathematics, "or", formally symbolised as , does not mean "=".

In everyday usage, or and = may have similar meanings, as @sumelic points out.

In logic or in mathematical logic, however, they have distinct meanings. There, "or" is a logical operator that has the value, True, if one or both operands are true. For example 3 < 2 or 3 > -1 is true because the operand on the right, namely, 3 > -1, is True.

In mathematics, the equals sign, =, signifies that the terms on each side have the same value. This is more subtle than it may first appear to be. 3 + 1 = 4 is a well-formed and True statement. 3 + 1 = 0 is a well-formed statement that is False.

When variables enter the scene, things get trickier.
For example, the equation

x^2 + 6 = 5*x*, where x is defined, say, over the real numbers,

does not mean that the function f(x) = x^2 + 6 is the same function as g(x) = 5x. The set of ordered pairs, (x, f(x)) is different from the set of ordered pairs, (x, g(x))l

x^2 + 6 = 5*x* stands for a solution set, that is, the values of x, if any, for which the functions have the same value. In this case, the solution set is {2}. This is because f(x) = g(x) if and only if x = 2.


4
  • 3
    It doesn't mean equals in math, but can be written to mean the same thing - in an imprecise and rather ill-advised way. It's also worth mentioning the computing-specific bitwise-or operation, another one the OP might see sometime - including in languages like Perl, which would make the original excerpt even more ambiguous and confusing. Also, in some programming languages, == means test equality, but = means assignment. We're entering a varied world of ambiguity, where local rules are key. But confining ourselves to English, again, it was just a bad choice to use or to mean = or i.e. Sep 8, 2015 at 12:32
  • Good points, especially about equals as assignment in many programming languages.
    – DavidC
    Sep 8, 2015 at 12:41
  • 3
    Sorry, but I don't think the use of "or" in the OP's quotation has anything to do with the formal logic use of the "or" operator. E.g., in 2 + 3 # 2 plus 3, or 5 there's no way that the Perl documentation is saying that the expression 2+3 in Perl is equivalent to 2 + 3 V 5. The latter looks like a Boolean algebra expression, but if it is one, then it evaluates to true. (I.e., while it's true that 2+3 in Perl, as in many languages, will get implicitly converted to true in a Boolean context, it's very unlikely that the documentation is trying to express that.) Sep 8, 2015 at 16:59
  • The OP originally asked, "Why does "or" mean "=" in Mathematics?" (or something very similar). That is the issue I addressed. My point was precisely that the meanings in Mathematics have nothing to do with the meanings in everyday informal settings. There is, of course, the other issue he raised, namely, "what do the statements in the manual mean?". I did not address that issue.
    – DavidC
    Sep 8, 2015 at 20:02
5

It may be helpful to think of the "or" in this case as having a meaning similar to "i.e." [Latin for id est, or literally "that is"], whose meaning is often encapsulated in the English phrases "that is to say", "otherwise known as", "in other words", etc. There are some categories of writing (e.g. legal documents) where the abbreviation "i.e." is used frequently, since many of the English replacements have other shades of meaning which may detract from the fundamental meaning of "i.e."--that what follows it is a restatement of what precedes it. Unfortunately, enough people confuse "i.e." with another two-letter expression "e.g." [Latin for exempli gratia, or literally "for the sake of an example"] that many writers prefer to replace those concise terms with more long-winded (and sometimes, as with the OP's cited text, confusing) English verbiage.

3

The word "or" is being used as a logical or, but in a possibly weird way.

The number between 4 and 6 can be represented as 2+3 or 5.

The logic operator or says either of the expressions surrounding the operator can be used. We are, in essence, saying they are equivalent, but that's a coincidence. A different use of the or operator may not be equivalent.

Tomorrow I will either do laundry or just sleep in.

The operator is being used in the book to say,

This expression is equivalent to either 2+3 or 5.

As others have pointed out, this is a little different from formal, mathematic logic. But it's the same basic concept.

To someone who isn't used to programming syntax, 14 / 2 might look like an or operator in normal writing. For example, you see things like,

Always remind the guy/girl that he/she still has to pay the bill.

Which means,

Always remind the guy (or girl) the he (or she) still has to pay the bill.

In this case, the slash symbol is a shorthand way of saying we don't care if it's a guy or girl, just tell whoever it is to pay the bill.

So the book makes sure novices are explicitly told that "14 / 2" represents a division operation rather than an or operator or anything else they might think. Then they're also told the result evaluates to 7, which both informs them that Perl division works like gradeschool division and that the result is a number, not a mathematical expression.

The construct "A means B, or C" is just a shorthand notation for saying "either 'A means B' or 'A means C' is true". In this case, both "A means B" and "A means C" are true, so the transitive principle of equality lets us infer "B means C" is also true, but it's not required by the grammar.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .