# Mathematics and Clinical Concepts, Part IV: Exploring Sets

by on November 4, 2013 · 0 comments

Everything can be expressed as a set—the rooms in a building, the providers in a practice, penicillins—everything.  When one studies the basics of set theory – unions, intersections, subsets and the like—the concepts seem so simple, even obvious, that it is difficult to believe that Georg Cantor  had to dream them up and then convince others use them.

My introduction to sets occurred in elementary school under the guise of the “New Math.”   Sets made sense; after all, they are a nice way of grouping things. But in sixth grade, I really did not have a pressing need to group things.   I’m afraid the New Math ruined my introductions to sets.   Perhaps this is true for many outside of the field of mathematics.

I brought my indifference toward sets to the study of discrete math, and it has taken some time for me to see why Susanna Epp, in discussing the impact of Cantor’s work on set theory, states:

Many mathematicians of his time resisted accepting the validity of Cantor’s work.  Now, however, abstract set theory is regarded as the foundation of mathematical thought. All mathematical objects (even numbers!) can be defined in terms of sets, and the language of set theory is used in every mathematical subject (1).

My appreciation for the utility of set theory (aside from teaching MEDLINE searching) did not develop until I became familiar with relations and functions–especially functions.   Whereas before, I thought of a function as something that returned a value—the influence of programming languages and continuous mathematics—after studying discrete math, I came to see a function as a way of generating a set from a set.  From there I came to see that, taken together, input, output and whatever transformation method bound them, really could describe everything I was interested in studying.  New Math notwithstanding, I am “all in” on sets!

Set Basics
A set is an unordered collection of elements (1).   The elements need not be of the same type.   The set {elephant, 1, house} is just as legitimate as the set {1, 2, 3, 4}.    Sets may be written using set-roster notation (all of the members are listed) or using set-builder notation (a formula is given for generating set members).

Set-Roster Set-builder In plain English this can be read, “the set of all x in Z such that 0<x<6.”  Z is the symbol for the set of integers from the German word for numbers Zahlen.

Set-builder notation is obviously better for large sets.   A major benefit of using the set-builder notation approach is the ease with which it can be translated to programming code.   For example, in an EHR keeping track of abnormal lab values is important.  Assuming we are talking about serum potassium levels, the normal range is usually 3.5-5.1 meq/dl.   We can express this normal range as a set. Here,  K is the set of all possible serum potassium values.   Notice that this normal range could be written as a universal implication: For all K+ values x, IF x is >=3.5  AND  x <=5.1, THEN x is normal.

In programming code, we can create a function that accepts a serum K+ result and provides an alert if the value is outside of normal range.

IF (K_Value >=3.5  AND  K_Value <=5.1)
THEN
Return OK;
ELSE
END IF

Decisions can still be made using set elements even when using set-builder notation is not feasible.  For example, assuming that specific terms are used to report peripheral smear results, the set of terms {microcytic, hypochromic, target cell, macrocytic} could be used as the basis of a function that scans a result string and raises an alert if any terms in the set are found in the result string.

Set operations
Basic set operations are, for the most part, simple.  Given two sets A={1, 2, 3, 4, 5) and B={3,5,7,9}  the intersection  of A with B contains those elements common to both. The union of A with B contains all elements found in both. The difference of B and A (B-A, B minus A) contains all of the elements in B that are not in A, {7,9}.

Anyone who has done a MEDLINE search has made use of set operations.  For example, searching for CAD returns a set.  Finding all articles that deal with CAD and DM could be accomplished by searching for each term separately and then using set intersection.

Pooling both sets (union) is done using OR.

Subsets
A subset is a relation between two sets (1).   Assuming M = {A, B, C} and N= {A, B, C, D, E}, M is a subset of N because each element of M is also an element of N.  This means that every set is a subset of itself.   A proper subset places additional restrictions on this relation.    In order for M to be a proper subset of N, there must be elements in N that are not in M.  In symbols this becomes:

(subset–elements A, B, and C are in both sets) (proper subsetN elements D and E  are not in M) Cartesian products
Looking at Cartesian products, one begins to see how sets can be used to represent more complex facts about the real world.   The output of a Cartesian product is a set consisting of ordered pairs.  The process for generating the Cartesian product is straightforward—the elements of each set are paired with those of another in a way such that every element of each set is paired with one from the other.

F= {A,B,C}  G = {1, 2, 3}

Cartesian product = F x G  (read “F cross G”)

F x G = {(A,1), (A,2) , (A,3) , (B,1) , (B,2) , (B,3) , (C,1) , (C,2) , (C,3)}

The Cartesian product, F x G, consists of ordered pairs in which the first element is taken from F and the second from G. Order is important; G x F is not the same as F x G.  Okay, so we have paired off elements of both sets.  So what?  Consider this: how many concepts can be represented using order pairs?  Graphs of equations are the most obvious use for ordered pairs, but what about the input and output of the equation itself.   The ordered pair (2, 4) could be the input and output of f(x)=x2.    In a workflow diagram, the movement of a patient from waiting to registered could be represented by the ordered pair (waiting, registered).  In fact, anything that moves from one state to the next can be represented as (state1, state2).

Clinical concepts are readily represented using ordered pairs [e.g., current medications:(Patient, Medication);  active problems:(Patient, Problem); pending tests:(Patient, Test)].

Tuples
Cartesian products are not limited to only two sets at a time.   Multiple sets might be used.   For example, if five sets are used (e.g., K x L x M x N x O), the result will be an ordered structure (k, l, m, n, o) where each member is taken from one of the originating sets.  This structure is referred to as a tuple.  Our example using five sets would result in a set of ordered 5-tuples.  Ordered 2-tuples are called ordered pairs and ordered 3-tuples are called ordered triples.  Ordered tuples generated from n number of sets are called n-tuples.

Of course, simply generating ordered pairs by doing Cartesian products is not very helpful.  The pairs must be meaningful.  Clinical care is replete with ordered pairs and n-tuples, as any relational database designer knows.   The challenge then is determining how one might use these concepts to describe clinical care mathematically or use them to design clinical information systems.

Making the jump to describing clinical care states/processes and building information systems requires more than the ability to generate tuples.  Rules and algorithms are required to say what operations are permitted and how they may be performed.  Relational algebra/relational databases made the jump from math to technology for data storage and manipulation. Graph theory/Petri nets did the same for processes and workflows.    Both are excellent examples of abstract mathematical concepts giving rise to real-world technologies.  There is no reason this cannot be done for clinical care and clinical information systems.  Ordered pairs and tuples are relations, and the next post will take a closer look at relations and how they may be used to describe clinical concepts.

1. Epp SS. Discrete Mathematics with Application, Fourth Edition. Belmont, CA: Thomson-Brooks/Cole; 2010