Rules as code
Checked rules from the U.S. Code
Axeyum checks the consequences of a human-written encoding of a statute. It does not decide what the statute means. The worked example is 18 U.S.C. § 1030, the Computer Fraud and Abuse Act: its punishment clauses and its civil action, lifted from the United States Code, 2023 Edition and checked end to end.
5a9a70189 Measured Source Commands recorded from the engine repository What is checked
Within that scope every step is mechanical and can be run again from the repository. The statute is lifted from its published text, a person writes rules keyed to its provisions, a compiler rejects any rule that does not trace to the text, and a solver answers questions about the rules with evidence that is checked a second time.
- Statute text Published text of 18 U.S.C. § 1030
GovInfo .htm - Provision graph Outline, references, terms, amounts
uscode_lift.py - Keyed rules Each rule quotes its provision
rules.json - Solver queries One SMT-LIB query per check
rules_ir.py - Checked answers Certified unsat, replayed sat
Evidence::check - Evaluate fact patterns The rules from step 3 also compute clauses, maximum terms, and civil outcomes.
- Provision
- One enumerated unit of a statute, such as § 1030(c)(4)(A)(i)(VI). Every rule on this page names the provision it encodes.
- Lift
- A mechanical translation of published statute text into structured data: the outline, the cross-references, the defined terms, and the numbers. The lift records only what the text states.
- Rule
- A small logical formula written by a person, such as “at least one of factors (I) to (V) holds”. It cites its provision and quotes a phrase from it.
- Obligation
- A question for the solver in SMT-LIB, the standard input language of SMT solvers. Each asks whether some combination of facts is possible under the rules.
- sat and unsat
- The two answers. sat means such facts exist, and the solver returns them as a model. unsat means no facts can satisfy the question.
- Checked evidence
- A sat model is replayed: it is evaluated against the original question. An unsat answer carries a certificate that a separate checker re-derives. An answer without evidence is not reported.
One sentence of § 1030(g), end to end
Subsection (g) lets a person harmed by a CFAA violation sue. Its second sentence limits that right. Follow it through the five stages.
1 The text
The statute, as published:
A civil action for a violation of this section may be brought only if the conduct
involves 1 of the factors set forth in subclauses (I), (II), (III), (IV), or (V)
of subsection (c)(4)(A)(i). 2 The lifted reference
The lift reads "subclauses (I), (II), (III), (IV), or (V) of subsection (c)(4)(A)(i)" and resolves it to five provision identifiers. Nothing here is interpreted; the identifiers are the subclauses the sentence names.
{
"from": "/us/usc/t18/s1030/g",
"raw": "subclauses (I), (II), (III), (IV), or (V) of subsection (c)(4)(A)(i)",
"scope": "internal",
"targets": [
"/us/usc/t18/s1030/c/4/A/i/I",
"/us/usc/t18/s1030/c/4/A/i/II",
"/us/usc/t18/s1030/c/4/A/i/III",
"/us/usc/t18/s1030/c/4/A/i/IV",
"/us/usc/t18/s1030/c/4/A/i/V"
],
"unresolved": []
} 3 The rule
A person writes the rule. It names the provision, quotes the sentence, and states the condition over five predicates that encode factors (I) to (V). Those predicates are written once, at (c)(4)(A)(i), and every provision that cites the factors uses them.
{
"name": "civil_factor_I_V",
"sort": "Bool",
"provision": "/g",
"anchor": "1 of the factors set forth in subclauses (I), (II), (III), (IV), or (V) of subsection (c)(4)(A)(i)",
"expr": "(or harm_I harm_II harm_III harm_IV harm_V)",
"description": "The (g) gate: one of factors (I)-(V) of (c)(4)(A)(i)."
} 4 The question for the solver
The compiler checks the rule against the lift, then writes SMT-LIB questions that use it. This one asks: can an (a)(5)(A) offense satisfy some harm factor while the civil action stays unavailable to a person who suffered damage?
; facts, bounds, and the one-offense constraint precede this excerpt
(define-fun harm_I () Bool (>= loss_usd 5000))
(define-fun harm_II () Bool medical_impairment)
(define-fun harm_III () Bool physical_injury)
(define-fun harm_IV () Bool public_safety_threat)
(define-fun harm_V () Bool justice_security_computer)
(define-fun harm_VI () Bool (>= computers_damaged 10))
(define-fun harm_any_I_VI () Bool (or harm_I harm_II harm_III harm_IV harm_V harm_VI))
(define-fun civil_factor_I_V () Bool (or harm_I harm_II harm_III harm_IV harm_V))
(define-fun violation () Bool (or off_a2 off_a3 off_a4 off_a5A off_a5B off_a5C off_a6 off_a7))
(define-fun civil_action_available () Bool (and violation damage_or_loss_suffered civil_factor_I_V))
(assert (and off_a5A damage_or_loss_suffered harm_any_I_VI (not civil_action_available)))
(check-sat) 5 The checked answer
The answer is sat, with a model: ten protected computers damaged, nothing
else. The model is replayed against the question before it is reported.
$ cargo run -q -p axeyum-solver --features full --example rules_check -- \
docs/rules-as-code/examples/cfaa-1030-v0/smt2/civil-gate-excludes-factor-vi-sat.smt2
civil-gate-excludes-factor-vi-sat.smt2: sat evidence=sat-model certified=true rechecked=true
computers_damaged = 10
damage_or_loss_suffered = true
off_a5A = true Three findings in § 1030
The civil action omits factor (VI)
Factor (VI) is "damage affecting 10 or more protected computers during any 1-year period".
(c)(4)(B) cites all six factors, so damage to ten computers supports the 10-year maximum
for a first (a)(5)(A) offense. (g) cites only five, so that damage alone does not support
a civil action. The converse is a certified unsat: whenever the civil action
is available, some (c)(4)(A)(i) factor holds.
§ 1030(c)(4)(B), the 10-year felony maximum, cites factors (I)–(VI).
§ 1030(g), the civil action, cites factors (I)–(V).
- (I) loss of at least $5,000 in a year
- (II) medical care impaired
- (III) physical injury to any person
- (IV) threat to public health or safety
- (V) justice, defense, security computer
- (VI) damage to 10 or more computers — cited by (c)(4)(B) only
"Exceeds $5,000" and "at least $5,000"
(c)(2)(B)(iii) requires that "the value of the information obtained exceeds $5,000".
(c)(4)(A)(i)(I) requires loss "aggregating at least $5,000 in value". At exactly $5,000
the loss factor holds and the value aggravator does not. A decision table written with
>= in clause (iii) returns 5 years where the statute gives 1. The literal gate
rejects that comparator in the rule model; the solver finds it in code written apart from the
model.
Two maxima reach one (a)(2) count
(c)(2)(A) applies "except as provided in subparagraph (B)" and only to an offense "which
does not occur after a conviction for another offense under this section". (c)(2)(B), the
5-year clause for (a)(2) offenses with a commercial, criminal, or over-$5,000 aggravator,
has no first-offense limit. (c)(2)(C), the 10-year clause, reaches every repeat (a)(2)
offense. A repeat (a)(2) offense with an aggravator therefore meets both (B) and (C) by
their terms. The model reports both and takes the larger maximum; the overlap is a checked
sat result, so that choice is on the record.
Lift § 1030 into a provision graph
The input is the GovInfo rendering of 18 U.S.C. § 1030 (Fraud and related activity in connection with computers), United States Code, 2023 Edition, current
through 2024-01-03. scripts/uscode_lift.py turns it into one JSON object.
Each provision gets an identifier such as /us/usc/t18/s1030/c/4/A/i/VI, its
own text, and its editorial footnotes. Defined terms are linked to the provisions that use
them, and dollar amounts, prison terms, periods, and counts are recorded with the
comparator the text uses.
- 104
- provisions in the outline
- 49
- targets of 29 internal cross-references
- 20
- quantities; 13 definitions
$ python3 scripts/uscode_lift.py \
docs/rules-as-code/uscode/sources/USCODE-2023-title18-partI-chap47-sec1030.htm \
docs/rules-as-code/uscode/lifted/usc-t18-s1030.json --check
lifted 18 U.S.C. § 1030: 104 provisions, 29 internal references (49 targets), 14 external, 13 definitions, 20 quantities, 0 unresolved Several parts of the rendering needed care. GovInfo puts footnote anchors inside the text, so "subclauses⁵ (I), (II)" reads as "subclauses 5 (I)" unless the marker is removed. The lift keeps the 7 footnotes, such as "So in original. Probably should be 'subclause'.", as notes on their provisions. "(i)" is a subsection in § 1030(i) and a clause in (c)(2)(B)(i), and "(I)" is a subparagraph in (e)(4)(I) and a subclause in (c)(4)(A)(i)(I). The lift places each enumerator by the sequence it continues and stops if more than one level fits. "Paragraphs (1) and (3) of section 1(b) of the International Banking Act of 1978" names another statute and is not resolved inside § 1030.
Query the lifted section
The lifted section answers questions without any rule model. The same amount appears with three different comparators:
$ python3 scripts/uscode_query.py \
docs/rules-as-code/uscode/lifted/usc-t18-s1030.json quantities --kind money_usd
18 U.S.C. § 1030(a)(4): money_usd <= 5000 "not more than $5,000"
18 U.S.C. § 1030(c)(2)(B)(iii): money_usd > 5000 "exceeds $5,000"
18 U.S.C. § 1030(c)(4)(A)(i)(I): money_usd >= 5000 "aggregating at least $5,000" A rule author who copies "$5,000" without its comparator is wrong at exactly $5,000 in at least one of these places. The citations behind the factor diagram above come from the same object:
$ python3 scripts/uscode_query.py \
docs/rules-as-code/uscode/lifted/usc-t18-s1030.json cited-by c/4/A/i
18 U.S.C. § 1030(c)(4)(A)(i) and its descendants are cited 3 times:
18 U.S.C. § 1030(c)(4)(B)(i) "subclauses (I) through (VI) of subparagraph (A)(i)" -> 1030(c)(4)(A)(i)(I), 1030(c)(4)(A)(i)(II), 1030(c)(4)(A)(i)(III), 1030(c)(4)(A)(i)(IV), 1030(c)(4)(A)(i)(V), 1030(c)(4)(A)(i)(VI)
18 U.S.C. § 1030(g) "subclauses (I), (II), (III), (IV), or (V) of subsection (c)(4)(A)(i)" -> 1030(c)(4)(A)(i)(I), 1030(c)(4)(A)(i)(II), 1030(c)(4)(A)(i)(III), 1030(c)(4)(A)(i)(IV), 1030(c)(4)(A)(i)(V)
18 U.S.C. § 1030(g) "subsection (c)(4)(A)(i)(I)" -> 1030(c)(4)(A)(i)(I) $ python3 scripts/uscode_query.py \
docs/rules-as-code/uscode/lifted/usc-t18-s1030.json term "protected computer"
defined: 18 U.S.C. § 1030(e)(2) ("protected computer" means)
used in 10 provisions:
18 U.S.C. § 1030(a)(2)(C)
18 U.S.C. § 1030(a)(4)
18 U.S.C. § 1030(a)(5)(A)
18 U.S.C. § 1030(a)(5)(B)
18 U.S.C. § 1030(a)(5)(C)
18 U.S.C. § 1030(a)(7)(A)
18 U.S.C. § 1030(a)(7)(B)
18 U.S.C. § 1030(a)(7)(C)
18 U.S.C. § 1030(c)(4)(A)(i)(I)
18 U.S.C. § 1030(c)(4)(A)(i)(VI) Reject rules that do not trace to the text
The rule model is docs/rules-as-code/examples/cfaa-1030-v0/rules.json: 21 facts and 39 predicates. The compiler emits nothing until four gates hold against
the lifted section.
| Gate | Requires | § 1030 pack |
|---|---|---|
| Anchor | The quoted phrase occurs verbatim in the cited provision. | 60 anchors |
| Literal | Every integer constant is a quantity the lift found in that provision, compared with the comparator the text states. | 14 literals |
| Dependency | A rule that uses a rule on another provision is justified by the outline, a resolved cross-reference, a defined term, or a declared reason. | 18 dependencies, 7 declared |
| Reference | Every internal cross-reference that leaves a modeled provision is consumed by the model or listed as out of scope with a reason. | 43 references, 3 out of scope |
$ python3 scripts/rules_ir.py docs/rules-as-code/examples/cfaa-1030-v0/rules.json --check
compiled cfaa_1030_v0: 39 predicates, 60 anchors verified, 14 literals matched, 18 cross-provision dependencies justified, 43 statute references accounted for, 8 obligations A model that lets the civil action use factor (VI) is rejected before any solver runs. The lift found no reference from (g) to (c)(4)(A)(i)(VI), and nothing else connects them:
$ python3 scripts/rules_ir.py docs/rules-as-code/examples/cfaa-1030-v0/rules.mutated.json
error: traceability check failed:
predicate civil_factor_I_V (/g) uses harm_VI (/c/4/A/i/VI) with no textual justification The gates cannot see an error inside one provision. Dropping the first-offense condition from (c)(4)(A) leaves every anchor, literal, and reference intact. The validator catches it: on each of 221,184 fact patterns it compares the clauses that apply under the rule model, under the decision table, and under a separate clause-by-clause reading of the statute. The comparison is by clause and not only by maximum, because (c)(4)(C)'s 20 years hides the extra clause in the maximum.
All eight checks
An unsat passes only with a certificate that re-checks against the parsed question;
here it is a lazy-arithmetic refutation (unsat-arith-dpll). A
sat passes only when its model replays. All 8 pass: 4 certificates and 4 models. The solver chooses its own models, so a model can
include facts that do not matter to the finding.
| Check | Result | Evidence | What it shows |
|---|---|---|---|
| penalty-coverage-unsat | unsat | certificate | Every single-offense count under (a)(2)–(a)(7) is reached by a clause of (c)(2)–(c)(4). |
| penalty-overlap-c2b-c2c-sat | sat | model | (c)(2)(B) and (c)(2)(C) both reach a repeat (a)(2) offense with an aggravator. |
| value-threshold-mismatch-sat | sat | model | $5,000 meets the (c)(4)(A)(i)(I) loss test and fails the (c)(2)(B)(iii) value test. |
| civil-gate-within-felony-factors-unsat | unsat | certificate | Conduct that opens the (g) civil gate always satisfies a (c)(4)(A)(i) factor. |
| civil-gate-excludes-factor-vi-sat | sat | model | Factor (VI) supports the (c)(4)(B) maximum but does not open the (g) civil gate. |
| max-term-monotone-unsat | unsat | certificate | For a fixed offense, an added aggravating fact never lowers the maximum. |
| implementation-equivalence-unsat | unsat | certificate | An independently written decision table agrees with the model on every input. |
| buggy-implementation-counterexample-sat | sat | model | The same table with >= 5000 for (c)(2)(B)(iii) is wrong at exactly $5,000. |
$ cargo run -q -p axeyum-solver --features full --example rules_check -- \
docs/rules-as-code/examples/cfaa-1030-v0/smt2/*.smt2
buggy-implementation-counterexample-sat.smt2: sat evidence=sat-model certified=true rechecked=true
death = true
impl_buggy_max_years = 5
info_value_usd = 5000
max_years = 1
off_a2 = true
civil-gate-excludes-factor-vi-sat.smt2: sat evidence=sat-model certified=true rechecked=true
computers_damaged = 10
damage_or_loss_suffered = true
off_a5A = true
civil-gate-within-felony-factors-unsat.smt2: unsat evidence=unsat-arith-dpll certified=true rechecked=true
implementation-equivalence-unsat.smt2: unsat evidence=unsat-arith-dpll certified=true rechecked=true
max-term-monotone-unsat.smt2: unsat evidence=unsat-arith-dpll certified=true rechecked=true
penalty-coverage-unsat.smt2: unsat evidence=unsat-arith-dpll certified=true rechecked=true
penalty-overlap-c2b-c2c-sat.smt2: sat evidence=sat-model certified=true rechecked=true
info_value_usd = 5001
off_a2 = true
prior_conviction = true
value-threshold-mismatch-sat.smt2: sat evidence=sat-model certified=true rechecked=true
info_value_usd = 5000
loss_usd = 5000
off_a7 = true 35 of 35 rules-as-code regressions pass: cargo test -p axeyum-solver --features full --test rules_as_code_examples @ 5a9a70189, 2026-11-09.
Compute with the model
The rules that produce the questions also compute answers for concrete facts. The validator replays these rows through all three readings:
| Facts | Clauses | Maximum | Civil action, (g) |
|---|---|---|---|
| (a)(2), first offense, value $5,000 | (c)(2)(A) | 1 year | not alleged |
| (a)(2), prior conviction, commercial gain | (c)(2)(B), (c)(2)(C) | 10 years | not alleged |
| (a)(5)(A), first offense, 10 computers | (c)(4)(B) | 10 years | no: (g) omits (VI) |
| (a)(5)(C), first offense, loss $1,000,000 | (c)(4)(G) | 1 year | yes: economic only |
| (a)(5)(A), prior conviction, death | (c)(4)(F) | life | not alleged |
The sweep covers every threshold region of the model. Dollar amounts take 4,999, 5,000, and 5,001, the computer count takes 9, 10, and 11, and all Boolean facts vary across all eight offenses. That gives 221,184 rows, each decided identically by the 3 readings. The penalty table and every subset of the harm factors are also written out as query rows, which a downstream user can read without running a solver.
python3 scripts/validate-rules-as-code.py @ 5a9a70189, 2026-11-09
Other rule packs
The other 7 packs in docs/rules-as-code/ use invented rules. Between
them they carry 27 checked fixtures and exercise the logic fragments
a statute pack can call on:
| Pack | Rule shape | Fragment and evidence |
|---|---|---|
| Benefit eligibility | Thresholds, exceptions, effective dates | Bool, QF_LIA |
| Authorization policy | Tenant isolation, explicit deny precedence | Bool, QF_LIA |
| Tax benefit arithmetic | Phase-out, cap, threshold change | Bool, QF_LIA |
| Procurement scoring | Exclusions, bid cap, score monotonicity | Bool, QF_LIA |
| Grant allocation | Rational shares, budget balance | QF_LRA, Farkas |
| Category equivalence | Equivalent categories, same treatment | QF_UF, Alethe |
| Workflow reachability | No skipped review, absorbing terminal states | Bool, QF_LIA |
The next steps on the statute track are to lift the USLM XML of the Office of the Law Revision Counsel, which marks the outline explicitly, to model § 1030(b) and the attempt clauses, and to lift a second section that § 1030 cites.
Prior work on the U.S. Code as a computable object
Treating the Code as a hierarchy joined by a citation network comes from earlier empirical work by Bommarito and Katz. Those papers measure that structure across the whole Code. Here it is used inside one section, as the reference a formal rule model is checked against.
- M. J. Bommarito II and D. M. Katz, "Properties of the United States Code citation network," arXiv:0911.1751 (2009).
- M. J. Bommarito II and D. M. Katz, "A mathematical approach to the study of the United States Code," Physica A 389(19):4195–4200 (2010), arXiv:1003.4146.
- D. M. Katz and M. J. Bommarito II, "Measuring the complexity of the law: the United States Code," Artificial Intelligence and Law 22(4):337–374 (2014), Springer.
- J. B. Ruhl, D. M. Katz, and M. J. Bommarito II, "Harnessing legal complexity," Science 355(6332):1377–1378 (2017), Science.
- C. Coupette, J. Beckedorf, D. Hartung, M. Bommarito, and D. M. Katz, "Measuring law over time," Frontiers in Physics 9:658463 (2021), arXiv:2101.11284.
The engine code and the full pack are in the Axeyum repository.
Sources: python3 scripts/uscode_lift.py docs/rules-as-code/uscode/sources/USCODE-2023-title18-partI-chap47-sec1030.htm docs/rules-as-code/uscode/lifted/usc-t18-s1030.json --check @ 5a9a70189, 2026-11-09; python3 scripts/rules_ir.py docs/rules-as-code/examples/cfaa-1030-v0/rules.json --check @ 5a9a70189, 2026-11-09; cargo run -q -p axeyum-solver --features full --example rules_check -- docs/rules-as-code/examples/cfaa-1030-v0/smt2/*.smt2 @ 5a9a70189, 2026-11-09.