Law as Code in Autonomous Drone Perception: Active Inference for Context-Dependent Legal Compliance
Abstract Autonomous drones that perceive and act in real time create compliance problems that post-hoc auditing cannot fix: by the time a violation is detected, the drone has already acted. We propose a Legal Actuator Layer (LAL), a middleware between perception and actuation that enforces regulatory constraints before the drone acts. Where conventional Law-as-Code encodes rigid if-then rules, we formalize legal obligations as prior preferences in an Active Inference (AIF) agent that weighs competing obligations through expected free energy minimization. In nine simulation experiments, the AIF-LAL matches hand-coded rules where a single obligation applies (GDPR data minimization, EASA geofencing). Where obligations conflict, it outperforms both rule variants: it enters restricted airspace during an authorized medical emergency that a rigid geofence rule misses, while a rule with a hard-coded exception fires on dispatch noise in 56% of normal trials. When the legal trigger and the privacy constraint are out of phase, it is the only one of four agents that reaches the target on every trial while keeping privacy violations low, and it stops acting under heavy sensor noise. Naive Bayesian learning of the observation model collapses this behavior even when the learned model is close in L1 norm; calibrating the compliance-relevant sensors and learning only the environmental signals recovers most of the lost compliance. The residual gap is structural: a compliant agent cannot learn the channel that carries legal sanctions, because generating the training data would mean violating. The compiled decision cycle runs in 0.31 ms, well within real-time control budgets.
Authors
- Nicolás Hinrichs (ORCID: https://orcid.org/0000-0003-4969-9644)
- Mahault Albarracin (ORCID: https://orcid.org/0000-0003-0916-4645)
Institutions
- Université du Québec à Montréal (CA)
- Max Planck Institute for Human Cognitive and Brain Sciences (DE)
Publication Details
- Journal
- Research Square
- Published
- 2026-11-11
- DOI
- https://doi.org/10.21203/rs.3.rs-10731459/v1
- Primary Topic
- Artificial Intelligence in Law
- Type
- preprint