/// Example: `1 in (x :: set (representation packed) of int)` selects the packed representation for this use of `x`.
/// Using different representations at different call sites requires channelling (`--channelling yes`).
fn select_representation_from_annotation(expr: &Expr, _: &SymbolTable) -> ApplicationResult {
) -> Result<Option<(Expr, SymbolTable, Vec<Expr>)>, conjure_cp::rule_engine::ApplicationError> {
fn select_aux_declaration_representation(expr: &Expr, symtab: &SymbolTable) -> ApplicationResult {
fn select_representation_unconstrained(expr: &Expr, symtab: &SymbolTable) -> ApplicationResult {
fn choose_representation_rule(decl: &DeclarationPtr, symbols: &SymbolTable) -> Option<ReprRulePtr> {
// User-specified representation preference on the domain (e.g. set (representation packed)) defaults the choice
/// SMT integers over bit vectors. These preferences apply whenever costs tie, without inspecting
fn compact_representation_choice(candidates: &[(ReprRulePtr, usize)]) -> Option<ReprRulePtr> {
/// Representations that record only how a declaration's integers are held, leaving its shape and
/// Every other representation lays a value out differently -- decomposing it, packing it, changing
/// what the solver sees -- and so answers a different question. Keeping the two apart is what lets
/// a matrix choose `array` and its integers choose `bv` as two independent decisions rather than
/// True if `decl` was introduced by a representation that left it holding the whole value, rather
#[register_rule("ReprGeneral", 10100, [Eq, Neq, Lt, Gt, Leq, Geq, LexLt, LexLeq, LexGt, LexGeq])]
if holds_whole_value_of_source(lhs_re.ptr()) || holds_whole_value_of_source(rhs_re.ptr()) {
/// SAT has no integers: an int variable is encoded as a vector of Booleans, and which encoding it
/// gets is a modelling choice like any other representation. Solvers with native integers leave
/// Three separate reasons: the domain is abstract in Essence' terms (a set, a tuple, ...), it is a
/// matrix and so has a layout to choose, or it is an integer and the solver has no integers of its
/// The integer reason deliberately does not look inside a matrix. How a matrix is laid out and how
/// its integers are held are independent choices: pick `components` and each entry becomes its own
/// encoding choice lands on the matrix that layout leaves behind. Folding the two together would
/// Every matrix has a layout to choose -- one variable per entry, the whole thing packed into a
/// True if the domain is abstract w.r.t Essence', ignoring how the solver holds integers and how a
/// This is the narrower question of whether a *type* is compound -- a set, a tuple, a record. Ask
/// [`domain_needs_representation`] when what matters is whether a declaration still has a choice