6 ms·
If all marbles in a bag are black, and you take one marble out, are all marbles in the bag still black? The only logical answer is yes. It would be rather absu
by tromp 3y ago
If all marbles in a bag are black, and you take one marble out, are all marbles in the bag still black?
The only logical answer is yes.
It would be rather absurd to make an exception for the case where you start with one marble in the bag. That would make logical reasoning extremely cumbersome, for no benefit whatsoever.
- Eldt 3y agoThat's not an exception, that's a different situation...
- jackbrookes 3y agonot really marbles = (BlackMarble() for _ in range(random.randint(0, 10))) all(isinstance(m, BlackMarble) for m in marbles) Surely should always be true
- cedilla 3y agoIs it? If that case is so different, than the case with two marbles is also different - because removing the second-to-last marble will change will change the bag to be in that situation. But then, the case with three marbles is also different, and by induction you are left with only special cases. On the other hand, see the related statement "If all marbles in a bag are black, adding a red marble will result in a mixed bag" clearly fails for the empty bag. This isn't really a question of logic or mathematics. Mathematicians just use systems which are useful. And predicate logic, which has proven invaluable, would allow OP's claim.
- pixl97 3y agoEh, wouldn't the induction reduce to 0, 1, infinity?
- bowsamic 3y ago> If all marbles in a bag are black, and you take one marble out, are all marbles in the bag still black? > The only logical answer is yes. The only "logical answer" is "there are no marbles in the bag". If this must be cast to a boolean somehow, the only "logical answer" is no. There should be a discontinuity as the last black marble is removed. That isn't absurd at all
- jimmaswell 3y agoLook into formal boolean logic, specifically the "therefore" operator. (T->T)=T,(T->F)=F, but starting with a false premise always results in true. There's good reason for it and it makes other things work out how you'd expect. A marble is in the bag -> the marble is black = True, even if there are no marbles in the bag. You can consider the "all" method as asking for the truth value of "A marble is in the bag -> the marble is black"
- bowsamic 3y agoWhy should I consider the all function to be like that, rather than actually answering the question “are all the marbles black”? Also, why am I getting downvoted? I’m starting to realise that HN is not the place to come for intellectual discussion anymore if you have anything to say that isn’t immediate agreement. I guess dang has set a flag on my account that encourages others to downvote me, because I’m not sure what other explanation there is for how my comments have been treated recently
- shadowgovt 3y agoWith deepest respect: I can't speak to any other comments you've made, but on this thread the downvotes are almost certainly because you've stepped into a philosophical debate that has gone on for over 2,000 years in Western philosophy and more-or-less asserted "If this must be cast to a boolean somehow, the only 'logical answer' is no." I believe the community is interpreting that as a bit dismissive both of the contents of the post and philosophy in general; one of the field's goals is to get past what we feel ought to be the answer to establish some kind of framework where that must be the answer, and your assertion is a bit dismissive of the other viewpoint (which, FWIW, happens to be the modern orthodoxy; IIUC your preferred answer is the old orthodoxy that leads to logical paradoxes and has therefore been put on the shelf as less useful).
- stOneskull 3y agoi think it's a 'black marble bag'. you want to make sure it only ever has black marbles in it. so you do checks on it.. does the bag only contain black marbles? you want to check there's no non-black marbles.
- dragonwriter 3y agoIf all marbles in a bag are black, and you take one marble out, are all marbles in the bag white? The only logical answer is no. It would be rather absurd to make an exception for the case where you start with one marble in the bag... and yet: marbles = ["black"] marbles.pop() all(m=="white" for m in marbles) # => True
- bandyaboot 3y agoThough it feels strange to write this, the fact that all the marbles are white doesn't change the fact that they're all black...and transparent, and not marbles at all, etc...
- dragonwriter 3y agoRight, my point was pointing out a weakness in the style of explanation—that the same structure can be applied with similar intuitive appeal to reject the behavior of all()—not to actually disagree with the correctness of all() in implementing universal quantification, or the correctness of the design that it should implement universal quantification.
- p1mrx 3y ago> If all marbles in a bag are black, and you take one marble out, are all marbles in the bag white? The logical answer is "maybe."
- Thiez 3y agoYes, you took out the last marble that wasn't white, and now all marbles that remain are white.
- neves 3y agomy pragmatic view is that it should be false. A common error would be a programming mistake in the selection of the list element return an empty list. The returned list would, unexpectedly, comes empty. Trying to check if everything is black would return True and the code would follow on. It would be very hard to debug
- bandyaboot 3y agoUltimately I agree with the conclusion, but the logic of how you're getting there seems flawed in that the question you're asking doesn't add any value. The fundamental question is whether all marbles in a bag of n black marbles are black for all values of n including 0. If the answer to that question is yes, then the answer to your question is yes. If the answer is no, then the answer to your question is "yes except if it results in n=0".
- saurik 3y agoThe point was (explicitly) that it would be awkward to add the n=1->0 corner case.
- Someone 3y agoAn alternative way to see why that’s the most logical viewpoint is, that, if you assume not all marbles in an empty bag are black, you can have the following: - Take a bag for which “all marbles in this bag are black” is false - Add a black marble to that bag - After that, “all marbles in the bag are black” becomes true As is often the case in mathematics/logic [1] with these kind of things, you can hold an alternative view where “are all marbles in this bag black” doesn’t make sense for an empty bag or one where it has the answer “yo”, but if you do that, you’ll find that many proofs get more cumbersome because you have to handle that case differently from all other cases. [1] other examples are the convention that 0⁰ = 1 and the convention that 1 isn’t a prime number (that’s an example where mathematicians (eventually) decided that having 3 kinds of positive integers (prime numbers, composite numbers, and 1) is the better choice)
- marktani 3y agoedit: totally misunderstood parent, my bad. disregard the following. > - Take a bag for which “all marbles in this bag are black” is false > - Add a black marble to that bag > - After that, “all marbles in the bag are black” becomes true This reasoning is not correct. If the bag contains exactly a red marble at the start, "all marbles in this bag are black" is false as you required, but it breaks the claim at the end that "all marbles in the bag are black". There is in fact no bag that fulfills your reasoning, even the empty bag wouldn't (when starting to write my reply I had erroneously assumed so)
- saurik 3y agoIf a bag contains exactly one red marble at the start then all marbles in this bag are black is in fact false, but when you throw in a black marble the value does NOT suddenly become true, as the red marble still exists, which is exactly the point of the scenario: adding a black marble to a bag where that claim is false shouldn't make the bag suddenly become true, and it still didn't in your example... it would, though, if the empty bag were defined to be false (which it should not be based on this argument).
- 3y ago
- NoThisIsMe 3y agoThat's not the question. The question is: If there are no marbles in a bag, are all marbles in the bag black?
- Smaug123 3y agoI think you've misunderstood. The question you posed has an answer implied by the parent's question with n=1.
- twiceaday 3y agoSounds weird when you ask the question that way, but if you ask "is there a non-black marble in the bag?" the answer is clearly no. So the question is more like: Should "all marbles in the bag are black" be exactly equal to "not(is there a non-black marble in the bag)".
- jayd16 3y agoIsn't this like complaining about division by zero? Why make an exception? Well...because its exceptional. So it's consistent to say that a bag can contain all red and all black marbles at the same time?
- dkarl 3y agoTranslating it to idiomatic natural language makes it less clear, because the natural language statement "all marbles in the bag are black" implies that there are marbles in the bag. The question is, why do we interpret it differently in a logical/mathematical context? As with anything mathematical, we picked the way that yields useful and elegant mathematics. The notion of "all" would be awkward to work with if it did not apply to the empty set (bags without marbles) so we extended it in a way that is consistent with what it means over non-empty sets (bags with marbles.) One very nice thing about this definition of "all" is that it gives this simple relationship between logical "all" and logical "none": "for all x, P(x) is true" is equivalent to "there is no x for which P(x) is false" I.e., if there is no marble in the bag that is not black, then all marbles in the bag are black... so to speak. This yields elegant and useful mathematics, and (as you would expect) that tends to mean elegant and useful code as well. For example, suppose you had an enormous dataset of records that included zip codes and wanted to know: "Are all the zip codes in this dataset in the continental United States?" One approach would be to split the data into smaller shards, answer the question for each shard, and "and" all the answers together. What if you chose a bad way of sharding the data and one of the shards was empty? What result would you want returned for that shard?
- SkyPuncher 3y agoThe answer should be no. Though, it’s understandably ambiguous. Black is a property of a marble. Without a marble, black cannot evaluate to true. Therefore zero marbles equals “no”
- feoren 3y agoAll cell phones must be turned off before the movie will begin. Oh wait, nobody in the audience has a cell phone. Can the movie begin? > Without a marble, black cannot evaluate to true. Therefore zero marbles equals “no” "Is_Black" cannot evaluate to false either, therefore zero marbles equals "yes". But that's wrong too, because it is never evaluated, because there are no marbles to evaluate it on. TRUE is the identity of AND, and ALL is the aggregation of AND, so ALL([]) == TRUE. Put another way: If you start from a bag with N black marbles and split it up between M bags, can you say that for each new bag, all the marbles in it must be black? Yes, you can. That is, if you find a marble in the bag, it will be black. This still holds even if one bag doesn't happen to get any marbles.
- kaashif 3y ago> All cell phones must be turned off before the movie will begin. > Oh wait, nobody in the audience has a cell phone. Can the movie begin? That's a really good one. Admittedly, I've never had to actually explain why statements can be vacuously true to anyone. But I'll keep this in mind if I ever have to.
- fasterik 3y agoYour proposal would break all of logic and mathematics. "All marbles in the bag are black" is equivalent to "For all x, if x is a marble and x is in the bag, then x is black". Since the antecedent is false if the bag is empty, the statement is true by material implication.
- pharrington 3y agoThere are zero marbles. All zero of the marbles are black. All zero of the marbles are white. There are zero marbles.
- Salgat 3y ago"all" and "none" are simultaneously true, which makes this a tricky edge case that needs to be explicitly accounted for.
- dragonwriter 3y agoIts necessary that all and none are both true of empty lists, if they are both defined for empty lists, because otherwise the invariant that all(xs) == none(not x for x in xs) [0] would not hold. [0] yes, “none()” doesn’t actually exist in Python, but we can imagine that it did, and see that if it did, it should have this relationship.)
- hoosieree 3y agoA man walks into a shop and asks, "You wouldn't happen to have any fish, would you?" The shop assistant replies, "You've got it wrong – ours is a butcher's shop. We don't have any meat. You're looking for the fish shop across the road. There they don't have any fish!"
- schubart 3y ago“I’d like a coffee, please. Without milk.” “Apologies, we’re out of milk. Could I offer you a coffee without sugar instead?”