/// If this domain is already ground, return a mutable reference to the underlying [GroundDomain].
/// If this domain is unresolved, return a mutable reference to the underlying [UnresolvedDomain].
let idx_doms: Vec<DomainPtr> = idx_doms_gds.iter().cloned().map(|d| d.into()).collect();
/// If this is a [GroundDomain::Matrix], get immutable references to its element and index domains
/// If this is a [GroundDomain::Matrix], get mutable references to its element and index domains
/// If this is a [GroundDomain::Set], get immutable references to its attributes and inner domain
/// If this is a [GroundDomain::Function], get mutable references to its (attrs, domain, co-domain)