{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://lyndondrake.github.io/ice-mixing-notes/schema/manifest.schema.json",
  "title": "Claims manifest for a contribution note",
  "description": "One record per claim of a stand-alone note: what is asserted, with what standing, resting on what, reproducible how, and by whom. The vocabulary of standing is the project's: see the method note. A manifest is a projection of the project's log, written so that a reader, human or machine, can take a claim without the history.",
  "type": "object",
  "required": ["schema_version", "note", "title", "version", "date", "sources", "licence", "claims"],
  "additionalProperties": false,
  "properties": {
    "schema_version": { "const": "1.0" },
    "note": { "type": "string", "pattern": "^[a-z0-9-]+$", "description": "The note's slug; the claim identifiers are prefixed by it." },
    "title": { "type": "string" },
    "version": { "type": "string", "description": "The note revision this manifest describes, as an ISO date or a tag." },
    "date": { "type": "string", "format": "date" },
    "doi": { "type": ["string", "null"], "description": "DOI of the archived release of this version, when one exists." },
    "sources": {
      "type": "object",
      "required": ["markdown"],
      "properties": {
        "markdown": { "type": "string" },
        "pdf": { "type": "string" },
        "html": { "type": "string" },
        "repository": { "type": "string", "format": "uri" }
      }
    },
    "licence": {
      "type": "object",
      "required": ["text"],
      "properties": {
        "text": { "type": "string", "description": "SPDX identifier for the note's text, e.g. CC-BY-4.0." },
        "code": { "type": "string" },
        "data": { "type": "string" }
      }
    },
    "authors": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Human authors. Model contributions are recorded per claim under provenance."
    },
    "summary": { "type": "string", "description": "A few sentences for a reader deciding whether to open the note." },
    "open_problems": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Claim identifiers (in this or another manifest) whose status is open or conjecture and which the note presents as the targets."
    },
    "claims": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/claim" }
    }
  },
  "$defs": {
    "claim": {
      "type": "object",
      "required": ["id", "kind", "label", "statement", "status", "scope", "depends_on", "provenance"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9-]+/[a-z0-9-]+$",
          "description": "note-slug/claim-slug. Stable across revisions of the note even if the note's numbering changes."
        },
        "kind": {
          "type": "string",
          "enum": ["definition", "lemma", "theorem", "corollary", "fact", "conjecture", "negative-result", "certificate-campaign"],
          "description": "negative-result: a route shown not to work, recorded so it is not retried. certificate-campaign: a family of machine-checked proofs on named cells."
        },
        "label": { "type": "string", "description": "How the note names it in this version, e.g. 'Theorem 1 (the reduction)'." },
        "gist": { "type": "string", "description": "One short sentence saying what the claim asserts, for a reader who does not know the note's names; shown beside the label in the index. Plain language, LaTeX only where unavoidable." },
        "statement": { "type": "string", "description": "The statement in plain language with LaTeX where needed. Self-contained enough to be read without the note; terms defined in the note are named, not explained." },
        "status": {
          "type": "string",
          "enum": ["proved", "proved-unchecked", "certified", "solver", "computed", "explored", "conjecture", "open", "closed-route", "corrected", "refuted"],
          "description": "proved: a written argument read by an independent checker with its own programs. proved-unchecked: a written argument with no second reader. certified: a machine-checked proof object (DRAT, LRAT, a CPOG-certified count, Lean, Isabelle) on the cells named in scope. solver: a SAT or LP verdict on named cells without a checked proof object. computed: an exact computation with no solver verdict. explored: floating-point or sampled evidence only. conjecture: believed, with evidence named. open: a target with no verdict. closed-route: a method shown not to reach the target. corrected: a statement of an earlier version repaired here. refuted: shown false, with a witness."
        },
        "status_detail": { "type": "string", "description": "What the status rests on, in one or two sentences: which checker, how many cells, what was re-run." },
        "scope": {
          "type": "object",
          "required": ["cells"],
          "properties": {
            "cells": { "type": "string", "description": "The cells the claim holds on, as the note states them: 'every cell', 'every cell with all extents at least two', 'cubic cells of side 4 to 8', a list." },
            "cells_list": {
              "type": "array",
              "items": { "type": "array", "items": { "type": "integer", "minimum": 1 }, "minItems": 3, "maxItems": 3 },
              "description": "Optional machine-readable list of the specific cells (a, b, c) a computational claim was run on."
            },
            "hypotheses": { "type": "string", "description": "Standing hypotheses not repeated in the statement (frozen, odd, every hole oriented, ...)." }
          }
        },
        "depends_on": {
          "type": "array",
          "items": { "type": "string", "pattern": "^[a-z0-9-]+/[a-z0-9-]+$" },
          "description": "Claim identifiers this claim's proof uses, in this or another manifest. Empty for definitions and for certificate campaigns that rest on nothing but the encoding."
        },
        "supersedes": { "type": "string", "pattern": "^[a-z0-9-]+/[a-z0-9-]+$", "description": "An earlier claim this one replaces or corrects." },
        "artefacts": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["kind", "path"],
            "additionalProperties": false,
            "properties": {
              "kind": { "type": "string", "enum": ["script", "ledger", "certificate", "report", "lean", "isabelle", "data", "log"] },
              "path": { "type": "string", "description": "Path in the published repository, or in the source repository if not published (then 'private:' prefix). May be a directory or a glob pattern when a campaign has many files; a validator then requires at least one match." },
              "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
              "size_bytes": { "type": "integer" },
              "regenerate": { "type": "string", "description": "The command that regenerates this artefact from the scripts, with its environment." },
              "note": { "type": "string" }
            }
          }
        },
        "formal": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "system": { "type": "string", "enum": ["lean4", "isabelle"] },
            "declaration": { "type": "string", "description": "The fully qualified name of the formal statement." },
            "status": { "type": "string", "enum": ["none", "stated", "proved"], "description": "stated: the statement compiles with the proof left open. proved: no sorry, axioms listed." },
            "axioms": { "type": "array", "items": { "type": "string" } },
            "project": { "type": "string", "description": "Path of the Lake or Isabelle project." }
          }
        },
        "provenance": {
          "type": "object",
          "required": ["written_by", "checked_by", "human_read", "date"],
          "additionalProperties": false,
          "properties": {
            "written_by": { "type": "array", "items": { "type": "string" }, "description": "Who wrote the proof or ran the computation: a model with its agent name, or a person." },
            "checked_by": { "type": "array", "items": { "type": "string" }, "description": "Independent readers, agents or people, that read the argument or the encoding with their own programs; empty if none. Mechanical checkers and second methods go under cross_checks." },
            "cross_checks": { "type": "array", "items": { "type": "string" }, "description": "Mechanical or methodological cross-checks that are not a reading: a proof checker (drat-trim, the Lean kernel), a second enumerator, a second implementation, an exact re-run of a sample." },
            "human_read": { "type": "boolean", "description": "Whether a person has read the proof line by line." },
            "date": { "type": "string", "format": "date", "description": "Date the claim reached its current status." },
            "log": { "type": "string", "description": "Where in the project's log the claim and its verification are recorded." }
          }
        },
        "notes": { "type": "string", "description": "Anything a reader taking this claim out of context must know: a hypothesis that is easy to miss, a correction's history, what the claim does not say." }
      }
    }
  }
}
