# 4.2.1.8. Reflection operations

These functions return information about declared or inferred variable bounds and domains.

In this section: annotate, dom, dom_array, dom_array_occurring, dom_bounds_array, dom_size, fix, has_ann, has_bounds, has_ub_set, is_fixed, is_same, lb, lb_array, ub, ub_array.

## annotate

 ```test annotate(any \$T: x, ann: a) ``` Annotate declaration of x with annotation a

## dom

 ```function set of \$\$E: dom(var \$\$E: x) function set of \$\$E: dom(var opt \$\$E: x) ``` Return domain of x

## dom_array

 ```function set of \$\$E: dom_array(array [\$T] of var \$\$E: x) function set of \$\$E: dom_array(array [\$T] of var opt \$\$E: x) ``` Return union of all domains of the elements in array x

## dom_array_occurring

 ```function set of int: dom_array_occurring(array [\$T] of var opt int: x) ``` Return union of all domains of the elements in array x, ignoring absent elements

## dom_bounds_array

 ```function set of int: dom_bounds_array(array [\$T] of var int: x) function set of int: dom_bounds_array(array [\$T] of var opt int: x) ``` Return approximation of union of all domains of the elements in array x

## dom_size

 ```function int: dom_size(var int: x) ``` Return cardinality of the domain of x

## fix

 ```1. function \$T: fix(var \$T: x) 2. function opt \$T: fix(var opt \$T: x) 3. function array [\$U] of \$T: fix(array [\$U] of var \$T: x) 4. function array [\$U] of opt \$T: fix(array [\$U] of var opt \$T: x) ``` 1, 2. Check if the value of x is fixed at this point in evaluation. If it is fixed, return its value, otherwise abort. 3, 4. Check if the value of every element of the array x is fixed at this point in evaluation. If all are fixed, return an array of their values, otherwise abort.

## has_ann

 ```test has_ann(any \$T: x, ann: a) ``` Test if x is annotated a

## has_bounds

 ```test has_bounds(var int: x) test has_bounds(var float: x) ``` Test if variable x has declared, finite bounds

## has_ub_set

 ```test has_ub_set(var set of int: x) ``` Test if variable x has a declared, finite upper bound

## is_fixed

 ```1. test is_fixed(any \$T: x) 2. test is_fixed(array [\$U] of any \$T: x) ``` Test if x is fixed Test if every element of array x is fixed

## is_same

 ```test is_same(any \$T: x, any \$U: y) ``` Test if x and y are the same variable

## lb

 ```1. function \$\$E: lb(var \$\$E: x) 2. function \$\$E: lb(var opt \$\$E: x) 3. function float: lb(var float: x) 4. function float: lb(var opt float: x) 5. function set of \$\$E: lb(var set of \$\$E: x) 6. function array [\$U] of \$\$E: lb(array [\$U] of var \$\$E: x) 7. function array [\$U] of float: lb(array [\$U] of var float: x) 8. function array [\$U] of set of \$\$E: lb(array [\$U] of var set of \$\$E: x) ``` 1-5. Return lower bound of x 6-8. Return array of lower bounds of the elements in array x

## lb_array

 ```1. function \$\$E: lb_array(array [\$U] of var opt \$\$E: x) 2. function float: lb_array(array [\$U] of var opt float: x) 3. function set of \$\$E: lb_array(array [\$U] of var set of \$\$E: x) ``` 1, 2. Return minimum of all lower bounds of the elements in array x Return intersection of all lower bounds of the elements in array x

## ub

 ```1. function \$\$E: ub(var \$\$E: x) 2. function \$\$E: ub(var opt \$\$E: x) 3. function float: ub(var float: x) 4. function float: ub(var opt float: x) 5. function set of \$\$E: ub(var set of \$\$E: x) 6. function array [\$U] of \$\$E: ub(array [\$U] of var \$\$E: x) 7. function array [\$U] of float: ub(array [\$U] of var float: x) 8. function array [\$U] of set of \$\$E: ub(array [\$U] of var set of \$\$E: x) ``` 1-5. Return upper bound of x 6-8. Return array of upper bounds of the elements in array x

## ub_array

 ```1. function \$\$E: ub_array(array [\$U] of var opt \$\$E: x) 2. function float: ub_array(array [\$U] of var opt float: x) 3. function set of \$\$E: ub_array(array [\$U] of var set of \$\$E: x) ``` 1, 2. Return maximum of all upper bounds of the elements in array x Return union of all upper bounds of the elements in array x