{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "theorem.schema.json",
  "title": "Theorem entry",
  "description": "One result that was proved assuming the Riemann Hypothesis or a generalization. Cross-field rules (status must agree with hypotheses) are enforced by scripts/validate.mjs.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "title",
    "field",
    "statement_plain",
    "statement_formal",
    "hypotheses_required",
    "status",
    "status_note",
    "sources",
    "review",
    "lean",
    "tags",
    "added"
  ],
  "properties": {
    "id": {
      "description": "Slug. Must equal the file name without .yaml.",
      "type": "string",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "maxLength": 80
    },
    "title": {
      "type": "string",
      "minLength": 3,
      "maxLength": 140
    },
    "field": {
      "description": "Controlled vocabulary.",
      "enum": [
        "analytic-number-theory",
        "algebraic-number-theory",
        "computational-number-theory",
        "additive-number-theory",
        "arithmetic-geometry",
        "complexity-theory",
        "topology"
      ]
    },
    "statement_plain": {
      "type": "string",
      "minLength": 10
    },
    "statement_formal": {
      "description": "Optional LaTeX (math mode, rendered as a display formula with KaTeX at build time).",
      "type": [
        "string",
        "null"
      ]
    },
    "hypotheses_required": {
      "description": "Every hypothesis the conditional proof needs. For proved-otherwise entries: the hypotheses of the historical conditional proof.",
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "enum": [
          "RH",
          "GRH-Dirichlet",
          "ERH-Dedekind",
          "GRH-Hecke",
          "GRH-Artin",
          "GRH-automorphic",
          "PLUS-EXTRA"
        ]
      }
    },
    "status": {
      "enum": [
        "unlocked",
        "partial",
        "still-conditional",
        "proved-otherwise"
      ]
    },
    "status_note": {
      "type": [
        "string",
        "null"
      ]
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "authors",
          "title",
          "year"
        ],
        "properties": {
          "authors": {
            "type": "string",
            "minLength": 2
          },
          "title": {
            "type": "string",
            "minLength": 2
          },
          "year": {
            "type": "integer",
            "minimum": 1700,
            "maximum": 2100
          },
          "venue": {
            "type": [
              "string",
              "null"
            ]
          },
          "doi": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^10\\.[0-9]{4,9}/\\S+$"
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^https://\\S+$"
          },
          "hypothesis_location": {
            "description": "Section or theorem number where the hypothesis is used.",
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "description": "What this source contributes to the entry.",
            "enum": [
              "conditional-proof",
              "unconditional-proof",
              "refinement",
              "formalization",
              "survey",
              null
            ]
          }
        }
      }
    },
    "review": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "state",
        "checked_by",
        "checked_on",
        "confidence",
        "open_questions"
      ],
      "properties": {
        "state": {
          "enum": [
            "ai-classified",
            "human-checked",
            "lean-verified"
          ]
        },
        "checked_by": {
          "type": [
            "string",
            "null"
          ]
        },
        "checked_on": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
        },
        "confidence": {
          "enum": [
            "low",
            "medium",
            "high"
          ]
        },
        "open_questions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "lean": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "proved",
        "path"
      ],
      "properties": {
        "proved": {
          "type": "boolean"
        },
        "path": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "rests_on": {
      "description": "Ids of entries whose result this entry's proof uses as an ingredient. Stricter than related.",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
      }
    },
    "related": {
      "description": "Ids of related entries.",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
      }
    },
    "tags": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
      }
    },
    "added": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
    },
    "waiting_on": {
      "description": "For still-conditional and partial entries: the families of L-functions or assumptions the result is still waiting on. Codes are defined in data/meta/waiting.yaml.",
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "enum": [
          "kummer-fields",
          "galois-extensions",
          "single-field-zeta",
          "class-group-characters",
          "power-residue-characters",
          "modular-form-l-functions",
          "higher-automorphic",
          "extra-assumption"
        ]
      }
    },
    "author_submitted": {
      "description": "Present only when the entry was contributed by an author of its source and that source is not refereed or on arXiv. Such entries are shown with a separate label and are left out of the headline counts.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "by",
        "source_standing"
      ],
      "properties": {
        "by": {
          "description": "Name or GitHub handle of the contributor.",
          "type": "string",
          "minLength": 1
        },
        "source_standing": {
          "enum": [
            "self-published",
            "preprint-by-contributor"
          ]
        },
        "note": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}
