# Prawo jako kod

EN: **Rules as code** · id `rulesascode` · aliases: rules as code, RaC, law as code, machine-consumable legislation, executable legislation, Catala, prawo jako kod

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [AI w prawie](https://aiatlasgraph.com/t/legalai.md) › [Formalizacja prawa](https://aiatlasgraph.com/t/computationallaw.md) › Prawo jako kod

## Description

- PL: Tworzenie maszynowo wykonywalnej wersji przepisów obok tekstu prawnego, w specjalnych językach lub frameworkach, najlepiej już na etapie legislacji.
- EN: Creating a machine-executable version of legislation alongside the legal text, in dedicated languages or frameworks, ideally at the drafting stage.

## In one sentence

- PL: Przepisy, które coś wyliczają, np. podatek albo zasiłek, pisze się równolegle jako tekst dla ludzi i jako program dla komputera.
- EN: Rules that compute something, such as a tax or benefit, are written in parallel as text for people and as a program for computers.

## Problem it solves

- PL: Każdy urząd i firma osobno tłumaczy te same przepisy na kod, z różnymi błędami, więc obywatel dostaje różne wyniki w różnych systemach.
- EN: Every agency and firm separately translates the same rules into code, with different bugs, so citizens get different results in different systems.

## What it does

- PL: Jedna oficjalna, sprawdzalna wersja w kodzie staje się wspólnym wzorcem, a każdy artykuł ustawy ma w niej swój odpowiednik, więc łatwo znaleźć rozbieżność.
- EN: One official, checkable code version becomes the shared reference, with every article mapped to its counterpart, so mismatches are easy to find.

## Everyday example

- PL: Rodzice wpisują dochód i liczbę dzieci w kalkulatorze świadczeń, który korzysta z tej samej wersji przepisów co urząd przyznający pieniądze.
- EN: Parents enter their income and number of children into a benefits calculator that uses the same version of the rules as the paying agency.

## This concerns you if you…

- PL: budujesz kalkulator podatków, świadczeń lub opłat
- PL: pracujesz przy tworzeniu przepisów w administracji
- EN: build a tax, benefits or fees calculator
- EN: help draft rules in public administration

## Keywords

Catala · OpenFisca · OECD OPSI Cracking the Code · Better Rules · default logic · executable legislation · Blawx

## How it works

- PL: Języki takie jak Catala zapisują przepis artykuł po artykule z regułami domyślnymi i wyjątkami, a kompilator generuje kod do systemów. Frameworki mikrosymulacji modelują podatki i świadczenia jako zmienne zależne od daty. Testy z przykładami prawników wykrywają różnice między intencją a implementacją.
- EN: Languages such as Catala encode a provision article by article with default rules and exceptions, and a compiler generates code for systems. Microsimulation frameworks model taxes and benefits as date-dependent variables. Tests with lawyers' examples catch gaps between intent and implementation.

## Limits

- PL: Działa dla przepisów o charakterze algorytmu, a nie dla ocennych. Wymaga współpracy prawników z programistami i utrzymania kodu przy każdej nowelizacji. Nie rozstrzygnięto, która wersja wiąże, gdy tekst i kod się różnią.
- EN: It works for algorithm-like rules, not for discretionary ones. It needs lawyers and programmers to collaborate and code maintenance with every amendment. It is unresolved which version binds when text and code differ.

## Key terms

- PL: **reguła domyślna**: Reguła stosowana, dopóki nie zachodzi wskazany wyjątek.
- PL: **mikrosymulacja**: Liczenie skutków przepisów dla wielu modelowych gospodarstw domowych.
- EN: **default rule**: A rule that applies unless a stated exception holds.
- EN: **microsimulation**: Computing the effects of rules for many model households.

## Know first

- [Logika zdań i logika pierwszego rzędu (Propositional and first-order logic)](https://aiatlasgraph.com/t/fol.md)
- [Programowanie od specyfikacji (Spec-driven development with coding agents)](https://aiatlasgraph.com/t/specdriven.md)

## Related topics

Untyped, symmetric "see also" links.

- [Automatyczne sprawdzanie zgodności z przepisami (Automated regulatory compliance checking)](https://aiatlasgraph.com/t/compliancechecking.md)
- [Stosowanie przepisu do faktów (rozumowanie z ustaw) (Statutory reasoning)](https://aiatlasgraph.com/t/statutoryreasoning.md)
- [Ustrukturyzowane dokumenty prawne (Structured legal documents)](https://aiatlasgraph.com/t/machinereadablelaw.md)

## Sources

- [Catala: A Programming Language for the Law](<https://arxiv.org/abs/2103.03198>) `merigoux-catala-2021` · by Denis Merigoux, Nicolas Chataing, Jonathan Protzenko
- [Cracking the Code: Rulemaking for humans and machines](<https://oecd-opsi.org/publications/cracking-the-code/>) `oecd-cracking-the-code-2020` · by OECD Observatory of Public Sector Innovation (OPSI)
- [Conditional definitions and exceptions — The Catala domain-specific programming language](<https://book.catala-lang.org/en/2-2-conditionals-exceptions.html>) `catala-exceptions-docs` · by Catala contributors

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/rulesascode · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
