ValuesUnderConstraints
PairCompare
return the differences and common characteristics of two values-under-constraints objects
Calling Sequence
Parameters
Description
Examples
References
Compatibility
PairCompare(vc1,vc2)
vc1
-
ValueUnderConstraints
vc2
Denote by V1 and C1 the value and constraints of vc1. Similarly, denote by V2 and C2 the value and constraints of vc2.
Denote by D1 the domain of vc1 and by D2 that of vc2
Then, the command PairCompare(vc1,vc2) returns three lists of value-under-constraints objects L1, L12 and L2 so that the following five conditions hold:
any value-under-constraint object in L1 has value V1 and its domain is contained in the set theoretic difference of D1 and D2;
any value-under-constraint object in L12 has value V1 union V2 and its domain is contained in the intersection of D1 and D2;
any value-under-constraint object in L2 has value V2 and its domain is contained in the set theoretic difference of D2 and D2;
any point satisfying C1 or C2 satisfies the set of constraints of one and only one value-under-constraints objects among L1, L12 and L2;
the set of constraints of every value-under-constraints object among L1, L12 and L2 is satisfiable.
Remarks
One useful way to understand what PairCompare(vc1,vc2) computes is as follows. Let D1 and D2 be the domains of vc1 and vc2 respectively. View V1 (resp. V2) as the set of all images of a generic point in D1 (resp. D2). Then, vc1 and vc2 represent two binary relations. Moreover, PairCompare(vc1,vc2) computes three binary relations R1, R12 and R2 encoded by L1, L12 and L2 respectively.
The domain of R1 is given by the disjunction of the systems of constraints listed in L1. Similarly, the domain of R12 is given by the disjunction of the systems of constraints listed in L12. And, similarly, the domain of R2 is given by the disjunction of the systems of constraints listed in L2.
Consequently, if every point satisfying C1 satisfies C2, then L1 is empty. Similarly, if every point satisfying C2 satisfies C1, then L2 is empty.
Another useful observation is that [op(L1), op(L12), op(L2)] is a case discussion refining [vc1, vc2].
Terminology
Mathematically, a value-under-constraints object vc is an ordered pair (v,c) where v is a finite set, called the value of vc, and c is a set of Boolean functions defined on some set A, and called the constraints of vc. The set c is regarded as the conjunction of these constraints.
We write the domain of vc for the subset of A on which all constraints of vc are true.
If the domain of vc is not empty, then We say that vc is consistent, otherwise we say that it is inconsistent.
We say that a finite number of value-under-constraints objects is a case discussion whenever their domains form a partition of some set A, that is, whenever their domains are non-empty and pairwise disjoint.
Let wd be a second value-under-constraints object with value w and constraints d. We say that wd refines vc whenever the domain of wd is contained in the domain of vc and the value of wd contains the value of vc.
Let lvc and lwd be two lists of value-under-constraints objects. We say that lwd refines lvc whenever the following conditions hold:
for every value-under-constraints object wd in lwd there exists at least one value-under-constraints object vc in lvc that wd refines;
for every value-under-constraints object vc of lvc there exists a number of value-under-constraints objects in lwd refining vc and such that the union of their domains is equal to the domain of vc
the value of every value-under-constraints object wd in lwd is the union of the values of the value-under-constraints objects in lvc that wd refines
Assume from now on that the value v of the value-under-constraints object vc consists of functions which (1) are defined on A, the set on which constraints of vc are defined, and (2) take value in a set B. Then, the value-under-constraints object vc naturally defines a binary relation from A to B as the set of all pairs (x,y) where x belongs to the domain of vc and y is the image of x by one of the functions of v.
This interpretation in terms of binary relation helps understanding the concept of a value-under-constraints object. In particular, it helps understanding why the value of such an object is a set.
with⁡ValuesUnderConstraints:
Create a value-under-constraints object
vc1≔ValueUnderConstraints⁡1,a,b,c,d,e,f,g,h,,a,b,c,d,,a,b,c,d,e,f,g,h
vc1≔value 1 when 0≤a,0≤b,0≤c−1,0≤d−1
Create another value-under-constraints object
vc2≔ValueUnderConstraints⁡2,a,b,c,d,e,f,g,h,,e,f,g,h,,a,b,c,d,e,f,g,h
vc2≔value 2 when 0≤e,0≤f,0≤g−1,0≤h−1
Apply PairCompare and pretty-print the result with ToPiecewise
L0≔PairCompare⁡vc1,vc2:
ToPiecewise⁡map⁡op,L0
ToPiecewise⁡value 1 when 0≤a,0≤b,0≤c−1,0≤d−1,0≤−e−1,value 1 when 0≤a,0≤b,0≤e,0≤c−1,0≤d−1,0≤−f−1,value 1 when 0≤a,0≤b,0≤e,0≤f,0≤−g,0≤c−1,0≤d−1,value 1 when 0≤a,0≤b,0≤e,0≤f,0≤−h,0≤c−1,0≤d−1,0≤g−1,values 1,2 when 0≤a,0≤b,0≤e,0≤f,0≤c−1,0≤d−1,0≤g−1,0≤h−1,value 2 when 0≤e,0≤f,0≤−a−1,0≤g−1,0≤h−1,value 2 when 0≤a,0≤e,0≤f,0≤−b−1,0≤g−1,0≤h−1,value 2 when 0≤a,0≤b,0≤e,0≤f,0≤−c,0≤g−1,0≤h−1,value 2 when 0≤a,0≤b,0≤e,0≤f,0≤−d,0≤c−1,0≤g−1,0≤h−1
Consider two other value-under-constraints objects with no integer-valued indeterminate
vc14≔ValueUnderConstraints⁡1,a,b,c,d,e,f,g,h,a,b,c,1−b,d,∅
vc14≔value 1 when a=0,d≠0,0<c,0<1−b,0≤b
vc15≔ValueUnderConstraints⁡2,a,b,c,d,e,f,g,h,e,f,g,1−f,h,∅
vc15≔value 2 when e=0,h≠0,0<g,0<1−f,0≤f
L1≔PairCompare⁡vc14,vc15:
ToPiecewise⁡map⁡op,L1
ToPiecewise⁡value 1 when a=0,d≠0,0<c,0<1−b,0≤b,0≤−g,value 1 when a=0,d≠0,0<c,0<g,0<1−b,0≤b,0≤−1+f,value 1 when a=0,d≠0,0<c,0<g,0<−f,0<1−b,0≤b,value 1 when a=0,d≠0,e≠0,0<c,0<g,0<1−b,0<1−f,0≤b,0≤f,value 1 when a=0,e=0,h=0,d≠0,0<c,0<g,0<1−b,0<1−f,0≤b,0≤f,values 1,2 when a=0,e=0,d≠0,h≠0,0<c,0<g,0<1−b,0<1−f,0≤b,0≤f,value 2 when e=0,h≠0,0<g,0<1−f,0≤f,0≤−c,value 2 when e=0,h≠0,0<c,0<g,0<1−f,0≤f,0≤−1+b,value 2 when e=0,h≠0,0<c,0<g,0<−b,0<1−f,0≤f,value 2 when e=0,a≠0,h≠0,0<c,0<g,0<1−b,0<1−f,0≤b,0≤f,value 2 when a=0,d=0,e=0,h≠0,0<c,0<g,0<1−b,0<1−f,0≤b,0≤f
Modify the previous two value-under-constraints objects by making all indeterminate integer-valued
vc14≔ValueUnderConstraints⁡1,a,b,c,d,e,f,g,h,a,b,c,1−b,d,b,f
vc14≔value 1 when a=0,b=0,d≠0,0<c
vc15≔ValueUnderConstraints⁡2,a,b,c,d,e,f,g,h,e,f,g,1−f,h,b,f
vc15≔value 2 when e=0,f=0,h≠0,0<g
L2≔PairCompare⁡vc14,vc15:
ToPiecewise⁡map⁡op,L2
ToPiecewise⁡value 1 when a=0,b=0,d≠0,0<c,0≤−g,value 1 when a=0,b=0,d≠0,0<c,0<g,0≤−f−1,value 1 when a=0,b=0,d≠0,0<c,0<g,0≤−1+f,value 1 when a=0,b=0,f=0,d≠0,e≠0,0<c,0<g,value 1 when a=0,e=0,h=0,b=0,f=0,d≠0,0<c,0<g,values 1,2 when a=0,e=0,b=0,f=0,d≠0,h≠0,0<c,0<g,value 2 when e=0,f=0,h≠0,0<g,0≤−c,value 2 when e=0,f=0,h≠0,0<c,0<g,0≤−b−1,value 2 when e=0,f=0,h≠0,0<c,0<g,0≤−1+b,value 2 when e=0,b=0,f=0,a≠0,h≠0,0<c,0<g,value 2 when a=0,d=0,e=0,b=0,f=0,h≠0,0<c,0<g
Rui-Juan Jing, Yuzhuo Lei, Christopher F. S. Maligec, Marc Moreno Maza: "Counting the Integer Points of Parametric Polytopes: A Maple Implementation." Proceedings of Computer Algebra in Scientific Computing - 26th International Workshop (CASC) 2024: 140-160, Lecture Notes in Computer Science, vol. 14938, Springer.
The ValuesUnderConstraints[PairCompare] command was introduced in Maple 2025.
For more information on Maple 2025 changes, see Updates in Maple 2025.
See Also
ValuesUnderConstraints[Constraints]
ValuesUnderConstraints[MakeCaseDiscussion]
ValuesUnderConstraints[MergeTwoCaseDiscussions]
ValuesUnderConstraints[RefineCaseDiscussion]
ValuesUnderConstraints[Value]
ValuesUnderConstraints[ValueUnderConstraints]
Download Help Document