Skip to content

Records

Schema reference for all governance, versioning, contract selection, checkpoint, and execution records in a Lema store.

While canonical lema.core/v4 objects represent mathematical definitions, statements, and proofs, store records (crates/lema-store) capture project snapshots, contract selections, revisions, policies, semantic merges, change reports, checkpoints, VM guarantee receipts, and releases.

Every immutable record is serialized as canonical JSON and content-addressed with a dedicated SHA-256 domain separator so that a record ID can never collide with a lema.core/v4 object ID or a record of another schema.


Store records and files at a glance

Schema or fileHash domain prefixMutabilityPurpose
aliases.jsonNone (mutable index)MutableMaps human-readable alias names to 64-hex lema.core/v4 object IDs.
entries.jsonNone (mutable index)MutableMaps human-readable entry aliases to lema.exec/v2 record IDs (LEMA-289).
refs.jsonNone (mutable index)MutableMaps project reference names (such as main) to {policy, revision, generation}.
actors.json (lema.actors/v1)None (store-local)Append/revokeMaps actor IDs to SHA-256 bearer token hashes and roles.
lema.bundle/v1LEMA-BUNDLE-v1\0ImmutableNamed collection of exported aliases (entries: {name: id}).
lema.binding-map/v1LEMA-BINDING-MAP-v1\0ImmutableMaps symbolic module imports (alias) to lema.bundle/v1 IDs.
lema.authoring/v2LEMA-AUTHORING-v2\0ImmutablePreserves source files, elaboration inputs, symbolic imports, and lema.contract/v1 IDs.
lema.validation/v1LEMA-VALIDATION-v1\0ImmutableStore-local validation receipt for a lema.authoring/v2 bundle.
lema.asset/v1LEMA-ASSET-v1\0ImmutableContent-addressed non-Lean project file (asset, config, doc, or license).
lema.snapshot/v2LEMA-SNAPSHOT-v2\0ImmutableComplete project state: exported entries, bindings, optional authoring, and assets.
lema.contract/v1LEMA-CONTRACT-v1\0ImmutableContract or law selection record with open, checked, or waived status.
lema.revision/v1LEMA-REVISION-v1\0ImmutableCommit record binding parent revisions, a snapshot, intent, obligations, and discharged.
lema.policy/v1LEMA-POLICY-v1\0ImmutableGovernance rules for a project reference (require, protect, review).
lema.review/v1LEMA-REVIEW-v1\0ImmutableActor sign-off on a target revision, policy, or release (approve or reject).
lema.review-display/v1LEMA-REVIEW-DISPLAY-v1\0ImmutableReview record binding the exact view::renderer_sha256() digest and displayed text.
lema.guarantee/v1 / lema.vm-guarantee/v1LEMA-GUARANTEE-v1\0ImmutableStatic analysis receipt for VM resource, constant-time, and secret-flow profiles.
lema.merge/v1LEMA-MERGE-v1\0ImmutableThree-way semantic merge record (base, left, right, conflicts, resolutions).
lema.change-report/v1LEMA-CHANGE-REPORT-v1\0ImmutableSemantic diff report across seven change categories plus contract status deltas.
lema.view/v1LEMA-VIEW-v1\0ImmutableCurated inspection markers (contract, entrypoint, headline_guarantee).
lema.derivation/v1LEMA-DERIVATION-v1\0ImmutableProvenance record for rebind and instantiate object derivations.
lema.checkpoint/v1LEMA-CHECKPOINT-v1\0ImmutableSelf-contained .lemabundle archive of objects, aliases, records, and entries.
lema.exec/v2LEMA-EXEC-v1\0ImmutableResolved VM execution manifest binding root declaration IDs, families, and limits.
lema.release/v1LEMA-RELEASE-v1\0ImmutableProduction release record binding revision, snapshot, guarantees, reviews, and artifact digests.

Bundles, binding maps, authoring, assets, and snapshots

lema.bundle/v1 (LEMA-BUNDLE-v1\0)

A bundle groups exported declarations under local names so downstream modules can import them without hardcoding raw object IDs:

JSON
{
  "entries": {
    "Counter": "4a18...90e1",
    "advance_law": "9c02...11b4"
  },
  "schema": "lema.bundle/v1"
}

lema.binding-map/v1 (LEMA-BINDING-MAP-v1\0)

Maps symbolic module aliases (Received.<alias>.<member>) to specific lema.bundle/v1 IDs:

JSON
{
  "bindings": [
    {
      "alias": "Storage",
      "bundle": "7e31...c408"
    }
  ],
  "schema": "lema.binding-map/v1"
}

lema.authoring/v2 (LEMA-AUTHORING-v2\0)

Records the exact inputs used to elaborate a module or package, including elaboration (source, prefix, roots, seed_salt, seeds, receive), symbolic imports, optional contracts ([<contract_id>, ...]), and metadata. When validated, the store also writes a lema.validation/v1 receipt (LEMA-VALIDATION-v1\0).

lema.asset/v1 (LEMA-ASSET-v1\0)

Stores non-code project files (such as lema-cap.json, documentation, or license texts) alongside code in a snapshot:

FieldTypeDescription
schema"lema.asset/v1"Schema identifier.
kind"asset" | "config" | "doc" | "license"Asset classification.
bytesBase64 / hex stringRaw file payload.
sha25664-hex stringSHA-256 digest of the raw file bytes.
sizeIntegerByte length of the file.
licenseString (optional)SPDX license identifier when kind == "license".
coversArray of strings (optional)Relative paths covered by a license asset.

lema.snapshot/v2 (LEMA-SNAPSHOT-v2\0)

Captures the complete state of a project tree at a point in time:

JSON
{
  "assets": [
    {
      "id": "5d20...8a11",
      "path": "lema-cap.json"
    }
  ],
  "authoring": "c841...09f2",
  "bindings": "1b09...44e7",
  "entries": {
    "App.main": "e012...77a3",
    "App.spec": "3a99...bc01"
  },
  "schema": "lema.snapshot/v2"
}

Contract selections

lema.contract/v1 records (crates/lema-store/src/records/contract.rs, hash domain LEMA-CONTRACT-v1\0) represent progressive verification targets created via select declarations in .lema files or the contract.select API method.

Because every lema.contract/v1 record is immutable and content-addressed, discharging an open contract or waiving it produces a new lema.contract/v1 record with a new 64-hex ID rather than mutating the existing record in place.

JSON
{
  "arguments": [
    "8b14...e77a"
  ],
  "by": "d409...22c8",
  "contract_or_claim": "3f9a...c102",
  "laws": [
    {
      "by": "a117...66f0",
      "field": "preserve",
      "target": {
        "check": "statement",
        "statement": "0e55...91d3",
        "type": "0e55...91d3"
      }
    }
  ],
  "schema": "lema.contract/v1",
  "scope": {
    "kind": "snapshot",
    "snapshot": "f920...18b4"
  },
  "status": "checked",
  "target": {
    "check": "satisfaction",
    "levels": 0,
    "realizations": [
      {
        "from": "3f9a...c102",
        "to": "8b14...e77a"
      }
    ],
    "statement": "6c44...30a1",
    "type": "2b88...71e9"
  }
}

Key fields of lema.contract/v1

FieldTypeDescription
contract_or_claimObject IDThe record, declaration, statement, or template being selected.
levelsArray of strings (optional)Universe level instantiations (must be monomorphic, levels: 0 in target).
argumentsArray of Object IDsConcrete implementation declarations passed to the contract or claim.
targetObjectSynthesized verification target (levels: 0, type, realizations?, statement, check: "proof" | "satisfaction").
lawsArray (optional)Per-law breakdown (field, target, optional default, optional by witness ID) when selecting a multi-law contract record.
scopeObjectEither {"kind": "global"} or {"kind": "snapshot", "snapshot": "<id>"}.
status"open" | "checked" | "waived"Current verification state of the selection.
byObject ID (optional)Whole-selection proof or satisfaction witness ID when status == "checked".
reasonString (optional)Explicit waiver justification when status == "waived".

When status is "checked", Store::check_witness verifies that either a whole-selection witness by satisfies target, or every entry in laws has a valid per-law witness by (or verified default law proof) that discharges its synthesized law statement.


Revisions, obligations, and project references

lema.revision/v1 (LEMA-REVISION-v1\0)

A revision is an immutable commit record linking a lema.snapshot/v2 to its parent revisions and tracking proof obligations:

JSON
{
  "author": "alice",
  "discharged": [
    {
      "by": "d409...22c8",
      "obligation": {
        "selection": "91a0...55e2"
      }
    }
  ],
  "intent": "Verify counter conservation law",
  "obligations": [],
  "parents": [
    "6b12...04d9"
  ],
  "schema": "lema.revision/v1",
  "snapshot": "f920...18b4"
}

Each entry in obligations or discharged identifies either a raw statement ID ({"statement": "<id>"}) or a contract selection ID ({"selection": "<contract_id>"}). An obligation is discharged either by a checked proof/satisfaction ("by": "<id>") or by an explicit recorded waiver ("waiver": {"actor": "<id>", "reason": "<text>"}).

refs.json

Each named project reference in refs.json tracks:

  • policy: The active lema.policy/v1 record ID governing the reference.
  • revision: The current head lema.revision/v1 record ID.
  • generation: A monotonically increasing integer incremented on every ref.publish or ref.adopt operation to prevent lost updates.

Policies

lema.policy/v1 records (LEMA-POLICY-v1\0) define what a revision must satisfy before lema commit or ref.publish can advance a project reference.

JSON
{
  "protect": [
    {
      "gate": "preserve-law",
      "target": "App.spec"
    }
  ],
  "require": {
    "axioms": [
      "propext",
      "Quot.sound",
      "Classical.choice"
    ],
    "no_obligations": true,
    "profiles": [
      "ConstantTime"
    ]
  },
  "review": {
    "actors": [
      "alice",
      "bob"
    ],
    "threshold": 1
  },
  "schema": "lema.policy/v1"
}
SectionFieldEnforcement during ref.publish and release.create
require.axiomsArray of axiom namesEvery object in the snapshot’s transitive closure must use only a subset of these axioms (always above the fixed floor).
require.no_obligationsBooleanWhen true, refuses publication if the revision has any remaining open obligations or "status": "open" contract selections.
require.profilesArray of profile namesRequires matching lema.vm-guarantee/v1 receipts for all entrypoints in the snapshot.
protectArray of {target, gate}Prevents changing or weakening protected aliases (preserve-id, preserve-type, or preserve-law).
review{threshold, actors}Requires at least threshold approving lema.review/v1 records signed by distinct listed actors.

Reviews, merges, change reports, and guarantees

lema.review/v1 and lema.review-display/v1

  • lema.review/v1 (LEMA-REVIEW-v1\0) records an actor’s "approve" or "reject" decision over a target record (revision, policy, or release) with a timestamp and comment.
  • lema.review-display/v1 (LEMA-REVIEW-DISPLAY-v1\0, crates/lema-store/src/display.rs) binds a review decision to the exact rendered contract text (displayed), the syntax mode ("lema" or "lean"), and view::renderer_sha256() so auditors can prove what text the reviewer saw.

lema.merge/v1 (LEMA-MERGE-v1\0)

Records a three-way semantic merge between base, left, and right revisions. If structural conflicts occur, conflicts classifies each one into one of five kinds:

  • collision: Both branches added the same alias or asset path with different IDs.
  • delete-update: One branch deleted an alias while the other modified it.
  • update-update: Both branches modified the same alias to incompatible objects.
  • rename-rename: Both branches renamed the same underlying object ID to different aliases.
  • bundle: Incompatible symbolic binding updates in lema.binding-map/v1.

When obligations from one branch still apply to unchanged statements on the other branch, the merge record tracks proof reuse under reuse.

lema.change-report/v1 (LEMA-CHANGE-REPORT-v1\0)

Produced by lema diff, revision.report, and snapshot.diff. Classifies every semantic change between two snapshots into seven categories:

  1. rename: Same object ID moved to a new alias name.
  2. exports: Aliases added or removed from the snapshot surface.
  3. rebind: Symbolic dependency bundle updated without changing local source.
  4. substitute: Implementation replaced with a definition proven equivalent or refining (Replaces / Refines).
  5. evolve: Implementation changed with a new or compatible specification.
  6. policy: Governance policy requirements narrowed or widened.
  7. material: Unwitnessed behavioral or statement change requiring review.

It also includes a contracts summary listing newly checked, open, or waived lema.contract/v1 selections.

lema.guarantee/v1 and lema.vm-guarantee/v1 (LEMA-GUARANTEE-v1\0)

Records static verification of VM execution properties (scope: "root" | "application", families, profiles, compiler, and receipt). See Execution Manifest for the full list of VM guarantee profiles.


Checkpoints, execution records, and releases

lema.checkpoint/v1 (LEMA-CHECKPOINT-v1\0)

Written to .lemabundle files by lema export (crates/lema-store/src/records/checkpoint.rs). A checkpoint packages a self-contained closure of objects, aliases, bundles, records (snapshots, contracts, revisions, policies, guarantees), excluded boundary object IDs, and entries (entries.json mappings). Importing a checkpoint with lema import replays every object through the Lean kernel before admitting the records.

lema.exec/v2 (LEMA-EXEC-v1\0)

Resolved VM execution record binding an application entry declaration ID (entry.root), its allowed capability families, dependency roots, guarantees, limits, and seconds. See Execution Manifest.

lema.release/v1 (LEMA-RELEASE-v1\0)

Created by lema release (release.create). Binds a published revision, snapshot, policy, exec record ID, guarantees, approving reviews, target kind ("vm"), and the compiled lema.vm-app/v1 artifact digest (sha256). Deployment lifecycle transitions (select, withdraw, supersede) are recorded under LEMA-DEPLOYMENT-v1\0.

Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility