ValuesUnderConstraints/MergeTwoCaseDiscussions - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : ValuesUnderConstraints/MergeTwoCaseDiscussions

ValuesUnderConstraints

  

MergeTwoCaseDiscussions

  

return a list of valuesUnderConstraints objects whose domains are pairwise disjoint from two such lists

 

Calling Sequence

Parameters

Description

Examples

References

Compatibility

Calling Sequence

MergeTwoCaseDiscussions(lvc,lwd)

MergeTwoCaseDiscussions(lvc, lwd, outopt)

Parameters

lvc

-

list of ValueUnderConstraints objects

lwd

-

list of ValueUnderConstraints objects

outopt

-

(optional) equation, either output = piecewise or output = lists

Description

• 

Denote by D1 (resp. D2) the union of the domains of the value-under-constraints objects in lvc (resp. lwd).

• 

The command MergeTwoCaseDiscussions(lvc,lwd) returns L1, L12, L2 where L1, L12 and L2 are three lists of value-under-constraints so that:

1. 

the domain of any value-under-constraint object in L1 is contained in the set theoretic difference of D1 and D2;

2. 

the domain of any value-under-constraint object in L12 is contained in the intersection of D1 and D2;

3. 

the domain of any value-under-constraint object in L2 is contained in the set theoretic difference of D2 and D1;

4. 

each of L1, L12 and L2 is a case discussion;

5. 

the list [op(L1), op(L12), op(L2)] refines the list [op(lvc), op(lwd)].

• 

By including the option output = piecewise, you instruct the command to return the result as a single piecewise expression instead. You can explicitly select the default output of three lists by passing the option output = lists.

Assumptions

• 

The lists lvc and lwd are assumed to be case discussions. If this assumption is not satisfied then the result of MergeTwoCaseDiscussions(lvc,lwd) may not be correct.

Remarks

• 

The command MergeTwoCaseDiscussions is provided so that users can build efficient divide-and-conquer algorithms for operating on value-under-constraints objects.

• 

Denote again by [L1, L12, L2] the result of the command MergeTwoCaseDiscussions(lvc,lwd). Then, the list [op(L1), op(O12), op(L2)] is a valid output for MakeCaseDiscussion([op(lvc), op(lwd)]). That is, it is a case discussion refining [op(lvc), op(lwd)]. However, MergeTwoCaseDiscussions(lvc,lwd) takes advantage of the fact that lvc and lwd are themselves case discussions, that is, the domains of all value-under-constraints objects in lvc (resp. lwd) are non-empty and pairwise disjoint. Therefore, MergeTwoCaseDiscussions(lvc,lwd) is expected to consume less computing resources (time, space) than MakeCaseDiscussion([op(lvc), op(lwd)]). Moreover, L1, L12, L2 provide additional formation, as explained above.

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:

1. 

for every value-under-constraints object wd in lwd there exists at least one value-under-constraints object vc in lvc that wd refines;

2. 

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

3. 

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.

Examples

withValuesUnderConstraints:

Consider four value-under-constraints objects

vc1ValueUnderConstraints3,a,b,c,d,a,b,c,d,a,b,c,d

vc1value 3 when a=0,d0,0b,0c1

(1)

vc2ValueUnderConstraints4,a,b,c,d,b,c,d,a,a,b,c,d

vc2value 4 when b=0,a0,0c,0d1

(2)

vc3ValueUnderConstraints5,a,b,c,d,c,d,a,b,a,b,c,d

vc3value 5 when c=0,b0,0d,0a1

(3)

vc4ValueUnderConstraints6,a,b,c,d,d,a,b,c,a,b,c,d

vc4value 6 when d=0,c0,0a,0b1

(4)

Suppose one calculation results in the case discussion vc12, and another in the case discussion vc34, both defined below.

vc12MakeCaseDiscussionvc1,vc2:

vc34MakeCaseDiscussionvc3,vc4:

In order to merge these case discussions, we can use MakeCaseDiscussion again, or the more efficient command MergeTwoCaseDiscussions.

merged_1CodeTools:-UsageMakeCaseDiscussionopvc12,opvc34,:-iterations=20

memory used=9.91MiB, alloc change=96.99MiB, cpu time=191.00ms, real time=178.45ms, gc time=23.93ms

merged_1value 3 when a=0,d0,0b,0c1,value 4 when b=0,a0,0c,0d1,value 5 when c=0,b0,0d,0a1,value 6 when d=0,c0,0a,0b1

(5)

merged_2CodeTools:-UsageMergeTwoCaseDiscussionsvc12,vc34,:-iterations=20

memory used=7.49MiB, alloc change=16.00MiB, cpu time=130.15ms, real time=121.75ms, gc time=13.99ms

merged_2value 3 when a=0,d0,0b,0c1,value 4 when b=0,a0,0c,0d1,,value 5 when c=0,b0,0d,0a1,value 6 when d=0,c0,0a,0b1

(6)

zipAreEqual,merged_1,mapop,merged_2

true,true,true,true

(7)

In this case, we see that the four value-under-constraint objects have disjoint domains.

The result is a little easier to interpret when we display it as a piecewise expression.

MergeTwoCaseDiscussionsvc12,vc34,output=piecewise

3a=0d00b0c14b=0a00c0d15c=0b00d0a16d=0c00a0b1

(8)

References

  

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.

Compatibility

• 

The ValuesUnderConstraints[MergeTwoCaseDiscussions] 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[PairCompare]

ValuesUnderConstraints[RefineCaseDiscussion]

ValuesUnderConstraints[Value]

ValuesUnderConstraints[ValueUnderConstraints]