Best Practices for Building Legal Knowledge BasesMichael Poulshock
Wolfram Data SummitSeptember 4-5, 2014
<lighthearted_introductory_banter/>
About me
oLegal knowledge engineeroLawyer + programmeroWork at Exeter GroupoBuild systems that
automate law and policy
Automating the law?
oEncoding legal rulesoApplying the rules to fact
patternsoGetting legal conclusions or
“determinations”oEmbedding this functionality
in a larger system
Vocab
o Expert systemso Business rule engineso Knowledge baseo Knowledge engineeringo Policy automation / modelingo Decision support systemso Calculatorso Computational law
Examples
irs.gov/ita
Benefits of automation
oConsistencyoSpeedoCost-effectivenessoAuditabilityoBreadth of knowledgeoUpdated as the law changes
Best Practices
“An expert is a person who has made all the mistakes that can be made in a very narrow field.”
Niels Bohr
1. Declarative paradigm
oProcedural (step-by-step)oDeclarative (if-then)oPolicy rules tend to be
expressed declarativelyoProcedural representations
(such as flowcharts) do not scale well
1. Declarative paradigm
procedural declarative
the transaction is in compliance ifthe amount < $10,000 orthe date > 2014-12-31 orthe type = “Intracompany”
compliesQ[t_] :=amount[t] < 10000 ||date[t] > {2014, 12, 31} ||type[t] == “Intracompany”
2. Isomorphism
oCode should be structured similarly to the policy rules
oCorrespondence / traceability
oRule verificationoMaintenance
2. Isomorphism
the waiver of inadmissability is valid under 8 CFR 1207.3(b) if
the basis = “Humanitarian grounds” orthe basis = “Family unity” orthe basis = “Public interest”
2. Isomorphism - techniquesoUse domain vocabularyoFollow document structureo Include citationsoAdd code comments
documenting assumptions, etc.
3. Cross-trained developersoProgrammers lawyersoLawyers programmersoCenter of Excellence approachoHandling changes in the lawoFundamentally, this is
programming
Tree-like structure of legal rulesthe person is liable for the tax if
the person’s income >= $12,000 and
the person is not a tax dependent
the person’s income = ...
the person is a tax dependent if...
Tree-like structure of legal rules
Tree-like structure of legal rules
Tree-like structure of legal rules
4. Tool that can analyze the treeo Fundamental challenge:
oHow do you know what the inputs are for a particular goal?
oHow do you know which are relevant?
o Need a tool that can collect data in automated wayoDebuggingoDynamic interviews
5. Separation of policy rules
oFundamental tension between declarative rules and interview behavior
oDon’t want to hard code interview sequences
oBut we want a humane and empathetic user experience
5. Separation of policy rules
o Best practice is to separate policy logic from other types of rules, such as:o Interview sequenceo Interview messages and visibilityoData transformationoData validation
6. Time
Why time is complicated:
1. Laws change
2. Facts change
3. The way facts change matters
4. Points of reference change
6. Time
oHandling time can easily make a mess of your code
oNeed to address time early onoBackdrop of absolute timeoNeed functions and data
structures for handling time
7. Knowledge of ignorance
oNot all law is worth automating
oGranularityoModels are always
approximateo Systems need to know
what they don’t know and route those cases to humans
8. Sufficiently expressive languageoMany tools out thereoSome geared to business usersoMany not expressive enoughoMany not extendable
o Functional programming is preferable
o Conservation of complexity
9. General software best practices
a) Functional programming
b) Unit testing
c) Refactoring
Closing thoughts
o Law is inherently complexo Legal logic is fractal-esqueo Law is more computational than
it may first appearoWrapper / interface around the
law’s complexityoMaking the law more accessible
Michael [email protected]/in/mpoulshock
Thank you!