Logic Programming and SMT
Logic Programming and SMT for Legal Rules
Predicates, Horn rules, stratified negation, closed and open worlds, typed variables, arithmetic constraints, satisfiability, models, counterexamples, optimization limits, eligibility traces, and Z3 semantics.
Structured Visual
Jurisdiction: US; as of 2026-08-28; not legal advice; Render structure, refuse interpretation, cite, abstain, and hand off.
RENDER STRUCTURE · REFUSE INTERPRETATION · CITE · ABSTAIN · HAND-OFF: render structure, refuse interpretation, cite provenance, abstain when unsupported, and hand off to human review.
Scope and honesty note
Jurisdiction: United States computational-law classroom model; source snapshot 2026-08-28; curriculum as of 2026-08-29. Synthetic inputs, code, labels, measurements and outputs are teaching artifacts, not law, legal advice, authority, eligibility, benefits, tax, court, filing, research, ranking, or outcome determinations. Code encodes selected interpretations and can be incomplete, wrong, outdated, biased, overprecise, underinclusive, or non-isomorphic. The system must cite source and version, expose assumptions and gaps, abstain when unsupported, and hand legal judgment to accountable humans.
See the essential structure first
Start with this deliberately incomplete structure, then use the pinned authorities, worked application, exceptions, and handoff below. This deliberately incomplete preview has 4 nodes; exceptions and legal consequences remain in the sourced prose below.
Jurisdiction: US; as of 2026-08-28; not legal advice; Render structure, refuse interpretation, cite, abstain, and hand off.
RENDER STRUCTURE · REFUSE INTERPRETATION · CITE · ABSTAIN · HAND-OFF: render structure, refuse interpretation, cite provenance, abstain when unsupported, and hand off to human review.
Begin with computational-law doctrine
Logic programming and satisfiability modulo theories can make rule structure executable, but semantics must be explicit. Horn rules support forward inference; negation as failure assumes a closed world unless designed otherwise. Legal facts commonly require open-world unknowns and evidence provenance. SMT solvers determine whether typed constraints have a mathematical model; SAT does not establish real facts or legal entitlement, and UNSAT shows inconsistency among encoded assertions, not that law itself is invalid. Counterexample queries, unsat cores and model inspection aid debugging.
Typed monetary source
Section Sixty-One illustrates why money categories, taxpayer, period and cross-references must be typed before arithmetic constraints. Pinned source or measurement: “§61. Gross income defined (a) General definition Except as otherwise provided in this subtitle, gross income means all income from whatever source derived, including (but not limited to) the following items: (1) Compensation for services, including fees, commissions, fringe benefits, and similar items; (2) Gross income derived from business; (3) Gains derived from dealings in property; (4) Interest; (5) Rents; (6) Royalties; (7) Dividends; (8) Annuities; (9) Income from life insurance and endowment contracts; (10) Pensions; (11) Income from discharge of indebtedness; (12) Distributive share of partnership gross income; (13) Income in respect of a decedent; and (14) Income from an interest in an estate or trust. (b) Cross references For items specifically included in gross income, see part II (sec. 71 and following). For items specifically excluded from gross income, see part III (sec. 101 and following). (Aug. 16, 1954, ch. 736, 68A Stat. 17 ; Pub. L. 98–369, div. A, title V, §531(c), July 18, 1984, 98 Stat. 884 ; Pub. L. 115–97, title I, §11051(b)(1)(A), Dec. 22, 2017, 131 Stat. 2089 .)” Coordinate: 26 U.S.C. § 61; https://www.neochart.com/catalog/federal/tax/title_26/chapter_1/section_61/title26_sec61_bcd7ff77d1ff/61_gross_income_defined_0001/index.html; data via neochart.com, snapshot 2026-08.
Standards source
Section Seven-Zero-Six illustrates standards and remedies that resist reduction to Boolean eligibility alone. Pinned source or measurement: “§706. Scope of review To the extent necessary to decision and when presented, the reviewing court shall decide all relevant questions of law, interpret constitutional and statutory provisions, and determine the meaning or applicability of the terms of an agency action. The reviewing court shall- (1) compel agency action unlawfully withheld or unreasonably delayed; and (2) hold unlawful and set aside agency action, findings, and conclusions found to be- (A) arbitrary, capricious, an abuse of discretion, or otherwise not in accordance with law; (B) contrary to constitutional right, power, privilege, or immunity; (C) in excess of statutory jurisdiction, authority, or limitations, or short of statutory right; (D) without observance of procedure required by law; (E) unsupported by substantial evidence in a case subject to sections 556 and 557 of this title or otherwise reviewed on the record of an agency hearing provided by statute; or (F) unwarranted by the facts to the extent that the facts are subject to trial de novo by the reviewing court. In making the foregoing determinations, the court shall review the whole record or those parts of it cited by a party, and due account shall be taken of the rule of prejudicial error. ( Pub. L. 89–554, Sept. 6, 1966, 80 Stat. 393 .)” Coordinate: 5 U.S.C. § 706; https://www.neochart.com/catalog/federal/title_5/section_706/title5_sec706_9a580d7b5bc7/706_scope_of_review_to_the_extent_necessary_to_decision_and_0001/index.html; data via neochart.com, snapshot 2026-08.
Pin the synthetic computational record
A synthetic SMT-solver record types resident and disqualifying status as Booleans, age as integer, income as annual money, defines eligibility by equivalence, pins evidence, stores assertions, model, negated-property query, unsat result, core candidates, missing-income variant, assumptions and reviewer.
Work the audited application
The complete scenario satisfies the conjunction and exception structure, so a model with eligible true exists. Adding not eligible while retaining the equivalence makes the query UNSAT, confirming the encoded property for those assertions. Removing the income fact admits models above and below the threshold, so the correct result is unknown—not false. No solver output becomes an agency eligibility decision.
Read the populated computational artifact
The logic record contains predicate, argument, fact, evidence, Horn rule, dependency, recursion, stratification, closed-world flag, explicit negation, variable, sort, unit, period, domain, assertion, threshold, equivalence, exception, SAT result, model assignment, negated property, UNSAT result, core, counterexample, unknown, assumption, solver version, source link, and reviewer. The artifact contains 16 populated rows.
Jurisdiction: US; as of 2026-08-28; not legal advice; Render structure, refuse interpretation, cite, abstain, and hand off.
RENDER STRUCTURE · REFUSE INTERPRETATION · CITE · ABSTAIN · HAND-OFF: render structure, refuse interpretation, cite provenance, abstain when unsupported, and hand off to human review.
Read the complete record
The complete record keeps sources, stated facts, and questions for review separate. Pinned sources and measurements: Verbatim text or bounded snapshot data. 26 U.S.C. § 61: Typed monetary source: Section Sixty-One illustrates why money categories, taxpayer, period and cross-references must be typed before arithmetic constraints.. 5 U.S.C. § 706: Standards source: Section Seven-Zero-Six illustrates standards and remedies that resist reduction to Boolean eligibility alone.. Synthetic computational record: Classroom inputs and intermediate states. Typed scenario: resident is Boolean true; age is integer sixty-seven; countable income is money eighteen thousand for annual period; disqualifying status is Boolean false. Rule: eligible iff resident and age at least sixty-five and income at most twenty thousand and not disqualifying status. Solver checks: Scenario plus rule is satisfiable with eligible true; scenario plus rule plus not eligible is unsatisfiable; missing income produces a family of models rather than a negative answer. Audit trace: Semantics, provenance, execution, evidence, limits and handoff. Logic programming: Fact, predicate, Horn implication, recursion, dependency, stratification, negation-as-failure, explicit negation and provenance. World assumption: Closed-world reasoning can treat absent facts as false; legal systems often require open-world unknown and explicit evidence policies. SMT types: Bool, Int, Real, finite enumeration, date or duration encoding, money with unit and period, set membership and uninterpreted sort. Constraint: Resident; age greater than or equal to sixty-five; income less than or equal to twenty thousand; not disqualifying; equivalence defining eligible. SAT and model: Satisfiable means at least one assignment meets constraints, not that legal facts are true; inspect model and source bindings. UNSAT and core: Facts plus definition plus not eligible are inconsistent in the complete scenario; unsat core explains conflicting assertions, not legal invalidity. Counterexample and unknown: Negate property to seek counterexample; missing fact leaves multiple models and must not be collapsed by closed-world default.
Narrow summary
Type facts and units, choose open- or closed-world semantics deliberately, use SAT models and UNSAT counterexamples for debugging, and never equate solver status with legal entitlement.