Does your business have logic that is more or less complicated than filing your taxes?
Most business logic is at least as complicated. But most business rule metaphors are not up to expressing tax regulations in a simple manner. Nonetheless, the tax regulations are full of great training material for learning how to analyze and capture business rules.
For example, consider the earned income credit (EIC) for federal income tax purposes in the United States. This tutorial uses the guide for 2003, which is available here. There is also a cheat sheet that attempts to simplify the matter, available here. (Or click on the pictures.)
What you will see here is typical of what business analysts do to clarify business requirements, policies, and logic. Nothing here is specific to rule-based programming. If this seems tedious, just rely on someone else to do it. There is no avoiding it. Really! We are certainly able and willing to help, whether to teach your staff or outsource the effort. Our objective here is not as much to solicit your business but to help those who are new to this succeed. Specifically, this is for my friend, PS.
The EIC publication has the following chapters:
- Chapter 1. Rules for Everyone
- Chapter 2. Rules If You Have a Qualifying Child
- Chapter 3. Rules If You Do Not Have a Qualifying Child
- Chapter 4. Figuring and Claiming the EIC
- Chapter 5. Disallowance of the EIC
- Chapter 6. Advance Payment of EIC in 2004
- Chapter 7. Detailed Examples
For tutorial purposes, we are primarily concerned with the first four chapters.
Chapter 1. Rules for Everyone
This chapter discusses Rules 1 through 7. You must meet all seven rules to qualify for the earned income credit. If you do not meet all seven rules, you cannot get the credit and you do not need to read the rest of the publication.
Note. If you meet all seven rules in this chapter, then read either chapter 2 or chapter 3 (whichever applies) for more rules you must meet.
1 | AGI Limits | Adjusted Gross Income (AGI) Must Be Less Than
|
2 | Social Security Number | You Must Have a Valid Social Security Number |
3 | Married Person’s Filing | Your Filing Status Cannot Be “Married Filing Status Separately” |
4 | Nonresident Alien | You Must Be a U.S. Citizen or Resident Alien All Year |
5 | Foreign Earned Income | You Cannot File Form 2555 or Form 2555-EZ |
6 | Investment Income | Your Investment Income Must Be $2,600 or Less |
7 | Earned Income | You Must Have Earned Income |
What should we do with these rules if we are trying to capture them in a formal manner that can support decision making, such as using a business rules engine?
First, consider whether these are rules or conditions. What are their implications? That is, if we state them as “if-then” rules, what comes after the then?
Try completing the following sentences:
- If you have a valid social security number then …
- If your filing status cannot be “married filing status separately” then…
- If you must be a U.S. citizen or resident all year then…
Each of these have a different problem! None of them is the beginning of a useful rule. There is no legitimate conclusion from any of them!
The problem is that these are necessary conditions, not rules. You must meet each of them in order to qualify for the EITC. Meeting any one of them is not sufficient. In fact, meeting all of them is not sufficient! The note above indicates that other rules must also be considered. (Note that the IRS forgot to mention chapter 4! Think about the staggering amount of money the IRS probably spent on their publication. Your business requirements documents are likely to have many more errors, unfortunately.)
Rules have consequences!
The consequence of each of these rules is not that you qualify for the EIC. In fact, these rules do not have consequences! These are conditions. To make them rules we need to realize that their conclusions can only be that we do not qualify for the EIC. Then, we can write these rules as follows:
- If your adjusted gross income is not below the limit … then you do not qualify for the EIC.
- If you do not have a valid social security number then you do not qualify for the EIC.
- If you are married and filing separately then you do not qualify for the EIC.
- If you were not a US citizen or resident alien all year then you do not qualify for the EIC.
- If you are filing form 2555 or 2555-EZ then you do not qualify for the EIC.
- If you had investment income over $2,600 then you do not qualify for the EIC.
- If you do not have earned income then you do not qualify for the EIC.
Of course the limitations on adjusted gross income are more complicated and need to be dealt with, but we will get to that after discussing what just happened a bit more.
Notice how we had to flip the logic in each of the conditions. This is a common activity for knowledge engineers. It can also a common source of error. It would be much better if we did not have to do this. Unfortunately, the “if-then” metaphor or most business rules management systems require us to do so. It would be much better if we could avoid the double negation of negating conditions and negating conclusions. For example, wouldn’t it be nice to write:
- You qualify for the EIC
- only if your adjusted gross income is less than the limit…
- only if you have a valid social security number
- only if you are not married and filing separately
- only if you were a US citizen or resident alien all year
- only if you do not file form 2555 or 2555-EZ
- only if your investment income was $2,600 or less
- only if you had earned income
This is much closer to the original form and much more reliable. Unfortunately it is wrong!
First, there is no implication here. Each of these is necessary but not sufficient for the deduction that you qualify for the EIC. In chapter 4, for example, the IRS gets around to saying that there are limits on earned income!
The fact is that all of these statements must be true in order to qualify, but even if they are all are, you may not be qualified. This could be more easily expressed as follows:
- You do not qualify for the EIC
- unless your adjusted gross income is less than the limit…
- unless you have a valid social security number
- unless you are not married and filing separately
- unless you were a US citizen or resident alien all year
- unless you do not file form 2555 or 2555-EZ
- unless your investment income was $2,600 or less
- unless you had earned income
Here we have avoided negating the conditions but we have retained the negative conclusion. This is indicated by the fact that none of the conditions is sufficient for the positive conclusion.
Think carefully about whether a statement is a condition or a rule and whether the conclusions of the rule should be stated positively or negatively.
We’ll come back to the AGI limitations, but note that they are forward references to chapter 2!
Chapter 2. Rules If You Have a Qualifying Child
If you have met all the rules in chapter 1, use this chapter to see if you have a qualifying child. This chapter discusses Rules 8 through 10. You must meet all three of those rules, in addition to the rules in chapters 1 and 4, to qualify for the earned income credit with a qualifying child.
Note. You must file Form 1040 or Form 1040A to claim the EIC with a qualifying child. (You cannot file Form 1040EZ.) You must also complete Schedule EIC and attach it to your return. If you meet all the rules in chapter 1 and this chapter, read chapter 4 to find out what to do next.
No qualifying child. If you do not meet Rule 8, you do not have a qualifying child. Read chapter 3 to find out if you can get the earned income credit without a qualifying child.
8 | Qualifying Child | Your Child Must Meet the Relationship, Age, and Residency Tests |
9 | Qualifying Child of More Than One Person | Your Qualifying Child Cannot Be Used By More Than One Person To Claim the EIC |
10 | Qualifying Child of Another Person | You Cannot Be a Qualifying Child of Another Person |
This chapter is a bit trickier in that it begins to talk about children, which is plural. The introduction is misleading because we are not simply determining whether we have a qualifying child but which of our children qualify. For example, our adjusted gross income limitation is higher if we have more than one. In addition, the relationship, age and residency tests also tricky. We’ll come back to those after chapter 4.
What are the conclusions that we are trying to reach in this chapter?
Try completing the following sentences:
- If your child meets the relationship, age, and residency tests then…
- If your qualifying child cannot be used by more than one person to claim the EIC then…
- If you cannot be a qualifying child of another person then…
Now it is clearly tempting to try to write the first of these as:
- If your child meets the relationship, age, and residency tests then your child qualifies.
But this is not really true if another person claims your child or you as a qualifying child, right?
Also, what happens if you have two children, both of whom satisfy the relationship, age, and residency tests? Suppose only one of them can be used as a qualify child by someone else. How many qualifying children do you have if you cannot be claimed as a qualifying child by anyone else?
This may seem complicated, but it is a common problem. Let’s look at the answer first and then figure out how to get to it more easily.
In this chapter we are trying to determine which of our children qualify. That is:
- A child of yours qualifies
- Only if the child meets the relationship test.
- Only if the child meets the age test.
- Only if the child meets the residency test.
- Only if the child cannot be used by more than one person to claim the EIC
- Only if you do not a qualifying child of someone else
Note that this expression has eliminated the use of the word “qualifying” within rules 9 and 10.
The IRS has some additional language on who can use a child to claim the EIC that exposes additional flaws in their expression.
You can choose which person will claim the EIC. If you and someone else have the same qualifying child, you and the other person(s) can decide who will claim the credit using that qualifying child. But if you and the other person(s) cannot agree and more than one person claims the credit using the same child, the tie-breaker rule (explained in Table 2, next) applies. If the other person is your spouse and you file a joint return, this rule does not apply.
And here is the table of tie-breaker rules:
IF more than one person claims the EIC using the same child and . | THEN |
Only one of the persons is the child’s parent | Only the parent can treat the child as a qualifying child. |
Two of the persons are the child’s parent, and they do not file a joint return together | Only the parent with whom the child lived the longest during the year can treat the child as a qualifying child. |
Two of the persons are the child’s parent, the child lived with each parent the same amount of time during the year, and the parents do not file a joint return together | Only the parent with the highest adjusted gross income (AGI) can treat the child as a qualifying child |
So the IRS would have better stated rule 9 in some other way, but it is hard to formulate! The IRS introduced the notion of a child who passes the three tests to get closer to a reasonably simple expression but still failed. Let’s try their approach:
- A child of yours passes the qualification tests
- If and only if the child meets the relationship test
- If and only if the child meets the age test
- If and only if the child meets the residency test
Note that this is still not right since the IRS anticipates that a child may pass these tests for more than one person. Also, the relationship test will not simply involve you, but any person that a child might qualify for and, as demonstrated in the tie-breaker table, the residency test also considers who the child resides with. Therefore, we should re-write the preceding inference as:
- A person’s child passes the qualification tests
- If and only if the child meets the relationship test for the person
- If and only if the child meets the age test
- If and only if the child meets the residency test for the person
Now, we can clarify the IRS’ logic, as in:
- A person’s child qualifies
- Only if the child passes the qualification tests for the person
- Unless the child passes the qualification tests for another person
- Unless the two people file a joint return together
- Unless the other person agrees that the first person can claim the child as qualifying
- Unless the first person wins the tie breaker for the child versus the other person
- A person wins the tie-breaker for a child versus another person
- If the first person is the child’s parent
- Unless the other person is the child’s parent
- Unless the child lived with the first person longer
- If the child lived with each person for the same amount of time
- Unless the first person has the higher adjusted gross income
- If the second person has the higher adjusted gross income
- Unless the other person is the child’s parent
- If the first person is the child’s parent
Note the last two, most nested conditions are harmlessly redundant. (The regulations did not seem clear for two people with the same AGI.)
Of course, there are other means of expressing the same logic, as in:
- A person wins the tie-breaker for a child versus another person
- Only if the first person is the child’s parent
- Unless the other person is the child’s parent
- Unless the child lived with the first person longer
- If the other person has a higher adjusted gross income
- If the child lived with the other person longer
All of these forms can be automated by some commercial BRMS while the tables require a lot more intelligence and interpretation to understand. All the knowledge that it takes to decipher the conditions in one column versus the conclusions in the other and that they are sequential in application top to bottom is too much for today’s software.
Finally, the rules in chapter 2 should infer which of your children qualify. If you have no children, they will not apply, obviously. If you have two children, there may be zero, one or two that qualify. Then, the rules that refer to how many qualifying children you have will work.
Don’t worry about sequencing your rules for now – just realize that inferences build on each other. Rely on it.
Chapter 3. Rules If You Do Not Have a Qualifying Child
Use this chapter if you do not have a qualifying child and have met all the rules in chapter 1. This chapter discusses Rules 11 through 14. You must meet all four of those rules, in addition to the rules in chapters 1 and 4, to qualify for the earned income credit without a qualifying child.
Note. You can file Form 1040, Form 1040A, or Form 1040EZ to claim the EIC without a qualifying child. If you meet all the rules in chapter 1 and this chapter, read chapter 4 to find out what to do next.
11 | Age | You Must Be at Least Age 25 but Under Age 65 |
12 | Dependent of Another Person | You Cannot Be the Dependent of Another Person |
13 | Qualifying Child of Another Person | You Cannot Be a Qualifying Child of Another Person |
14 | Main Home in United States | You Must Have Lived in the United States More Than Half of the Year |
Try the same approach as we have taken in prior chapters. Think about the conclusions of these rules by trying to complete the following:
- If you are at least age 25 but under age 65 then…
- If you cannot be the dependent of another person then…
- If you cannot be a qualifying child of another person then…
- If you must have lived in the United States more than half the year then…
The conclusions are not that you qualify for the EIC. As in the first chapter, their logic is negative. If you don’t meet these conditions and you have no qualifying children, then you are not qualified for the EIC.
- If you do not have a qualifying child then you do not qualify for the EIC
- If you are under 25 years old
- If you are over 65 years old
- If you are a dependent of another person
- If you are a qualifying child of another person
- If you have lived in the United States less than half the year.
Note that as we experienced in the first chapter, however, we have had to negate the conditions. Fortunately, I think they read better so I won’t belabor the point.
Chapter 4. Figuring and Claiming the EIC
You must meet one more rule to be eligible to claim the EIC.
15 | Earned Income Limits | Your Earned Income Must Be Less Than:
|
The earned income limitations are similar to the adjusted gross income limitations in the first chapter in that they vary by filing status and the number of qualifying children. This could be easily and appropriately coded in two lookup tables. Not everything has to be a rule!
Without further ado, I give you the Earned Income Limits:
Qualifying Children |
Filing Jointly | Not Filing Jointly |
0 |
$12,230 | $11,230 |
1 |
$30,666 | $29,666 |
>1 |
$34,692 | $33,692 |
Then we can write that:
- You do not qualify for the EIC
- unless your income is less than your earned income limit
- Your earned income limit is the amount stored in the Earned Income Limits table for the number of your children that qualify and your filing status.
I would repeat this for adjusted gross income, but lo and behold – they are the same!
The EIC in a nutshell
The total logic of the earned income tax credit (excluding the relationship, age, and residency tests for a qualify child) could be expressed as:
- A person’s child qualifies
- Only if the child passes the qualification tests for the person
- Unless the child passes the qualification tests for another person
- Unless the two people file a joint return together
- Unless the other person agrees that the first person can claim the child as qualifying
- Unless the first person wins the tie breaker for the child versus the other person
- A person wins the tie-breaker for a child versus another person
- If the first person is the child’s parent
- Unless the other person is the child’s parent
- Unless the child lived with the first person longer
- If the child lived with each person for the same amount of time
- Unless the first person has the higher adjusted gross income
- Unless the other person is the child’s parent
- If the first person is the child’s parent
- You do not qualify for the EIC
- unless you have a valid social security number
- unless you are not married and filing separately
- unless you were a US citizen or resident alien all year
- unless you do not file form 2555 or 2555-EZ
- unless your investment income was $2,600 or less
- unless you have a qualifying child
- If you are under 25 or over 65 years old
- If you are a dependent of another person
- If you are a qualifying child of another person
- If you have lived in the United States less than half the year.
- unless your adjusted gross income is less than your earned income limit
- unless your earned income is less than your earned income limit
- Your earned income limit is the amount stored in the Earned Income Limits table for the number of your children that qualify and your filing status.
Qualifying Children
The relationship, age, and residency tests of the EIC are described in laborious detail on pages 11 to 14 of publication 596. Here’s what the say, albeit with much more “effort”:
- A child passes the relationship test for you
- If the child is your son, daughter, adopted child, or stepchild or descendent of any of these.
- If the child is your foster child
- Only if the child is placed with you by an authorized placement agency
- Only if you care for the child as you would your own child
- Unless the child is married at the end of the year
- Unless you can claim as an exemption
- Unless you cannot claim the child’s exemption because you gave that right to another parent of the child
- If you completed form 8332 or a similar written statement
- If you did so in a written agreement prior to 1985
- Unless you cannot claim the child’s exemption because you gave that right to another parent of the child
- Unless you can claim as an exemption
- A child passes the age test for you
- If the child was under 19 years old at the end of the year
- If the child was a full time student under 24 at the end of the year who lived with you in the United States for more than half the year.
- If the child was permanently and totally disabled at any time during the year.
- A child passes the residency test for you
- If the child lived with you in the United States for more than half the year.
And there are further details about what it means to be a full-time student or to reside in the United States (including provisions for US territories, military personnel stationed elsewhere, kidnapping, homelessness, and death). There is even one universally applicable rule buried in the details:
- A child does not qualify unless the child has a valid social security number unless the child was born and died within the year.
If any reader has a question about how to handle the details within the EIC, please leave a comment or send email.
I’ll finish up with one finer point. The phrase “or descendent of any of these” is a bit complicated for the natural language processing logic in current BRMS. In order to get the expressed logic clear enough that it can be automated with today’s technology, it would be better to rephrase as follows:
A child passes the relationship test for you
- A child passes the relationship test for you
- If the child is your legal child.
- If the child is a descendent of your legal child
- A child is your legal child
- if the child is your son, daughter, adopted child or stepchild.
For those who are familiar with Authority, you can see that these rules are essentially executable once the vocabulary and phraseology is defined. Although SBVR is not as expressive today, I hope it develops to be so capable, even if it takes Microsoft’s “embrace and extend” approach.
One Reply to “Harvesting business rules from the IRS”
Comments are closed.