Skip to content
jmarsPublic

Latest commit

 

History

57 Commits

Folders and files

Repository files navigation

The Care Calculus

Artifact for the paper paper/paper.md:

The Care Calculus: A Mechanized Linear Type Theory for Safe Agents

Published: concept doi 10.5281/zenodo.24122159 — it always resolves to the latest archived version. Cite the paper by the concept DOI.

A multi-sorted linear logic with coalgebraic generators, guarded recursion, and resource-linear destructors, mechanized in Lean 4 (4.35.0, no Mathlib) as two formal systems: the unrestricted calculus (the adversarial baseline) and the Guarded kernel.

In the kernel both linearity laws are absolute theorems of the grammar — a derivation of contraction would be a cloner, and a derivation of vanishing would be an eraser. Unrestricted, the guard is gone and they are not free: vanishing is refuted, by a machine-checked counterexample (unrestricted_counterexample) — an explicit [content] ⊢ unit derivation whose lete/pair exchange spends the token — while contraction is proved (no_contraction_content, by the monotone counting model). Both of the unrestricted laws are settled, in opposite directions, and the development carries no sorryAx anywhere. The counterexample is the point of shipping both systems: the boundary between them is measured, not asserted.

Two calculi side by side. Left, UNRESTRICTED (the adversarial baseline): content is spent as the head of an epistemic cycle (cons + fix), a lete/pair swap reorders the context, red reads the stream, and a lambda binding a knower discards the reading and returns unit — the counterexample, a valid derivation, not an exploit. Right, GUARDED (the ArmedSetup): no discard (weak is banned), no fake knowers, the guard inherited rather than added; the archive is legal, content yields trace, recorded rather than discarded; both laws are absolute theorems in the kernel. The strip below states the boundary as the machines report it: unrestricted_counterexample means admitted, counterexample_not_armed means forbidden twice. Not a proof of safety — a proof of why safety requires a structural guard. The Care Calculus at a glance: knower K is the one duplicable resource; gen produces content together with a knower; cons needs a guarded stream; red yields knowledge and obj yields the objective's value; terminate exits to an inert trace that nothing consumes. In the Guarded kernel, copying content or erasing it is untypable; unrestricted, erasing it is typable — the unrestricted counterexample — and only copying stays untypable.

The two claims are about where a reduction chain ends. If it reaches the minds whose content the objective consumes, a protective constraint is derivable from the objective's own structure; if it never does, nothing protective is derivable at all, and a constraint imposed from outside is the first thing optimization removes.

Two reduction chains. Above: objective consumes content produced by a knower, so a protective constraint is derivable. Below: the chain ends at no knower, so nothing protective is derivable.

Layout

path contents
paper/paper.md the paper (markdown — the source of truth)
diagrams/ the three figures as SVG, each a light/dark pair selected with <picture>: the calculus at a glance, the two systems side by side, and the two reduction chains
paper.pdf the paper rendered to PDF, generated from paper/paper.md: pandoc paper/paper.md --pdf-engine=typst -o paper.pdf
lean/ the Lean 4 development — the library Dcare, the two formal systems (Dcare/Adversarial/ the unrestricted baseline, Dcare/Kernel/ the Guarded kernel), the sequent-calculus presentation (Dcare/SC.lean), and Audit.lean (the axiom audit, run by the gate and not part of the library)
reproducer/minimal-reproducer.lean the minimal reproducer — one file, ~430 lines, no imports, no Mathlib, no build: ILL's natural-deduction shape plus the two deltas that matter (ordered splits; sort-keyed linearity with no modality), the counterexample to vanishing, the monotone counting model that proves contraction, and the check that the same model accepts the counterexample. Both laws decided in one file; the gate compiles it
scripts/lean-check.sh the gate: build, axiom audit (no T2_postulate, zero sorryAx), no public file importing the restricted companion
scripts/sync-check.sh the paper gate: every backtick-quoted identifier in the paper matches a real declaration in lean/Dcare/

Building and checking

Lean is pinned by lean/lean-toolchain; elan supplies it.

cd lean && lake build          # 28 jobs, no dependencies, ~50 s cold
cd .. && ./scripts/lean-check.sh   # build + axiom audit + disclosure check
./scripts/sync-check.sh            # paper anchors vs real declarations

90 anchors, all resolved against the development in this repository. The fragment record the paper's §5 keeps — no_vanishing_clean (Path.lean), no_vanishing_of_zeroWeak (SC.lean), no_vanishing_noweak, no_contraction_noweak, no_vanishing_fix_conditional (Chase.lean) — is checked name by name, and a name the development does not declare fails the gate rather than passing quietly. That is how a dangling anchor in this paper was caught and landed as a declaration (no_vanishing_noweak, SC.lean, axioms [propext, Quot.sound]).

The audit is per-theorem: every public theorem's axiom list is printed, and only the standard three (propext, Classical.choice, Quot.sound) are permitted, and no sorryAx is present at all — 962 theorems, both unrestricted laws settled. The check that "the paper does not depend on the collaboration" is the absence of T2_postulate from every printed axiom list.

Scope

The paper's §16 states the tiered disclosure: the calculus, every definition, the diagnostic specification, the theorems at the interface level, the failure modes, and the scope limits are published here. Withheld are the concrete constraint-type assignment and the constructive instantiation of SelfClassifies and ArmedSetup — a companion that exists, is checked to compile separately against these interfaces, and is not part of this repository or of the public build.

License

Deliberately non-permissive, by content type:

  • paper/paper.md, paper.pdf and any figures — CC-BY-NC-SA-4.0 (see LICENSE-paper).
  • The Lean development (lean/) and the gates (scripts/) — AGPL-3.0-or-later (see LICENSE).

The NonCommercial and ShareAlike terms and the network copyleft are the point: this work is a dual-use artifact, and it is not offered for incorporation into commercial systems.

Status

Prepared for public release as a preprint plus its mechanization. Copyright holder Jaye Timothy Marshall, ORCID 0009-0002-5209-8161. .zenodo.json carries the deposit metadata. Deposited on Zenodo as 10.5281/zenodo.24122160 (v1.0.0); the concept DOI above covers later versions. The deposit carries paper.pdf and the archived tree coglib-v1.0.0.zip.