Derived state by comparing only with lower bound

If I describe a state derivation in this way (example code):

'Bottle': stategroup = switch .'Content' compare ( 2500 ) (
	| >= => 'Huge' ( )
	| < => switch .'Content' compare ( 1250 ) (
		| >= => 'Big' ( )
		| < => switch .'Content' compare ( 1000 ) (
			| >= => 'Normal' ( )
			| < => 'Small' ( )
		)
	)
) (
	'Huge' { }
	'Big' { }
	'Normal' { }
	'Small' { }
)

It seems that when a condition is met and the state determined, further evaluation is terminated. So due to the order in which the compares are described in the model.
Or should I always also check the upper bound to guarantee the determination of the correct state?

In Alan, one and only one case of a switch statement can and will match at runtime. If that does not answer your question, I am not entirely sure what you mean.

Strictly speaking, if a bottle has for example a content of 3000 the states Normal, Big and Huge could potentially apply, since 3000 > 1000 and 3000 > 1250 and 3000 > 2500. So only due to the order in which I describe the compares this bottle will end up having the state Huge. But is the evaluation order sufficiently guaranteed by the ‘compare-order’ in the model?

The way in which you express it, is exactly how the datastore evaluates the expression. There is no expression rewriting being done that could potentially affect the expression evaluation result. So, to answer the question: yes, though I don’t see how it has anything to do with a compare-order as you call it. A subexpression (nested switch statement) is only evaluated if the corresponding case of the above lying switch statement is matched.

Just as a test for myself and as explanation on this forum, here a changed ‘compare-order’ (1000 - 1250 - 2500 instead of 2500 - 1250 - 1000):

'Bottle': stategroup = switch .'Content' compare ( 1000 ) (
	| < => 'Small' ( )
	| >= => switch .'Content' compare ( 1250 ) (
		| < => 'Normal' ( )
		| >= => switch .'Content' compare ( 2500 ) (
			| < => 'Big' ( )
			| >= => 'Huge' ( )
		)
	)
) (
	'Small' { }
	'Normal' { }
	'Big' { }
	'Huge' { }
)

And you’re right! A bottle with a content of for example again 3000 still ends up being ‘Huge’.