SSymbolic Domain Decomposition
Jacques Carette , Alan P. Sexton , Volker Sorge , and Stephen M. Watt Department of Computing and Software, McMaster University School of Computer Science, University of Birmingham Department of Computer Science, University of Western Ontario
Abstract.
Decomposing the domain of a function into parts has manyuses in mathematics. A domain may naturally be a union of pieces, afunction may be defined by cases, or different boundary conditions mayhold on different regions. For any particular problem the domain canbe given explicitly, but when dealing with a family of problems given interms of symbolic parameters, matters become more difficult. This articleshows how hybrid sets, that is multisets allowing negative multiplicity,may be used to express symbolic domain decompositions in an efficient,elegant and uniform way, simplifying both computation and reasoning.We apply this theory to the arithmetic of piecewise functions and sym-bolic matrices and show how certain operations may be reduced fromexponential to linear complexity.
The goal of this paper is to develop general methods to work with domainshaving symbolically defined parts. The raison d’ˆetre of symbolic mathematicalcomputation is to compute and reason about general expressions, rather thanworking with particular values valid only at specific points. Matters are simplestwhen variables range over a domain of interest and all expressions are valid overthe entire domain. Sometimes it is useful to perform simplifications or otheroperations that are valid over part, but not all, of the domain. In this situation,software systems may or may not record the excluded region. But we are notalways so fortunate to have this one-region situation. More generally, the domainof interest may be made up of several pieces with expressions taking differentforms on different parts. Moreover, the demarcation of the parts may be definedsymbolically. This paper explores how to represent such expressions concisely ina uniform way that simplifies computation and reasoning.When we do arithmetic with piecewise functions defined on explicit parti-tions, we can do a mutual refinement of domain partitions to obtain regions thatmay each be handled uniformly. When the partitions are defined symbolically,however, we obtain a massive explosion of cases — for N binary operations onfunctions of k pieces there are k N potential regions. We say “potential” regions a r X i v : . [ c s . S C ] A p r ecause, of this large number, not all of the regions are in fact feasible. Fur-thermore, it is usually not possible to determine which regions are feasible andwhich are not. For example, the sum (cid:80) Ni =1 f i ( x ) of the functions f i ( x ) = (cid:40) x < k i ,A i for x (cid:62) k i . has (cid:80) Ni =0 N ! /i ! possible orderings of the k i , with each ordering having between2 and N + 1 regions. There is no ordering in which all 2 N regions are realized.We take the view that it is generally preferable to have a single compactclosed-form expression rather than a collection of cases, even if it means intro-ducing some new operations. For example, we are perfectly satisfied using theHeaviside step function and giving the sum of the f i as (cid:80) Ni =1 A i H ( x − k i ).In this paper we show how hybrid sets, a variation on multisets allowingnegative multiplicities, enable us to write elegant closed form expressions of theform we desire. This use of hybrid sets also allows us to define a generalised notionof partition, where symbolically defined parts are combined in more useful waysthan the usual set operations. Our approach unifies and generalises a number ofother techniques, such as the use of oriented regions for domains of integration.Introducing new operators or generalising existing ones to write single closedform expressions is more than just a cosmetic re-arrangement. It allows oneto perform arithmetic and simplifications on whole expressions, and to reasonabout the expression and about the regions themselves. It is already customaryto do this for certain operators. For example, by defining (cid:82) ba f d x = − (cid:82) ab f d x ,it becomes possible to write identities that hold universally. Then we have that,independent of the relative order of a , b and c , and subject to f being definedon the requisite domains, (cid:90) ba f d x = (cid:90) ca f d x + (cid:90) bc f d x. (1)With a little work, we can also generalise the integral formula to integratingover oriented subsets of R n . Some authors similarly adjust the definitions ofother operators to obtain universally true statements. Similarly, Karr [8] definesthe summation operator (cid:80) m (cid:54) i 2) and then their general-isations to our notions of generalised partitions and hybrid functions ( § § § 5) and discussing some concrete examples ( § Preliminaries The domain of definition of various mathematical objects (functions, vectors,matrices, sequences, etc) may naturally be decomposed into a (disjoint) union ofpieces where our object is then defined uniformly. When the pieces are given as anexplicit union of provably disjoint sets which form a partition of the domain, theinterpretation of a given expression is reasonably straightforward. More formally, Notation 1 We use the notation C i ∈ I X i , or, more briefly, C I X i to describe acollection of elements X , X , . . . , indexed by a set I . For n ∈ N , we denote by [ n ] the set { , . . . , n } . Definition 1. A partition of a set U is a collection C I P i of pairwise disjointsets such that (cid:83) I P i = U . A partition, C I P i , induces a total function X : U → I which gives the index of P ∗ where each u ∈ U sits. Piecewise expressions are then defined on top of apartition. Definition 2. A piecewise expression over a set U is a collection C I ( P i , e i ) where C I P i is a partition of U and each e i is an expression. Typically, each e i contains a distinguished variable y which is interpreted torange over U . Definition 3. We say that f : U → S is a piecewise-defined function if we havea collection C I ( P i , f i ) where C I P i is a partition of U , ∀ i ∈ I. f i : P i → S , and ∀ x : U. f ( x ) = f X ( x ) ( x ) . We call C I ( P i , f i ) the definition of f , and each f i a piece of f . It is important to note that piecewise-defined functions use their argument intwo different ways: once geometrically by choosing a set P i “over” which towork, and once analytically to evaluate a function f i . The definitions above arestraightforward generalisations of those found in [5].Lastly, we have that arithmetic operations on piecewise-defined functionsoperate component-wise. Note that we will silently use the convention that op-erations defined on the codomain of a function are lifted pointwise to apply tofunctions, in other words ( f + g )( x ) = f ( x ) + g ( x ). Proposition 1. Let f, g : U → S be two piecewise-defined functions on thesame partition C I P i of U , with C I f i (respectively C I g i ) the collections of piecesof f (resp. g ). Further, let (cid:63) : S × S → S . Then C I ( f i (cid:63) g i ) is the collection ofpieces of f (cid:63) g over the partition C I P i . ote how the partition is entirely untouched. This “separation of concerns” iswhat enables us to separate the issues of domain decompositions from arithmeticissues of piecewise-defined functions (and expressions).To simplify our presentation, we introduce a domain restriction operation anda join combinator on (partial) functions, to allow us a more syntactic methodof “building up” piecewise functions. These are quite similar to Kahl’s tablecomposition combinators [7]. Definition 4. The restriction f A of a function f to a domain specified by a set A is f A ( x ) ::= (cid:40) f ( x ) if x ∈ A ⊥ otherwise Definition 5. The join, f (cid:58) g , of two (partial) functions f and g , is defined as ( f (cid:58) g )( x ) ::= f ( x ) if f(x) is defined and g(x) is undefined g ( x ) if g(x) is defined and f(x) is undefined ⊥ otherwise This allows us to rewrite a piecewise-defined function f defined by C I ( P i , f i ), interms of its pieces as f = f P (cid:58) f P (cid:58) . . . (cid:58) f P n n . But our goal is to work with piecewise-defined functions where we have a symbolic partition. We need some new tools for this, which we will develop inthe next two sections. We consider an extension of multisets, in which elements can occur multipletimes, to hybrid sets , where the multiplicity of an element in a hybrid set canrange over all of Z , instead of just N . Thus a hybrid set, over an underlyingset U , is a mapping U → Z , i.e., it is an element of Z U . We use the followingdefinition, adapted from [9]: Definition 6. Given a universe U, any function H : U → Z is called a hybridset . We can immediately define some useful vocabulary for working with hybridsets. Definition 7. The value of H ( x ) is said to be the multiplicity of the element x . If H ( x ) (cid:54) = 0 , we say that x is a member of H and write x ∈ H ; otherwise,we write x (cid:54)∈ H . The support of a hybrid set is the (non-hybrid) subset S of U where s ∈ S ⇐⇒ s ∈ H ; we will denote the support of H by supp H . We(re)use ∅ to (also) denote the empty hybrid set, i.e. the hybrid set for whom allelements have multiplicity . otation 2 We use the notation {| x m , x m , . . . |} to describe the hybrid set con-taining elements x with multiplicity m , x with multiplicity m , etc. While ournotation allows writing hybrid sets with multiple copies of the same element withdifferent multiplicities, these denote the same hybrid set as that denoted by thenormalised form with one copy of each element with a multiplicity which is thesum of the multiplicities of the copies of that element in the non-normalisedform. Thus (cid:8)(cid:12)(cid:12) a , b , a − , b (cid:12)(cid:12)(cid:9) = (cid:8)(cid:12)(cid:12) a − , b (cid:12)(cid:12)(cid:9) . Set unions are usually defined by the boolean algebra structure (and morespecifically, via ∨ ) of the membership relation. For hybrid set, this is replacedby arithmetic over Z . Definition 8. We define the sum, A ⊕ B of two hybrid sets A and B over auniverse U , to be their pointwise sum. That is ( A ⊕ B )( x ) = A ( x ) + B ( x ) for all x ∈ U . We similarly define their difference, A (cid:9) B to be their pointwise difference,and their product, A ⊗ B to be their pointwise product. Let (cid:9) B denote ∅ (cid:9) B . In other words, we do not use operations A ∪ B , A ∩ B and A \ B for hybrid sets,but just ⊕ , (cid:9) and ⊗ . We can easily establish some identities such as ( A ⊕ B ) (cid:9) A = B , A (cid:9) A = ∅ and A ⊕ ( (cid:9) B ) = A (cid:9) B as these follow directly from Z .Putting all of this together, we get: Proposition 2. Z U is a Z -module.Proof. The abelian group structure is given by ( Z U , ⊕ , (cid:9) , ∅ ), and Z acts onhybrid sets by nH = u (cid:55)→ n · H ( u ).We need two more technical definitions, which will be useful later. Definition 9. We say that two hybrid sets A and B are disjoint if A ⊗ B = ∅ . Definition 10. We call a hybrid set reducible if all its members have multiplic-ity . We define a reduction function, R ( · ) , on reducible hybrid sets that returnsthe (normal) set of members of the hybrid set. We should note that these hybrid sets (sometimes also called generalised sets)have been studied before. Hailperin [6] makes the case that Boole [3] actuallystarted from hybrid sets for his algebraization of logic, but restricted himselfto nilpotent solutions of the resulting equations, which then correspond closelyto our modern notion of Boolean algebra. Whitney wrote two nice papers [13,14] taking up the theme of algebraising logic via characteristic functions. Hedoes allow arbitrary multiplicities, and derives some nice normal forms for cer-tain kinds of partitions, in a way foreshadowing some of our own results (see § § Generalisations We now revisit a few basic mathematical constructs and show how they maybe modified to work with hybrid sets. This will provide the machinery that weneed for symbolic domain decomposition. First, we will examine the notion of ahybrid function on a domain. We then show how sets and hybrid sets may bedecomposed using a notion of generalised partitions — an extension of parti-tions to the hybrid set case. We then address the practical issue of how to maketwo hybrid partitions compatible by constructing a common refinement. Finally,when working with functions defined over hybrid partitions, we need some wayto compute values. Over any given point in the domain, we need to know whichfunctions must be evaluated in computing the final value, which is rather com-plex for hybrid functions over generalised partitions. For this task, we introducethe notion of pseudo-functions. When expressions on generalised partitions areevaluated, these pseudo-functions avoid evaluating at places where the functionsare undefined or where the values are not needed. This allows us to deal with thecases, as in equation (1), where component functions are not defined on someparts of the domain decomposition but any application of the function in thoseplaces would anyway have multiplicity zero ( i.e. not be used). It turns out that a useful definition of a “function” involving hybrid sets is notentirely straightforward. Defining its graph is easiest. The underlying intuitionis that we capture the restriction of a function to a domain through the mul-tiplicities of the elements of the function graph in a hybrid set. The hybrid setof a single element of the function graph for element x in U is of the form (cid:8)(cid:12)(cid:12) ( x, f ( x )) (cid:12)(cid:12)(cid:9) . Therefore the scalar multiplication of that set by the multiplicityof x in A will impose the appropriate restriction. We use our function restrictionnotation of Def. (4) only for this hybrid version of function restriction henceforth. Definition 11. Let A be a hybrid set over U , B ⊆ U , S a set and f : B → S a(total-on- B ) function. A hybrid function f A : U × S → Z is defined by f A = (cid:77) x ∈ B A ( x ) (cid:8)(cid:12)(cid:12) ( x, f ( x )) (cid:12)(cid:12)(cid:9) Note how the hybrid set Z -module structure automatically takes care of re-stricting the sum over the support of A . Caution: some hybrid sets do not forma hybrid function (for example (cid:8)(cid:12)(cid:12) (1 , , (1 , (cid:12)(cid:12)(cid:9) is not a hybrid function).Our definitions work just as well with partial functions as with total functions.But if for a hybrid function f F , f is undefined at some point in the support of F , f F will not be defined at that point either. So, without loss of generality, wecan always restrict F to where f is defined. For the remainder of this paper, weshall assume this, i.e. whenever we write a hybrid function f F , f is total oversupp F . efinition 12. We call a hybrid function f H reducible if the hybrid set H isreducible. We extend R ( · ) in this case by R ( f H )( x ) = (cid:40) f ( x ) if H ( x ) = 1 ⊥ if H ( x ) = 0We can generalise the join combinator to hybrid sets. This definition is quitecentral to “making things work”. Definition 13. The join, f F (cid:58) g G , of two hybrid functions f F and g G (withcodomain B ), gives a hybrid relation , a subset of U × B × Z given by f F (cid:58) g G ::= f F ⊕ g G This is a rather “dangerous” definition, as it moves us from the land of functionsto that of relations. In other words, it is quite possible that f F (cid:58) g G restricted to U × B is no longer the graph of a function, but the graph of a relation. But thisextra generality will be quite useful for us, although we will have to prove that inthe cases which interest us, the resulting hybrid relations are in fact (reducible)hybrid functions. Theorem 1. Let A , B be hybrid sets over U , S an arbitrary set, and f : U → S a total function. Then1. R ( f ∅ ) is the empty function,2. f A (cid:58) f A = f A f A (cid:58) f B = f A ⊕ B , and thus a hybrid function,4. For g : U → S another total function, then f A (cid:58) g B = ( f (cid:58) g ) A ⊕ B if andonly if A ⊕ B = ∅ (where f (cid:58) g is the join of regular functions).5. Let H , H be hybrid sets, with supp H and supp H disjoint, f : supp H → S and f : supp H → S , then f H (cid:58) f H = ( f (cid:58) f ) H ⊕ H The proofs are omitted, and follow straightforwardly from the definitions. Notethe strong dichotomy between (3) and (4), which comes from the fact that thenon-hybrid (cid:58) is designed to work with functions defined over separate regions. Theorem 1 tells us that some collections of hybrid sets are better than others.Being disjoint is much too strong a property. Nicely, for hybrid sets, partitionseasily generalise in useful ways. Definition 14. We define a generalised partition of a (hybrid) set, P , to be afinite collection of hybrid sets, C [ n ] P i , such that P ⊕ P ⊕ . . . ⊕ P n = P All set partitions of a set are also generalised partitions. Conversely, a generalisedpartition of a reducible set is a set partition if and only if each generalisedpartition element is reducible. emark 1. We have lifted the disjointness condition on partitions. For some-thing to be called a partition of P , it is necessary that the result be equal to P .Still, P belongs to a larger universe U , and a generalised partition’s pieces rangeover U . As long as, in the end, all elements of U \ P have multiplicity 0, we geta generalised partition. In this way, we have also lifted the coverage condition. Proposition 3. For any generalised partition C [ n ] P i of a hybrid set P over U ,arbitrary set S , and any function f : supp P → S , f P = f P (cid:58) f P (cid:58) . . . (cid:58) f P n = f P ⊕ P ⊕ ... ⊕ P n is a hybrid function. For brevity, we sometimes write f P for either of the right-hand side expressionsabove. When we want to join different functions over a partition and still get afunction, we have to be careful and ensure we are joining “compatible” functions. Definition 15. Let P , P be a generalised partition of a hybrid set P over U , S an arbitrary set and f P : P → S , g P : P → S hybrid functions. Wesay that P , P is a compatible partition for f, g if f ( x ) = g ( x ) for all x ∈ supp P ∩ supp P . Theorem 2. Using the same notation as above, f P (cid:58) g P is a hybrid functionif and only if P , P is a compatible partition for f, g . It is important to note that although (cid:58) is an associative, commutative oper-ation, the notion of compatibility, while commutative, does not lift to a simpleassociative condition. Remark 2. Some of our computations will purposefully use incompatible parti-tions. Note that( f U (cid:58) g U ) (cid:58) g (cid:9) U = f U (cid:58) ( g U (cid:58) g (cid:9) U ) = f U (cid:58) g ∅ = f U but that f U (cid:58) g U is in general a hybrid relation, yet the final result is a hybridfunction whenever f U is. We will “design” our hybrid partitions with this featurein mind. To do arithmetic with hybrid functions, we first need the notion of a refinementand a common refinement. This is similar to the treatment of [5] for piecewisefunctions. Definition 16. A refinement of a generalised partition C I P i of P is anothergeneralised partition C J Q j (of another hybrid set Q not necessarily equal to P )such that for every i ∈ I there exists a sub-collection Q j k of Q j such that P i = Q j ⊕ Q j ⊕ . . . ⊕ Q j m . A common refinement of a set of generalised partitionsis a generalised partition that is simultaneously a refinement to every partitionin the set. refinement in this sense may well seem “larger” than the original partition, asin the next example. Example 1. Let the interval P = [0 , (cid:8)(cid:12)(cid:12) P (cid:12)(cid:12)(cid:9) , and I = [ − , I =(1 , I = [ − , Q = (cid:8)(cid:12)(cid:12) I − , I − , I (cid:12)(cid:12)(cid:9) is a refinement of P . Definition 17. A refinement is called strict if, for each generalised partitionbeing refined, the support of the associated sub-collection is equal to the supportof the generalised partition it refines.Example 2. (cid:8)(cid:12)(cid:12) [0 , (cid:12)(cid:12)(cid:9) , (cid:8)(cid:12)(cid:12) (1 , (cid:12)(cid:12)(cid:9) , (cid:8)(cid:12)(cid:12) (2 , (cid:12)(cid:12)(cid:9) is a common strict refinement of thetwo (trivial) hybrid partitions (cid:8)(cid:12)(cid:12) [0 , (cid:12)(cid:12)(cid:9) and (cid:8)(cid:12)(cid:12) (1 , (cid:12)(cid:12)(cid:9) . As seen in the example above, a refinement may “spill over” the original domain,so that if we look at a hybrid function f P where the underlying f is definedexactly on (the support of) P , f Q evaluated “pointwise” will not make sense.Nevertheless, we want f P = f Q . To achieve this, we apply the lambda-liftingtrick already used in [5]. Definition 18. Using the same notation as in Def. 11, we define a pseudo-function ˜ f A as ˜ f A = (cid:77) x ∈ B A ( x ) (cid:8)(cid:12)(cid:12) ( x, f ) (cid:12)(cid:12)(cid:9) i.e. as a member of U × ( U → S ) → Z . A pseudo-relation is defined similarly.The evaluation of a pseudo-function (resp. relation) is defined by mapping eachpoint ( x, f ) k to ( x, f ( x )) k . The usefulness of pseudo-functions comes from the following property. Proposition 4. For all refinements Q of the generalised partition P , ˜ f P = ˜ f Q . In other words, even though the pieces of Q might “spill over”, if we first “sim-plify” ˜ f Q by performing (cid:76) i Q i to get P , we get a result ˜ f P which can then besafely evaluated. We will elide the ˜ to lighten the notation whenever this wouldnot lead to confusion.Another useful property of pseudo-functions is that in some cases we cansimplify them, regardless of what the underlying function does. Proposition 5. ˜ f P (cid:58) ˜ g Q (cid:58) ˜ g (cid:9) Q = ˜ f P One of the chief advantages of pseudo-functions is that we can do some symbolicmanipulations of expressions in terms of these functions as if they were definedon a much larger domain, as long as the eventual term we evaluate does notinvolve any of these “virtual” terms.To aid in such computations, when we have pseudo-functions ˜ f P and ˜ g P ,with f, g : supp P → S , and some binary operation (cid:63) : S × S → S , we will allowurselves to write expressions such as ˜ f P (cid:63) ˜ g P in the induced term algebra overpseudo-functions. As usual, we lift evaluation pointwise, ( ˜ f (cid:63) ˜ g )( x ) = f ( x ) (cid:63) g ( x ).Furthermore we say that ˜ f = ˜ g over a set supp P whenever ∀ x ∈ supp P.f ( x ) = g ( x ). In other words, we use extensional equality for the intensional terms ˜ f and ˜ g . This means that properties like commutativity, associativity and havinginverses lift to the term algebra. As an example, we have that Proposition 6. If (cid:63) : S × S → S is associative and commutative then ˜ g Q (cid:63) ˜ f P (cid:63) ˜ g (cid:9) Q = ˜ f P We now have all the ideas necessary to decompose hybrid domains. An elegantconsequence of the formalism is that it allows us to use linear algebra to constructthe partitions that we require.Let C [ n ] A i and C [ m ] B j , be generalised partitions of U . We want to find ageneralised partition of U that is a common strict refinement of A i and B j andhas minimal cardinality. The cardinality restriction is to minimise the numberof terms required for a symbolic representation of the resulting domain decom-position. Thus we want to choose a minimal generalised partition, C I P i of U such that, in the Z -module of hybrid sets and for some integers a i,j , b i,j we have (cid:76) i P i = U and ∀ i : 1 ..n. (cid:76) j a i,j P j = A i and ∀ j : 1 ..m. (cid:76) i b i,j P i = B j .Since this forms a system of n + m + 1 simultaneous equations, of whichonly n + m − A and B are, separately, partitionsof U , we need that number of independent variables to solve the system. Thusthe cardinality of the minimal partition is n + m − U, A , . . . , A n − , B , . . . , B m − .This result generalises to a decomposition of U into a minimal generalisedpartition that is a common strict refinement of r generalised partitions of car-dinality n , . . . n r respectively: The minimal partition required, assuming fullindependence of the individual domain partitions, has cardinality (cid:32) r (cid:88) i =1 n i (cid:33) + 1 − r If all the individual partitions have the same cardinality, n , this reduces to r ( n − 1) + 1.We can automatically compute suitable minimal strict refinement partitions U as follows. If we remove the equations for A n and B m from the system ofequations in order to get an independent set of simultaneous equations, we get + m − Z -module: C · P ... P n + m − = UA ... A n − B ... B m − where C = . . . a , a , . . . a ,n + m − ... ... a n − , a n − , . . . a n − ,n + m − b , b , . . . b ,n + m − ... ... b m − , b m − , . . . b m − ,n + m − Note that C is an integer matrix. Further, the partition choice matrix, C ,must be invertible and C − must be an integer matrix so that we obtain integralpartitions of each domain piece with respect to our partition P of U . An integermatrix is invertible and has an integer matrix inverse if and only if it has adeterminant of +1 or − 1. Hence our problem of constructing an appropriatepartition reduces to choosing an integer matrix of the form of C such that itsdeterminant is ± 1. Finally, note that this directly generalises to an arbitrarynumber of piecewise functions, each of an arbitrary number of pieces.If we restrict ourselves to triangular matrices, we can choose C to be anyinteger triangular matrix (upper because the first row of C is all 1s) for whichthe product of the diagonal elements is 1. Again, a simple way to do this is tochoose C to be all 1s along the top row, 1s along the diagonal and 0 everywhereelse. Another possibility is all 1s in the whole upper triangle.For example, two suitable choice matrices with their inverses are . . . . . . . . . 10 1 0 . . . . . . . . . − = − . . . . . . − 10 1 0 . . . . . . . . . . . . . . . 10 . . . ...... . . . . . . ...0 . . . − = − . . . 00 . . . . . . . . . ...... . . . . . . . . . 0... . . . . . . − . . . . . . We are now ready to generalise the arithmetic properties (see prop. 1) of hybridfunctions and pseudo-functions. Proposition 7. Let C [ n ] P i be a partition of P , f P = f P (cid:58) . . . (cid:58) f P n n and g P = g P (cid:58) . . . (cid:58) g P n n be two hybrid functions on P → S . Let (cid:63) : ( S × S ) → S , then forall x ∈ supp P , f P ( x ) (cid:63) g P ( x ) = ( f ( x ) (cid:63) g ( x )) P (cid:58) . . . (cid:58) ( f n ( x ) (cid:63) g n ( x )) P n . ote how we can apply the above proposition to f F (cid:63) g G , by first restricting F and G to be over a common support (as x (cid:63) ⊥ = ⊥ (cid:63) y = ⊥ ), then taking acommon strict refinement of (the restricted) F and G .We would like to lift this strictness condition. We can almost do this withpseudo-functions – and with the help of a marked (cid:58) , we can. Definition 19. We can mark a (cid:58) with a binary operation (cid:63) : S × S → S ,denoted (cid:58) (cid:63) . We define evaluation of (cid:58) (cid:63) by ( ˜ f F (cid:58) (cid:63) ˜ g G )( x ) = ( F ( x ) + G ( x )) (cid:110)(cid:12)(cid:12)(cid:12) ( x, ( ˜ f (cid:63) ˜ g )( x )) (cid:12)(cid:12)(cid:12)(cid:111) This operation clearly inherits properties of (cid:63) like commutativity, associativityand invertibility. Unlike (cid:58) , (cid:58) (cid:63) will always result in a (pseudo) function. Proposition 8. Let P ∗ = C [ n ] P i be a partition of P , Q ∗ = C [ m ] Q j anotherpartition of P , and R ∗ = C K R k a common refinement of P ∗ and Q ∗ . Let ˜ f P = f P (cid:58) . . . (cid:58) f P n n and ˜ g P = g Q (cid:58) . . . (cid:58) g Q m m be two pseudo functions with codomain S . Let (cid:63) : ( S × S ) → S , be associative and commutative, then (cid:63) distributes overthe partition R ∗ in terms of (cid:58) (cid:63) . By the results of section 4, we can always choose R ∗ to be P ⊕ . . . ⊕ P n − ⊕ Q ⊕ . . . ⊕ Q m − ⊕ ( U (cid:9) ( P ⊕ . . . ⊕ P n − ⊕ Q ⊕ . . . ⊕ Q m − )) Example 3. Let A = [0 , a ) , A = [0 , \ A , B = [0 , b ) , B = [0 , \ B , all seenas hybrid sets. Let f ( x ) = (cid:40) ≤ x < a a ≤ x < g ( x ) = (cid:40) ≤ x < b b ≤ x < A , B (cid:9) A , B , which simultaneouslyrefines both. Then after a few computations we get f ∗ g = {| ∗ |} A (cid:58) ∗ {| ∗ |} B (cid:9) A (cid:58) ∗ {| ∗ |} B (2)regardless of whether a < b or a ≥ b ; in fact either (or both) could be outside of[0 , 1) and the result, interpreted as a hybrid function, are still correct. Movingfrom one choice of partition to another is done by undoing the distribution,performing the change of partition, and using commutativity and associativityto regroup like terms. Note that we should have written 2 ∗ x (cid:55)→ ∗ ( x (cid:55)→ interpreted properly in eachcontext. .2 Identities for invertible operators When the binary operation we use is invertible, we can perform the operationsat any time, as operands may later be removed from a cumulative result byapplying their inverses. This may lead to considerable efficiency improvements;even though values and their inverses are cancelled in the calculation (leadingto no net effect) this may be more efficient than retaining an “un-evaluable”expression as a pseudo-function. Proposition 9. Let f P be a hybrid function over S where ( S, (cid:63) ) has the struc-ture of an Abelian group (where we will use e for the unit and − for the inverse),then for all x ∈ supp P , ( f P (cid:63) f − P )( x ) = ( f P (cid:63) ( − f ) P )( x ) = P ( x ) (cid:8)(cid:12)(cid:12) ( x, e ) (cid:12)(cid:12)(cid:9) where − f denotes x (cid:55)→ − f ( x ) . Both equalities follow readily from the definitions. For a linear operator L , and f P a hybrid function, L ( f P ) ::= L ( x (cid:55)→ P ( x ) · f ( x ))Note L ( f P ) may not be defined even when L ( f ) is. If the multiplicity function P ( x ) is uniformly bounded, then it will exist. Proposition 10. Let f P be a hybrid function, C [ n ] P i a partition of P such thateach P i ( x ) is uniformly bounded, then L ( f P ) = n (cid:88) i =1 L ( f P i )The above is the fundamental reason why, under Karr’s definition, the summa-tion identities of the introduction hold. Corollary 1. For all total functions f : Z → G with G an Abelian group, andall (cid:96), m, n ∈ Z , (cid:88) (cid:96) (cid:54) i Earlier work [10, 11] introduced The idea of support functions has been intro-duced previously to represent symbolic matrices — matrices given in terms ofsymbolic regions with underspecified elements and symbolic dimensions — anddefined arithmetic operations between them. The paper [10] presented a sup-port function based on half-plane constraints that enables full arithmetic, butthat suffered from a combinatorial explosion in the number of terms needed toexpress sum or product matrices. The paper [11] moved to a support functionbased on interval addition that automatically dealt with cancellation for neg-ative intervals. While this avoided the combinatorial explosion, the approachwas restricted to certain types of regions and could not be easily generalised tomatrix multiplication. Hybrid functions and generalised partitions solve both ofthese problems simultaneously. We demonstrate this with the example of matrixaddition of two 2 × M = (cid:18) A B C D (cid:19) , M = (cid:18) A B C D (cid:19) where M and M are n × m matrices, A and A are of dimensions h × k and h × k respectively, n, m, h , h , k , k ∈ N .Let U = { ( i, j ) | (cid:54) i (cid:54) n ∧ (cid:54) j (cid:54) m } be the set of all cell points in thematrices. We define the region occupied by a matrix block similarly, and referboth to a matrix block and to the region it occupies by the same name, relyingon context to distinguish them. We can thus write M = A A (cid:58) B B (cid:58) C C (cid:58) D D , M = A A (cid:58) B B (cid:58) C C (cid:58) D D (3)To calculate M + M we: (1) Choose a suitable generalised partition P ∗ of U . (2) Rewrite each block of each matrix into terms restricted to the chosenpartition. (3) Substitute into the expressions for the matrices. (4) Add the twomatrices region-wise.As established in the section 4, the maximal number of partitions requiredin our case is 4 + 4 − A , B , C , A , B , C and obtain the seventh, P , by subtracting all otherregions from the universe U , P = U (cid:9) ( A ⊕ B ⊕ C ⊕ A ⊕ B ⊕ C ) . (4)We can then express regions D and D in terms of P : D = U (cid:9) ( A ⊕ B ⊕ C ) = P ⊕ A ⊕ B ⊕ C , and D = P ⊕ A ⊕ B ⊕ C .Rewriting M , M from Eq. (3), we get: M = A A (cid:58) B B (cid:58) C C (cid:58) D P ⊕ A ⊕ B ⊕ C = D P (cid:58) A A (cid:58) B B (cid:58) C C (cid:58) D A (cid:58) D B (cid:58) D C M = D P (cid:58) D A (cid:58) D B (cid:58) D C (cid:58) A A (cid:58) B B (cid:58) C C his lets us express the sum of the two matrices as the following pseudo-function: M + M = ( D + D ) P (cid:58) + ( A + D ) A (cid:58) + ( B + D ) B (cid:58) + ( C + D ) C (cid:58) + ( D + A ) A (cid:58) + ( D + B ) B (cid:58) + ( D + C ) C (5)Observe that the seven terms of the hybrid function fully capture the result of thematrix addition independent of the order of the symbolic dimensions h , h , k , k of the original blocks. We demonstrate this by evaluating the function for acouple of concrete points in the sum matrix.First let h < h and choose a concrete value of a cell ( i, j ) where h < i ≤ h and 1 ≤ j < k , k . The point should therefore be in a region composed ofelements from B and A . Instantiating the multiplicities in equation (5) ver-ifies this. Observe that indeed the only regions with multiplicity 1 are B = { ( i, j ) | h (cid:54) i (cid:54) n ∧ (cid:54) j (cid:54) k } and A = { ( i, j ) | (cid:54) i (cid:54) h ∧ (cid:54) j (cid:54) k } whereas the multiplicities for A , B , C , C are all 0. Furthermore, we cancompute the multiplicity for P using equation (4). Since the multiplicity ofthe universe U is always 1 — every element is in this partition — we get1 − (0 + 1 + 0 + 1 + 0 + 0) = − 1. This then yields the computation below,which confirms that our element is indeed in the anticipated region (where wewrite region-wise sets (cid:8)(cid:12)(cid:12) ( D + D ) − (cid:12)(cid:12)(cid:9) as ( D + D ) − to alleviate notation)( D + D ) − (cid:58) + ( B + D ) (cid:58) + ( D + A ) = B (cid:58) + A = B + A Now assume that the order of the symbolic dimensions for blocks A , A isreversed and we have h < h . If we now compute the value of a cell with ( i, j )with h < i ≤ h and 1 ≤ j < k , k , we get 0 multiplicity for regions B , A ,but instead multiplicity 1 for A , B . Again the multiplicity for P is − A + B region.As a final example we compute cell ( i, j ) with h , h < i ≤ n and k , k 1. That is, the segments are parameterisedwith respect to two knots and their values. Let P = P ⊕ . . . ⊕ P n with P i =[ c i − , c i ] be a generalised partition. We then define a symbolic spline function S ( x ) = S P c ,c ( x ) (cid:58) · · · (cid:58) S c n − ,c n ( x ) P n . For clarity we often omit the ( x ) part ofthe term.Define the merge of two spline segments S Pa,b (cid:111)(cid:110) S Qa (cid:48) ,b (cid:48) to be S P ⊗ Qmax ( a,a (cid:48) ) ,min ( b,b (cid:48) ) .Clearly this merge will be empty if the two segments do not overlap, otherwise itwill be the smallest possible spline for the overlapping interval of the segments.Now let P ⊕ · · · ⊕ P n and Q ⊕ · · · ⊕ Q m be two generalised partitions of theinterval [ a, b ] and let S = S P c ,c (cid:58) · · · (cid:58) S P n c n − ,c n and T = T Q d ,d (cid:58) · · · (cid:58) T Q m d m − ,d m betwo symbolic splines. Observe that the d i here are knots and not knot values. Wecan then define the merge S (cid:111)(cid:110) T as a binary operation on two hybrid functionsas given above in proposition 8.We observe the merge operation using a simple example. Let P = P ⊕ P and Q = Q ⊕ Q be the generalised partitions a < c < b and a < d < b of our universe[ a, b ], respectively. Let S = S P a,c (cid:58) S P c,b and T = T Q a,d (cid:58) T Q d,b be two symbolic splines.We choose a common refinement as P , Q , R = U (cid:9) ( P ⊕ Q ). We can thenwrite S = S P a,c (cid:58) S R ⊕ Q c,b = S P a,c (cid:58) S Rc,b (cid:58) S Q c,b and similarly T = T Q a,d (cid:58) T P d,b (cid:58) T Rd,b .When we merge both symbolic splines we get S (cid:111)(cid:110) T = ( S a,c (cid:111)(cid:110) T d,b ) P (cid:58) (cid:111)(cid:110) ( S c,b (cid:111)(cid:110) T a,d ) Q (cid:58) (cid:111)(cid:110) ( S c,b (cid:111)(cid:110) T d,b ) R (7)If we now fix the order of our symbolic knots to be a < c < d < b we canevaluate the three components of our spline. First let a ≤ x ≤ c , which means P = Q = 1 and R = − S a,c (cid:111)(cid:110) T a,d which yields a splinebetween knots a, c . Similarly the other two segments evaluate S c,b (cid:111)(cid:110) T a,d and S c,b (cid:111)(cid:110) T d,b , which yields splines for the intervals [ c, d ] and [ d, b ], respectively. We have presented a framework of generalised partitions and domain decompo-sition based on hybrid sets. This framework has a number of pleasing propertiesand unifies a number of ad hoc notions in common use. More importantly for ourpurposes, this representation allows easy manipulation of and reasoning aboutpartitions whose pieces are defined symbolically. These specialise correctly forall choices of parameters by negative and positive multiplicities cancelling asneeded. The representation (see for example equation (2)) needs to be carefullyinterpreted, as out of context simplification can result in meaningless results.But if the rules we lay out are followed, our compact representation effectivelyallows one to compute with very general piecewise-defined functions.Although a number of previous authors have studied hybrid sets, our studyof functions over hybrid sets, generalised partitions, the superposition (cid:58) andarked superposition (cid:58) (cid:63) operators appear to all be new. Our applications tocomputation and reasoning are certainly new.There remain several intriguing directions for future work. These includenormal forms for piecewise functions defined on hybrid partitions, simplifica-tion of intermediate expressions involving linear operators or inverse elementsand creating partition schemes from algebraic specialisation properties, e.g. inCylindrical Algebraic Decomposition. We have implemented a prototype Maplepackage for hybrid sets and hybrid functions, but a more general implementationwould be of interest. References 1. Wayne D. Blizard. Multiset theory. Notre Dame Journal of Formal Logic , 30(1):36–66, Winter 1989.2. Wayne D. Blizard. Negative membership. Notre Dame Journal of Formal Logic ,31(3):346–368, 1990.3. George Boole. An investigation of the laws of thought, on which are founded themathematical theories of logic and probabilities . Walton and Maberly, London,1854. Available at .4. M.S. Burgin. Concept of multisets in cybernetics. Cybernetics and Systems Anal-ysis , 28(3):469–371, 1992.5. J. Carette. A canonical form for piecewise defined functions. In Proc. of ISSAC2007 , pages 77–84. ACM Press, 2007.6. Theodore Hailperin. Boole’s Logic and Probability . North-Holland Publishing Com-pany, 1 st /2 nd edition, 1976/1986.7. W. Kahl. Compositional syntax and semantics of tables. SQRL Report 15, De-partment of Computing and Software, McMaster University, 2003. available from .8. M. Karr. Summation in finite terms. J. ACM , 28(2):305–350, 1981.9. D. Loeb. Sets with a negative number of elements. Advances in Mathematics ,91(1):64–74, 1992.10. A.P. Sexton, V. Sorge, and S.M. Watt. Computing with abstract matrix structures.In Proc. of ISSAC’2009 , pages 325–332. ACM Press, 2009.11. A.P. Sexton, V. Sorge, and S.M. Watt. Reasoning with generic cases in the arith-metic of abstract matrices. In Proc. of Calculemus 2009 , LNAI 5625. SpringerVerlag, 2009.12. A. Syropoulos. Mathematics of multisets. In Cristian Calude, Gheorghe Paun,Grzegorz Rozenbeg, and Arto Salomaa, editors, Multiset Processing , volume 2235of LNCS , pages 347–358. Springer, 2001.13. Hassler Whitney. A logical expansion in mathematics. Bulletin of the AmericanMathematical Society , 34(8):572–579, August 1932.14. Hassler Whitney. Characteristic functions and the algebra of logic. Annals ofMathematics , 34(3):405–414, July 1933.