[i7] Weird ALMOST ALL behaviour

The manual says the ALMOST ALL condition is true if 80% or more of the objects of the kind meet the condition. But I’m finding when you’re dealing with only two or three objects, this is far from the case. It is only with higher numbers of objects where the test acts more like an 80% check. Here’s some test code which shows the issue (this is not a part of any actual game, I just whipped it up to test this issue)…

[code]The Tool Room is a room.

A switched on device called a blue button is here.

A switched off device called a red button is here.

When play begins:
if almost all of the devices are switched on, say “Almost all of the devices are switched on.”[/code]
This results in the conclusion that almost all of the devices are switched on, even though it’s just one out of 2, or 50%. If I put in three devices, and switch two on (one is not enough, apparently), it tells me almost all of them are on, which makes a bit more sense but it’s still just 66%, not 80%. With four it triggers at 75%, and that’s when it begins to resemble what the manual predicts.

If I change it from devices to people who are male and female, I get the same problem. If I change the condition to ‘if almost all of the devices in the tool room are switched on’, again – same problem.

I’m on build 6F95 of the Mac IDE.

Paul.

EDIT: Actually, come to think of it, it looks like it is treating ALMOST ALL as a synonym for ALL BUT ONE, at the lower object counts (but not at the higher)…

EDIT2: Which is odd, because as I’ve just discovered, ALL BUT doesn’t actually work as advertised, either. Supposedly I can form conditions like ‘if all but two of the devices are switched on’ but I’ve played with it and played with it and I can’t get ALL BUT or ALL EXCEPT to work, ever.

That sounds like it’s potentially a bug – I’d report it.

I’d guess that means “at least 80% rounded down to the nearest integer,” which doesn’t seem like a bad meaning for “almost.” Maybe only the documentation needs to change?

This test seems to confirm my hypothesis:

[code]The Tool Room is a room.

four open containers are here.
one closed containers are here.

five switched on devices are here.
one switched off devices are here.

To report:
if almost all of the devices are switched on, say “At least 66.6% of the devices are switched on - [the number of switched on devices] out of [the number of devices].”;
if almost all of the containers are open, say “At least 80% of the containers are open - [the number of open containers] out of [the number of containers].”;

When play begins:
Report.

Every turn when the turn count is 1:
Now a random open container is closed;
Now a random switched on device is switched off;
Report.

test me with “z”
[/code]

Fascinating test, thanks capmikee. Sounds like you might be right about that but I still find it a little weird to think of 1 out of 2 devices as being ‘ALMOST ALL’.

@em
I have submitted both the issues I found as separate bugs — thanks.

Paul.

What would you recommend instead: rounding up, or rounding to the closest integer?

Rounding up:
1-4 objects: all
5-9 objects: all but one
10 objects: all but two
etc…

closest:
2 objects: all = 100%
3 objects: at least 2 = 66.6%
4 objects: at least 3 = 75%
5 objects: at least 3 = 80%
6 objects: at least 5 = 83.3%
7 objects: at least 6 = 85.7%
8 objects: at least 6 = 75%
etc…

I’m not sure about your tables. Taking the percentage and then rounding up to the nearest integer to form the lower bound required, sounds about right, but I would think it would play out this way (I’m using CEIL to mean rounding up, it’s what I’m used to)…

1 objects: ceil(1.00.8) = 1
2 objects: ceil(2.0
0.8) = 2
3 objects: ceil(3.00.8) = 3
4 objects: ceil(4.0
0.8) = 4
5 objects: ceil(5.0*0.8) = 4
etc.

Although I could live with it perhaps even better if it were pegged at 75% instead of 80%. It’s not much difference, and it allows 4 objects to make the grade into the realm of the perfectly logical. Three objects would still be a little iffy, but ok. For 2 objects or 1, 100% is the only meaning that makes sense to me. Certainly its better to overestimate ‘almost all’ into ‘all’ than to underestimate it into ‘half’. At least to me.

Paul.

Thanks for posting this; I hadn’t been aware of the “almost all” adjective. Very cool. However, it strikes me that the adjective is mislabeled: “Almost all” means that not quite everything should be selected, so that if 3/3 or 6/6 things are picked out, then “almost all” should return false. In other words, if absolutely everything matches the given condition, then the condition we have is not “almost all” but “all or almost all”. Just plain “almost all” would, as I see it, be more limited, applying as long as a preponderance of items match the condition, but not if all of them do. So:

80–99.9% of things selected, rounding down: ALMOST ALL
80–100% of things selected, rounding down: ALL OR ALMOST ALL

If ALMOST ALL is going to continue to mean the latter, as it does now, then I think the current formulation (80-100%, rounding down) is the right way to go. It doesn’t make sense for “almost all” to be true only when all items in a set meet the condition; if the term is defined so that only 2/2 or 3/3 qualify as “almost all”, then we’ve just decided to ignore the “almost” entirely in those cases.

–Erik

I know I just said that ALL BUT ONE doesn’t work (and I still can’t make it work), but it’s supposed to work, so if we did have ALL BUT ONE, then your interpretation of ALMOST ALL, Erik, would seem to me to be not as useful, perhaps even redundant. There’s a certain extent to which these words will probably never be agreed upon and we should probably just pinpoint what we mean with a custom calculation instead of trying to define words that aren’t really susceptible to both clear AND naturally useful definitions. But if I had my druthers, I would want to use them in this way:

ALL BUT ONE, ALL BUT TWO, etc – in the situation you describe, where the important thing to me is that always there be at least a few left out – if that is the key thing then I’d use want to use these.

ALMOST ALL – for the situation where it’s important, for my text to make sense, that a large majority of the objects qualify, but it’s not strictly necessary for every single object to qualify. That strikes me a scenario that can happen often enough that my version of ALMOST ALL could serve it well. I would never think to use the phrase ALMOST ALL to try to signify that it’s really important that it isn’t actually ALL. I use the phrase in a way to say, ‘Well pretty much all, or close enough for jazz, anyway. i.e. let’s not split hairs — it’s basically all.’ That’s what I feel that phrase most naturally means, and it seems like a useful meaning, too. So it has to include the ALL scenario for it to have that useful meaning as distinct from ALL BUT ONE. YMMV.

I really don’t feel strongly about it. I didn’t find these ‘bugs’ (if it is in fact a bug) because I had come up with important uses for these terms. I found them because I’ve been writing myself an Inform 7 grammar cheat sheet, and when it came to these terms, like any i7 grammar I found an organisational place on my cheat sheet for them, and then tested them while doing a lot of syntax variation to see how many different variations are allowed (trying ALMOST ALL THE, ALMOST ALL OF THE, etc) so that I could note these things on my ‘sheet’. And that’s when I discovered that there are problems with these terms.

Honestly I don’t know if I would ever actually use either of them. I’d be way more likely to forget they exist, look up the math routines, and do an actual calculation of my own to behave however I specifically wish for that situation. I don’t really employ concepts like ALMOST ALL when I am programming - it’s been trained out of me.

Paul.

P.S. Other Inform weirdnesses I discovered through this ‘making a cheat sheet’ process. This…

if the containers in the Kitchen are closed ...

Does not mean what it appears to mean. (I know, it’s because of the strict interchangeability of singulars and plurals – there are no cases I know of where making something plural can change the meaning of the sentence, to Inform.)

Also, one of these two works and the other doesn’t, but as I read it according to the manual, they should both work (only the second one actually does)…

Definition: A room is naked if it contains nothing that is not a person. Definition: A room is naked if it contains no thing that is not a person.
Quirks and oddities like these, I’ve been discovering. The ones that started this thread are just the ones that I perceived as crossing a line into near-total dysfunction.

I’d be inclined to use “almost all” for substitution text and device setup the way Eric suggests, ie “[if all the monoliths are inactive]The room is dominated by enormous obsidian pillars.[otherwise if almost all the monoliths are inactive]A few of the obsidian pillars glow with a blue flame.[otherwise if almost all the monoliths are active]Flames lick up the sides of most of the monoliths, but a few stand silent.[otherwise]Blue light throbs from every corner of the room.[end if]”

If almost all means 80%+, then we’re in trouble; instead I need to go in and hand-edit in a clumsy and confusing way, especially if I change the number of monoliths to turn on.

Worse, I think, is that “almost all” in everyday usage pretty clearly means “not all” to me. When something is almost downloaded, it’s still incomplete; when the animals are almost all cats, there’s still a dog or two in the mix, etc. Inform has enough linguistically unintuitive uses of phrases already.

(I think it might be nice to be able to use percents, with more or less, or percent to percent:
If 50 percent or more of the gumballs are eaten:
If 10 percent to 20 percent of the hobgoblins laugh:)

I was also going to suggest percentages as an addition to the language. It seems to me that that is really what Paul is looking for: not almost all, but 80% or more:

if 80% or more of the elves are on workmen’s compensation
if less than 80% of the elves are on workmen’s compensation
if exactly 80% of the elves are on workmen’s compensation

–Erik

Methinks that the last line should be for “if all the monoliths are active” and the “otherwise” should catch the case where about half the monoliths are active – then it’s not true that most are active but most are inactive. This is a fairly pointless comment. --Though if this is something that actually happens in your code, you can make it work by having the “all” clauses fire before the corresponding “almost all” clauses, right?

This is interesting – I wonder what the formal semanticists have to say. I was tempted to say that “almost all” merely implicates not all, in the same way that “I tried to do it” implicates that you failed, because if you succeeded you’d just say “I did it.” But I think it’s pretty clear that if you’re almost there you’re not there.

(And googling a little, this formal semanticist says that “almost applied to a proposition p is true iff p itself is false in the actual world but there is an alternative proposition that is close by to p and true. There is some debate whether the requirement that p be false in the actual world is an entailment or an implicature (as argued for a.o. by Sadock 1981). I do not want to go into this discussion and will simply follow Rapp and von Stechow 1999 in assuming that it is indeed part of the truth conditions.” So there you go.)

Yeah, but – your code works identically under Erik’s interpretation and my interpretation (because following good practice you’ve sequenced it from the narrowest to the most inclusive case). Plus, my interpretation is rendered more sensical in my alternate context. One meaning that serves both purposes? Anyone? sigh

Anyway, good on both of you though for suggesting the i7-style percentage syntax. That would be primo. Seems unusual actually for i7 to predefine a property that depends on a certain number range without also having a predefined way to let you just go ahead and specify the number range. I wasn’t sure entirely that there wasn’t one already, buried in the docs somewhere.

Paul.

Yes. Yes, that’s very . . . hmmm. Yes. It may very well be that almost all is mainly implicature, but it’s such a strong use that in natural language, we need to be careful. Interestingly, I’ve been chewing over examples, and think the “almost but not all” meaning is least implied when paired with an if phrase:

The first sentence would indicate to me 80%+, the second 80%-99.9%. Since if phrases are where this is most likely to come up, I’m now confused on which meaning I want. I do want it to be accurately documented, though.

Matt: good catch on the code. This is why I shouldn’t code without testing things.

But wait, neither of those are the sort of phrases (or sentences) that can be written in I7.

I’d argue that when you use “almost all” to test the state of a given situation as in Inform, it is fundamentally ambiguous:

Inform can’t distinguish what is implied by “almost all” in these two sentences based on the say phrase as humans can. That, to me, is enough to dispense with the idea that “almost” should be implemented as merely an implicature in Informese (regardless of its status in English). One or both of the distinct meanings should be explicitly called out using slightly more verbose forms like “all or almost all” and/or “almost but not all”.

Now, as an author using the current system, I could only safely write the second sentence. To achieve the first effect, I need to write:

That’s not nearly as friendly as it ought to be…

Paul, I still can’t wrap my head around the definition that you’re pushing, i.e. that it makes sense for only 3/3 or 2/2 to be accepted as matching “almost”–that denies both almost-as-implicature and almost-as-truth-condition. Surely 2/3 is “almost all” in natural language? If there were three eclairs and you complain that I’ve eaten almost all of them, you can’t possibly mean that I ate all three? Again, I think what fits your needs is really a percentage test, e.g. “if at least 80% of the eclairs are consumed”, not “almost all”. It’s probably possible to write your own phrase to do that, but “almost all” does seem to be handled by the I7 compiler, rather than implemented by I7 or I6 template code…

–Erik

Two-thirds is a modest majority, and isn’t really considered to be something you can accurately describe as ‘almost all’ in my experience. After all, you are leaving a full third on the table! If anyone said to me ‘almost all’, and I found out later that it was only two-thirds, I would think that they bent the truth pretty far, there, to make their point. And I wouldn’t really trust their hyperbolic characterisations of statistics, in the future. Surely I can’t be alone in this regard?

But there are cases that don’t make sense intuitively here any way you slice it, though, aren’t there? I have yet to see an interpretation (including my own) that makes sense in all possible common sense uses of ALMOST ALL; we are just all disagreeing over which part of common sense to hold supreme, which seems to me a bit futile, somewhat like arguing over which flavour of ice cream is ‘real ice cream’. Which is why I’d probably go for the actual percentages, etc.

Paul.