{
  "id": "KL-FCS-018",
  "version": "1.0.0",
  "domain": "Type systems",
  "kind": "types",
  "title": "The Boolean identity function",
  "problem": "Reconstruct the type under Boolean binders and lexical scope.",
  "specification": {
    "term": [
      "lam",
      "x",
      "Bool",
      [
        "var",
        "x"
      ]
    ],
    "rules": "Boolean literals, contextual variables, annotated lambdas, and exact-domain applications."
  },
  "claim": {
    "type": [
      "arrow",
      "Bool",
      "Bool"
    ]
  },
  "witness": {
    "method": "syntax-directed reconstruction"
  },
  "verification_scope": "Exact syntax-directed typing judgment",
  "explanation": "The binder extends the context for its body. The inner lambda preserves access to outer bindings, and the resulting type records each input separately.",
  "limitations": "Only the declared lambda fragment is checked; no inference of polymorphic or dependent types occurs.",
  "verification_status": "mechanically-checked",
  "review_status": "awaiting-independent-review",
  "provenance": {
    "origin": "Original Kenton Labs reference instance, authored with Codex assistance on 2026-10-11.",
    "external_dataset": null,
    "model_run": null
  },
  "references": [
    "https://softwarefoundations.cis.upenn.edu/plf-current/Stlc.html"
  ],
  "license_status": "not-yet-selected",
  "dataset": {
    "family": "type-systems",
    "task": "Reconstruct the type under Boolean binders and lexical scope.",
    "input_encoding": "Structured JSON; field meanings are stated in the specification.",
    "coverage": "Exact syntax-directed typing judgment",
    "acceptance": [
      "Walk the term recursively from an empty context.",
      "Extend the context when entering an annotated lambda.",
      "Construct arrow types for abstractions.",
      "At each application, check the argument type and return the codomain."
    ],
    "generation": "Deterministic finite fixture; full enumeration or witness replay as stated.",
    "split_policy": "Reference corpus for exposition and reproduction; no train/test evaluation split is claimed."
  },
  "lesson": {
    "motivation": "Reconstruct a typing judgment from syntax, annotations, and context. Separate the validity of one judgment from the soundness of a language.",
    "definitions": [
      {
        "term": "Context",
        "definition": "A map assigning types to variables currently in scope."
      },
      {
        "term": "Arrow type",
        "definition": "A function domain and codomain, written A → B."
      },
      {
        "term": "Application rule",
        "definition": "A function may be applied only to an argument matching its domain type."
      }
    ],
    "reasoning": [
      "Walk the term recursively from an empty context.",
      "Extend the context when entering an annotated lambda.",
      "Construct arrow types for abstractions.",
      "At each application, check the argument type and return the codomain."
    ],
    "worked_example": "The binder extends the context for its body. The inner lambda preserves access to outer bindings, and the resulting type records each input separately.",
    "complexity": "The syntax-directed checker visits each term node; context lookup and type comparison add implementation-dependent cost.",
    "common_error": "Being well typed is not, by itself, a proof of preservation or progress.",
    "further_work": "Add independently checked derivation trees and a broader type grammar."
  },
  "related_ids": [
    "KL-FCS-004",
    "KL-FCS-019"
  ]
}
