last day (15 days later) » 

11:41 PM
0
A: Standard algorithms any_of(), all_of() and none_of() applied on empty ranges

Karoly HorvathYou simply interpret their name. Use common sense. That is: any_of does any element in range fulfill the condition? For this, you need at least one matching element. all_of does all elements in range fulfill the condition? If no elements are there, then all of them meet the criteria. etc. The...

 
{} are all odd? mm not sure.
 
@AdrianMaire: can you name something from that set which is not odd? :)
 
@AdrianMaire Every element of this set is also even. And a square of a rational number. The condition has to hold for all members. Think of it as examining every element one by one. As long as you don't find something that disproves your hypothesis, it is correct. So it is correct for an empty set.
 
@Karoly Horvath: Can you name anything from that set which is odd? The question has both interpretations. I agree that the standard decision is intuitive, but that do not make it the only possible one.
 
@AdrianMaire It is the only interpretation that is conforming with mathematics.
 
11:41 PM
@stefan: Can you contribute any formula / reference to this assertion pls?
 
@AdrianMaire Well it's basically conforming with common sense, but if you want to read up on the theory, why not start at predicate logic, as ooga suggested?
@AdrianMaire Another argument may convince you: Consider {1,3}. Clearly all elements are odd. By removing any element, the fact that all other elements remain odd is undoubted. Now consider {1}. Why would removing an element from this set removes the properties of the rest only because the rest is empty?
 
This is the base of our whole scientific knowledge. You make theories, and then check the predictions. As long as the theory isn't disproved you assume it's correct. If you get a better theory that disproves the old one and makes better predictions, you replace the old one... And there's of course Occam's razor to make sure that you don't create silly theories that cannot be disproved.
 
@stefan: To find a contradiction to an assertion imply that the assertion is wrong, but to not find any contradiction does not mean the assertion is right. If I am right, the logic predicate only say "we cannot say" for an empty set. If we could demonstrate anything by just not matching any contradiction, the world would be easier. That also is the reason why Newton lay has been correct for years and now we have better models.
 
@AdrianMaire: Think a list of mathematical statements. You want to know 1) is there a valid statement in the list? 2) are all statements true? does this system contain a contradictoion? - How would you handle an empty list? In fact, can you give an example where another behaviour would be sensible?
 
@AdrianMaire Well in contrast to Newtons theorems mathematics is absolute. No sane mathematician will ever doubt this in the future ;-) See also properties of the empty set on wikipedia
 
11:41 PM
@stefan: Correct, if you read this wikipedia article, you will find that: 1) For every element of emptyset the property holds (vacuous truth); 2) There is no element of emptyset for which the property holds. Both are true at the same time.
 
Vacuous_truth is only one of the two hypothesis of empty sets. Try that: You want to demonstrate that all elements of A is odd: using proof of contradiction, if I find any element that match: i in A is even, so all x in A is odd is false. All x in A is even, so at least one of them is even.
 
For every ∀ element of \emptyset the property holds. There is no !∃ element of \emptyset for which the property holds. Yes, both true at the same time... when you're reading text, you supposed to interpret it.
 
∀ mean "For every" and ∃ mean "exist", your statement does not have sense.
 
@AdrianMaire Ok one last try: So "no element of a set fulfills the property". This is equivalent to saying "All elements of the set do not fulfill the property". Now consider the set {} and the property of oddness and again with the property of evenness. You will find that both are correct and there is no contradiction.
 
11:43 PM
@stefan: you are right, both of your statement (oddness and eveness) hold. :-)
Any property for an empty set is false AND true
 
@AdrianMaire So you finally agree? Great :)
 
So the decision of the STD to make std::all_of to return true on the empty set is more or less arbitrary
 
Argh no!
for god's sake no
 
you said it yourself: it hold and does not hold at the same time
 
no
i didn't
 
11:45 PM
All elements of the set is odd, all element of the set is even, an element cannot be odd and even at the same time.
 
i said "all elements of {} are odd" and "all elements of {} are even". What I didn't say "not all elements of {} are odd" which is a completely different thing
Of course no number is odd and even at the same time. That's why the set is empty.
Please tell me you got it now..
 
So:
- All element in {} is odd
- There is no element in {} that is odd
- All element in {} is not odd
- There is not element in {} that is not odd
right?
 
Yes.
 

  last day (15 days later) »