4.5.8 Quantified Expressions
Syntax
1/3
2/3
quantifier ::= all | some 
3/3
4/3
4.a/3
Discussion: The 
syntactic category quantified_expression 
appears only as a primary 
that is parenthesized. The above rule allows it to additionally be used 
in other contexts where it would be directly surrounded by parentheses. 
This is the same rule that is used for conditional_expressions; 
see 4.5.7 for a detailed discussion of the 
meaning and effects of this rule.  
Name Resolution Rules
5/3
Dynamic Semantics
6/3
7/3
8/3
If the quantifier 
is all, the expression is True if the evaluation of the predicate 
yields True for each value of the loop parameter. It is False otherwise. 
Evaluation of the quantified_expression 
stops when all values of the domain have been examined, or when the predicate 
yields False for a given value. Any exception raised by evaluation of 
the predicate 
is propagated. 
8.a/3
Ramification: The 
expression 
is True if the domain contains no values.  
9/3
If the quantifier 
is some, the expression is True if the evaluation of the predicate 
yields True for some value of the loop parameter. It is False otherwise. 
Evaluation of the quantified_expression 
stops when all values of the domain have been examined, or when the predicate 
yields True for a given value. Any exception raised by evaluation of 
the predicate 
is propagated. 
9.a/3
Ramification: The 
expression 
is False if the domain contains no values.  
Examples
10/3
 {
AI05-0176-1} 
The postcondition for a sorting routine on an array 
A with an index subtype T can be written:11/3
Post => (A'Length < 2 or else
   (for all I in A'First .. T'Pred(A'Last) => A (I) <= A (T'Succ (I))))
12/3
 {
AI05-0176-1} 
The assertion that a positive number is composite 
(as opposed to prime) can be written:13/3
pragma Assert (for some X in 2 .. N / 2 => N mod X = 0);
Extensions to Ada 2005
13.a/3
 Ada 2005 and 2012 Editions sponsored in part by Ada-Europe
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe