[net.ai] Suggestions wanted for Prolog implementation of income tax rules

dave@lsuc.UUCP (David Sherman) (05/20/85)

Help!  Can I do what I want to do in Prolog?

I am trying to design a system which will apply the rules of
the Income Tax Act (Canada) to a set of facts and transactions
in the area of corporate reorganizations.

This is not a typical "AI and law" problem, because the Income
Tax Act is highly technical and extremely specific about what
rules apply and when. To the extent there is "open texture", or
issues which require legal judgment (e.g., whether an amount
is "reasonable"), I assume the lawyer using the system will
provide the judgment as an input fact. The problems are therefore
quite different from those addressed by McCarty@Rutgers' TAXMAN
program, because the approaches of the Income Tax Act and the
Internal Revenue Code are very different.

The difficulty in programming the system is simply the complexity
of the Income Tax Act. On a given transaction, a large number of
rules have to be examined to determine possible tax effects. Some
of these rules create new facts (e.g., a deemed dividend or a deemed
disposition). The passage of time is very important: steps happen
in a particular sequence, and the "state of the world" at the moment
a step is taken is crucial to determining the tax effects. In the
context of corporate transactions, this state includes such things
as who controls a corporation; who owns what assets; the residence
and status of and relationships among taxpayers; cost bases and
proceeds of disposition; and so on.

(My background to this: I'm a tax lawyer and an experienced C
programmer. I'm doing this work towards an LL.M. thesis.)

I've tried several approaches to this field before. Last year
I did a small version in C which uses an event-driven simulation,
and as it encounters each event calls a function for each rule in
the database to generate new events and tax results. (Incidentally,
if anyone wants a copy of that paper, "Towards a Comprehensive Computer-Based
Problem Solving Model of the Income Tax Act: A Suggested Approach and
Implementation of Examples from Corporate Reorganizations", let me know.
It's about 50 pages.)

One of the problems with the C implementation was designing the
order in which the rules should be applied. For even the small subset
I implemented, this was awkward and difficult.

I came across Prolog at an ICS course on expert systems a few
weeks ago. It looks like the perfect tool for much of what I want
to do. Besides the workshops at the course (taught by sdcsvax!vis!greg),
I've now read Clocksin & Mellish and skimmed through How To Solve
It In Prolog.

The definitional stuff is fine. Using C-Prolog 1.4 on a VAX (not this
machine), I've already coded the Income Tax Act's definitions for
things like "resident", "private corporation", etc.

The problem I have (if you've read this far, thank you!) is how
to deal with _time_. I suppose the overall model I need to work with
is one of "changing states", where a transaction (e.g., X transfers
property to corporation Y in exchange for shares in Y) changes the
world from state A to state B, and the rules can examine differences
between the states to determine the effects. But then how does that
jive with definitional tests which may need to look back in time
(e.g., a corporation is resident in Canada in a given year if it
meets certain conditions and it was resident in Canada, or carried
on business in Canada, in the previous year. This is a perfect
recursive definition for Prolog, and I've implemented the rule,
but only as a fixed definition, not as part of a "changing
state" system.)?

I guess part of my problem is that I'm not working in an
AI department, or even a Computer Science department, and
so I don't have knowledgeable people to bounce my ideas off.
If you have any suggestions as to approaches I should be taking,
or are willing to discuss the issues via electronic mail, I'd
greatly appreciate hearing from you. I'd be happy to send you
a copy of the code I've written so far to explain what I mean.
(You could even learn all about Canadian tax law!)

David Sherman
The Law Society of Upper Canada
Osgoode Hall
Toronto, Canada  M5H 2N6
(416) 947-3466
ARPA: ihnp4!utzoo!lsuc!dave@BERKELEY
-- 
{  ihnp4!utzoo  pesnta  utcs  hcr  decvax!utcsri  }  !lsuc!dave