right, exactly. This whole problem collapses if you don't 'open the envelopes one at a time' while having my 100% GUARANTEE that you won't be sure there's a heart in the one that does have one, after opening any others you've gone through.

An 80% guarantee is fine, but 100% guarantee that you won't be sure, is incompatible with having a space of envelopes and going through it one by one.

why would anyone think otherwise?

the way in which I discovered this resolution is by coding up a perl script to 'monte carlo' different scenarios. I realized at the location that I made the teacher actually have to choose which day the exam will be, there is a space of days.

(they have to choose - or end up choosing - as they break their first guarantee if they don't have it on any day of the week or more than one day of the week, or whatever. it has to be one and only one day of the week, however they end up getting there.)

it doesn't matter if the teacher is choosing one of five days, 10 days, 100 days, whatever. The methodology is that the students get to go through the days one by one.

If you are choosing one of five days, there is a 20% probability of choosing the last of them; therefore given this methodology you can only 80% guarantee them surprise.

if you are choosing one of ten days, there is a 10% probability of choosing the last of them; therefore given the methodology you can only 90% guarantee them surprise

if choosing one of 100 days, 1% probability you chose the last of them; you can 99% guarantee them surprise.

Bottom line, which you discover if you code it up to run in simulations: at some point the teacher MUST actually choose a day to meet their first guarantee. (If they choose none - or end up giving it on none - then they've broken their first guarantee. Any algorithm that doesn't end up choosing a day 100% of the time is wrong).

At the point of choosing a day, it doesn't matter if you make the Teacher choose monday through thursday, monday through wednesday, monday or tuesday, or hard-code it to choose Monday. Whatever the teacher chooses, if the students have access to the teacher's algorithm (which describes the space of possible days), then the last day of the space they would not have surprise. The teacher can thus give a guarantee equal to the number of days OTHER than the last day, over the number of days in the teacher's space. In the usual sense, this is 80% guarantee of surprise.

of course, another question is if the teacher gets to follow an algorithm the students must only guess at. (They don't know what his algorithm is).

In this case, for your simulation you can just hard-code the teacher always giving the test on Monday. Since the students don't know this is his algorithm, they will be "surprised" (they could have thought that he was picking from one day monday thru friday, they had no way to be sure that he was hard-coded to pick Monday), thus fulfilling both criteria of not being sure of what day the test is, and being given a test monday to friday.

sonofabitch. new solution: The teacher can meet his obligations by being hard-coded to give the test on Monday, but not telling his students that this is the algorithm. Since they could be thinking he's choosing from a space of monday thru friday, they could think that the last day is friday: it's really Monday.

this is an interesting aspect I hadn't considered (a secret algorithm).

In this case I would say my response is more nuanced:
1) To whatever extent the students get to know of the teacher's algorithm for picking days, they are that much less able to be given a guarantee of 100% surprise on the day of the exam.

Therefore, if the teacher is completely secret about his algorithm (i.e. he is NOT 'picking randomly monday thru friday') he can surprise the student. Any information he gives his students about his algorithm takes away from the extent to which he can guarantee their surprise. EVEN IF the algorithm includes randomness.

In other words: if the students know the teacher is picking a random day monday thru friday, then he cannot offer a guarantee of surprising them.

if the students have no idea what algorithm the teacher uses to pick a day (and, therefore, have no way to guess at the space), he can offer a guarantee of surprising them.

Thus if students know nothing at all about the teacher, and he knows this fact, he can meet his obligation by giving the test from a space of one day (Monday) without any randomness or space of possibilities.