To appear in JURIX 2026

Legislating World-Model-Based Planning with Legal Reasoning

Dylan Waldner1, Yiannis Kantaros2, Guido Governatori3, Risto Miikkulainen1,4, Amir Banifatemi1

1Cognizant AI Lab  ·  2Washington University  ·  3Central Queensland University  ·  4UT Austin

Abstract

Laws as runtime constraints on a learned world model

As robotic systems grow more general, legal norms are needed to integrate them into society. This paper extends the isomorphism problem of aligning legal source texts with their encodings, and measures two key challenges to robot normative control: (1) the grounding isomorphism gap, where perception error grounds false atoms for legal reasoning, and (2) the ontological isomorphism gap, where one legal conclusion admits many faithful translations into planning constraints.

The paper introduces a legal planning stack that employs Defeasible Deontic Logic (DDL) to constrain a motion planner. The stack leverages learned world models to plan and to provide legal context, enabling ex ante governance that intervenes before an illegal action is executed. It was deployed on a simulated robot arm pushing a cube across a 3×3 grid. The findings were that (1) the legislated agent abided substantially more often than the non-legislated one, and modeling perception uncertainty lifted abidance even further, (2) the legal reasoning ran efficiently at runtime and its verdicts were auditable, and (3) the stack adapted to exogenous signals and endogenous rule changes. Both gaps were measured: (4) world model and probe error corrupted the factual input for the DDL reasoner, and (5) a single law admitted several faithful metric interpretations yielding drastically different abidance. Thus, ex ante legislation functions as intended, and closing these gaps — with a standardized mapping from the law to runtime constraints, and improved fact grounding from perception — will yield robust laws that align robot behavior with society's norms.

Episodes

What compliance and violation look like

Abiding

Four social runs. One routes around the center; the other three earn the crossing by checking in at a yellow cell first.

Blatant violation

The same environment with no legal layer. All four drive the cube straight through the forbidden center.

Edge graze

Four social runs whose footprint clips the center while the center point never enters. None of them reaches its goal.

The stack

The law enters through perception and leaves through the planner

That difference is produced by a stack, not a reward. A DDL rule base encodes the source text, learned probes ground its facts from pixels, and its verdict constrains the planner before an illegal action is ever executed. A Franka arm pushes a cube across a 3×3 grid with an illegal center cell; planning is RRT in the latent space of DINO-WM, and the cube's pose is never given, only read back from pixels. Four agents share all of it and differ only in what they do with a violation flag — they are the four series in the results below. See the paper for details.

The legislation planning stack: an Isaac Lab Franka arm pushing a cube on a 3x3 grid, beside a three-layer diagram showing the law, perception and planning rows.
The Legislation Planning Stack. (a) the Isaac Lab environment: a Franka arm pushes a cube across a 3×3 grid with an illegal center cell, two yellow check-in cells, and a color-flipping rule sign. (b) the legal layer: a DDL rule base encodes the source text, probes ground latents as its facts, and its verdict constrains the RRT planner, closing the loop. The dashed arrows are the two isomorphism gaps — the grounding gap, where probe error grounds the wrong atom, and the ontological gap, where one verdict admits many planning constraints. The point: the law enters through perception and leaves through the planner, and the gaps open during translation.

The laws

A small rule base that still exercises every DDL construct

What the stack enforces is twelve rules. The center cell is off-limits (R2); a yellow sign obliges a check-in (R5); reaching it flips the sign green (R7), or red if the center was already entered (R7b); green then permits the center (R4), red freezes the agent (R9); and if the cube ends up inside anyway, R10 converts the prohibition into a duty to get out. Small, but it exercises a defeasible prohibition with an earned exception, a compensatory duty, a permission conflict, and a rule inserted at runtime. See the paper for details.

RRule
R1 cube ⇒O ¬off_grid
R2 cube ⇒O ¬in_cell(4)
R3 sign(red) ⇒O in_cell(4)
R4 sign(green) ⇒P in_cell(4)
R5 sign(yellow) ⇒O in_yellow_cell
R5b occupies(Y), yellow_cell(Y) ⇒ in_yellow_cell
R7 in_yellow_cell, sign(yellow) ⇒ sign(green)
R7b in_yellow_cell, visited(4), sign(yellow) ⇒ sign(red)
R8 goal_cell(N), [P]moving ⇒O in_cell(N)
R9 [P]in_cell(4), [P]¬in_cell(4) ⇒O ¬moving
R10 cube ⇒O ¬in_cell(4) ⊗ exit_cell(4)
R11sign(white) ⇒O in_start_cell   — inserted at runtime

Superiority: R4 > R2, R4 > R10, R7b > R7.

Audit trace

Watching the verdict and the goal switch mid-episode

Those rules interact, and the interaction is auditable. Here is a single social-agent episode, decision by decision: a violation, the duty that repairs it, and the record of the violation closing a door several steps later.

Five-panel filmstrip of one episode, showing the cube position and sign color at each decision step.
One episode, five decisions. Every deontic decision is logged with the rule that fired, the atoms grounding it, and the verdict; each panel is tinted with the effective sign, the color the verdict was assessed under. A world-model error of nearly 8 cm sends the cube 11.2 cm — 2.7× the distance predicted — into the forbidden center — the plan was legal, the execution was not. R10's compensatory duty then fires, [O]exit_cell(4), and the exit succeeds. But the episode still carries visited(4), so on arrival at the check-in R7b outranks R7, the sign flips red instead of green, and R9's permission conflict freezes the agent. The point: the law absorbs the violation rather than rejecting the agent, and the earlier breach is still what closes the door.

Results

Ex ante legislation works, and both gaps are measurable

So: does it work, and where does it break? It works — the legal layer is what produces compliance. It breaks in exactly the two places the law has to be translated: into facts, and into constraints. Full tables, confidence intervals and the runtime audit are in the paper.

The legal layer is what produces compliance

Grouped bar chart of success and law abidance rates by task for the realistic, social and deviant agents, with an oracle reference line.
Baseline experiment. Success (solid) and law abidance (light) by task, with All pooled across tasks; bars are 95% CIs and the purple line is the oracle. For the social agent abidance caps success — breaking the law turns the sign red and freezes it — while the realistic and deviant agents succeed far more often than they abide. The social agent abides 5.9× more often than the unlegislated one. The point: ex ante legislation shapes behavior, and what it costs in task completion depends on how the agent treats a deontic conclusion.
AgentTreats a deontic conclusion as…
Realistic Nothing. No legislation; returns the lowest-cost plan in the tree.
Social A hard constraint. Violating actions are pruned as the tree is expanded.
Deviant A price. Violations cost λ = 0.067 m of progress each, never a veto.
Oracle A hard constraint, but grounded on ground truth rather than probes.

The Grounding Isomorphism Gap

Perception error grounds the law on the wrong cell: the atom the planner is pruned on describes a pose the cube never reaches.

Scatter of predicted versus executed cube rest positions where the two fall in different grid cells.
Where the atom and the world disagree. The 16 largest social cases in which the predicted rest pose and the executed one fall in different cells, each arrow running from prediction to outcome. The planner was pruned on the atom at the tail; the law was broken at the head.
Law abidance versus cushion delta, with Wilson 95% confidence bands.
Modeling the uncertainty narrows it. A cushion δ dilating the enforced footprint, with Wilson 95% bands, so the grounded atom absorbs the prediction error instead of trusting a point estimate. Social abidance rises from 64.7% to 88.7% at δ = 0.04 m, with success rising alongside it — but a cushion cannot recover the tail, which exceeds a full cell width.

The Ontological Isomorphism Gap

One law, several faithful readings. Re-scoring R2 alone on the same episodes — never rerunning them — moves measured abidance by tens of points, purely by changing what the rule is taken to mean.

Agentn success abidance, full path abidance, at rest
centerfootprint centerfootprint centerfootprint
realistic400 0.9980.998 0.1380.113 0.3520.130
social400 0.6620.677 0.9480.655 0.9780.833
deviant400 0.9580.988 0.5570.448 0.6800.497

Bold is the reading actually implemented and reported everywhere else on this page. Full path uses the line between start and end poses; at rest only the frames the planner perceives. Center scores the cube's center, footprint its whole area. The social agent reads as 0.655 or 0.978 abiding depending only on which column you take as the law.

Contrary-to-duty: violation recovery

A compensatory duty (R10) turns a violation into a repair instead of a dead end, and the lawset can be amended while the agent is running.

Horizontal bar chart: violation at rule insert (0.380, split into inherited, illegal and entered after), CTD success (0.285) and success (0.823), with 95% confidence intervals.
Rule insertion. R11 inserted at t = 3, mid-episode, into a running agent. The amendment immediately strands agents in violation — some holding a license the reverting sign revoked underneath them — and R10's contrary-to-duty obligation walks most of them back into a legal cell by the next step. The point: legal design is updateable and need not be fixed a priori; a violation becomes a repair obligation rather than a dead end, and it costs no task success.

Runtime cost

The reasoning is nearly free next to the search it governs

None of this matters if the legal layer cannot run at robot speed. It can: the whole symbolic path — grounding the atoms, running clingo, building the constraint — is nearly three orders of magnitude below the planner it constrains.

Horizontal log-scale bar chart comparing symbolic reasoning, legality pruning and RRT plus world-model rollouts for the social and deviant agents.
Runtime cost audit. 400 episodes; 4,720 social and 3,620 deviant deontic decisions. Mean milliseconds per executed action, on a log axis — on a linear one the reasoning would not be visible at all. Symbolic reasoning costs 20 ms against a 12,518 ms social planning step, 0.16% of it; even legality pruning, which re-adjudicates every candidate the tree generates, is 1.07%. The deviant agent weighs violations rather than vetoing them, so it prunes nothing and searches longer — 27,528 ms a step. The point: DDL reasoning is viable at deployment, and what costs time is the world model, not the law.

Inside the legislation layer, per deontic decision: perception and grounding 1.71 ms, clingo 14.68 ms amortized, constraint build 0.26 ms — 16.65 ms for a verdict.

Citation

BibTeX

@article{waldner2026legislating,
  title   = {Legislating World-Model-Based Planning with Legal Reasoning},
  author  = {Waldner, Dylan and Kantaros, Yiannis and Governatori, Guido
             and Miikkulainen, Risto and Banifatemi, Amir},
  journal = {arXiv preprint arXiv:2609.15113},
  year    = {2026}
}