{
  "name": "Programming-language semantics",
  "version": "1.0.0",
  "area": {
    "name": "Programming-language semantics",
    "slug": "semantics",
    "group": "Languages & logic",
    "kind": "semantics",
    "summary": "Turn an expression’s meaning into an inspectable sequence of rule applications. Evaluation order belongs to the specification.",
    "definitions": [
      {
        "term": "Term",
        "definition": "An integer literal or an add/mul syntax node."
      },
      {
        "term": "Small step",
        "definition": "One permitted local reduction, under an explicitly chosen evaluation context."
      },
      {
        "term": "Normal form",
        "definition": "A term with no further reduction; here it is an integer literal."
      }
    ],
    "methodology": [
      "Check that the trace begins with the declared syntax tree.",
      "Reduce the left non-literal operand before the right operand.",
      "Apply arithmetic only when both operands are integer literals.",
      "Check each adjacent trace pair and require a terminal integer."
    ],
    "complexity": "Replay costs one reduction per arithmetic node, plus traversal to find the next reducible node.",
    "common_error": "A final number alone does not certify the declared evaluation sequence.",
    "next_question": "Introduce variables, environments, conditionals, and explicit stuck-state outcomes.",
    "references": [
      "https://softwarefoundations.cis.upenn.edu/plf-current/Smallstep.html"
    ]
  },
  "records": [
    {
      "id": "KL-FCS-003",
      "version": "1.0.0",
      "domain": "Programming-language semantics",
      "kind": "semantics",
      "title": "Replay an arithmetic reduction",
      "problem": "Evaluate (2 × 3) + 4 using left-to-right small-step reduction on integer literals, addition, and multiplication.",
      "specification": {
        "term": [
          "add",
          [
            "mul",
            2,
            3
          ],
          4
        ],
        "rules": "Reduce the left non-literal operand first, then the right; combine two integer literals."
      },
      "claim": {
        "normal_form": 10
      },
      "witness": {
        "trace": [
          [
            "add",
            [
              "mul",
              2,
              3
            ],
            4
          ],
          [
            "add",
            6,
            4
          ],
          10
        ]
      },
      "verification_scope": "Exact reduction replay · 2 steps",
      "explanation": "Every adjacent term must follow the declared reduction rule. The final term is the literal 10 and cannot reduce further.",
      "limitations": "One ground term in a deliberately small language; no general termination or confluence theorem.",
      "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/Smallstep.html"
      ],
      "license_status": "not-yet-selected",
      "dataset": {
        "family": "semantics",
        "task": "Evaluate (2 × 3) + 4 using left-to-right small-step reduction on integer literals, addition, and multiplication.",
        "input_encoding": "Structured JSON; field meanings are stated in the specification.",
        "coverage": "Exact reduction replay · 2 steps",
        "acceptance": [
          "Check that the trace begins with the declared syntax tree.",
          "Reduce the left non-literal operand before the right operand.",
          "Apply arithmetic only when both operands are integer literals.",
          "Check each adjacent trace pair and require a terminal integer."
        ],
        "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": "Turn an expression’s meaning into an inspectable sequence of rule applications. Evaluation order belongs to the specification.",
        "definitions": [
          {
            "term": "Term",
            "definition": "An integer literal or an add/mul syntax node."
          },
          {
            "term": "Small step",
            "definition": "One permitted local reduction, under an explicitly chosen evaluation context."
          },
          {
            "term": "Normal form",
            "definition": "A term with no further reduction; here it is an integer literal."
          }
        ],
        "reasoning": [
          "Check that the trace begins with the declared syntax tree.",
          "Reduce the left non-literal operand before the right operand.",
          "Apply arithmetic only when both operands are integer literals.",
          "Check each adjacent trace pair and require a terminal integer."
        ],
        "worked_example": "Every adjacent term must follow the declared reduction rule. The final term is the literal 10 and cannot reduce further.",
        "complexity": "Replay costs one reduction per arithmetic node, plus traversal to find the next reducible node.",
        "common_error": "A final number alone does not certify the declared evaluation sequence.",
        "further_work": "Introduce variables, environments, conditionals, and explicit stuck-state outcomes."
      },
      "related_ids": [
        "KL-FCS-016",
        "KL-FCS-017"
      ]
    },
    {
      "id": "KL-FCS-016",
      "version": "1.0.0",
      "domain": "Programming-language semantics",
      "kind": "semantics",
      "title": "Evaluation order in a nested product",
      "problem": "Replay left-to-right integer arithmetic with add and mul nodes.",
      "specification": {
        "term": [
          "mul",
          [
            "add",
            1,
            2
          ],
          [
            "add",
            3,
            4
          ]
        ],
        "rules": "Left non-literal operand first, then right; integer arithmetic without overflow."
      },
      "claim": {
        "normal_form": 21
      },
      "witness": {
        "trace": [
          [
            "mul",
            [
              "add",
              1,
              2
            ],
            [
              "add",
              3,
              4
            ]
          ],
          [
            "mul",
            3,
            [
              "add",
              3,
              4
            ]
          ],
          [
            "mul",
            3,
            7
          ],
          21
        ]
      },
      "verification_scope": "Exact reduction replay · 3 steps",
      "explanation": "The trace records intermediate terms, so the result’s derivation and the evaluation order are both inspectable.",
      "limitations": "This language uses mathematical integers and no side effects; machine overflow requires different semantics.",
      "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/Smallstep.html"
      ],
      "license_status": "not-yet-selected",
      "dataset": {
        "family": "semantics",
        "task": "Replay left-to-right integer arithmetic with add and mul nodes.",
        "input_encoding": "Structured JSON; field meanings are stated in the specification.",
        "coverage": "Exact reduction replay · 3 steps",
        "acceptance": [
          "Check that the trace begins with the declared syntax tree.",
          "Reduce the left non-literal operand before the right operand.",
          "Apply arithmetic only when both operands are integer literals.",
          "Check each adjacent trace pair and require a terminal integer."
        ],
        "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": "Turn an expression’s meaning into an inspectable sequence of rule applications. Evaluation order belongs to the specification.",
        "definitions": [
          {
            "term": "Term",
            "definition": "An integer literal or an add/mul syntax node."
          },
          {
            "term": "Small step",
            "definition": "One permitted local reduction, under an explicitly chosen evaluation context."
          },
          {
            "term": "Normal form",
            "definition": "A term with no further reduction; here it is an integer literal."
          }
        ],
        "reasoning": [
          "Check that the trace begins with the declared syntax tree.",
          "Reduce the left non-literal operand before the right operand.",
          "Apply arithmetic only when both operands are integer literals.",
          "Check each adjacent trace pair and require a terminal integer."
        ],
        "worked_example": "The trace records intermediate terms, so the result’s derivation and the evaluation order are both inspectable.",
        "complexity": "Replay costs one reduction per arithmetic node, plus traversal to find the next reducible node.",
        "common_error": "A final number alone does not certify the declared evaluation sequence.",
        "further_work": "Introduce variables, environments, conditionals, and explicit stuck-state outcomes."
      },
      "related_ids": [
        "KL-FCS-003",
        "KL-FCS-017"
      ]
    },
    {
      "id": "KL-FCS-017",
      "version": "1.0.0",
      "domain": "Programming-language semantics",
      "kind": "semantics",
      "title": "Signed integer reduction",
      "problem": "Replay left-to-right integer arithmetic with add and mul nodes.",
      "specification": {
        "term": [
          "add",
          [
            "mul",
            -2,
            3
          ],
          [
            "mul",
            4,
            5
          ]
        ],
        "rules": "Left non-literal operand first, then right; integer arithmetic without overflow."
      },
      "claim": {
        "normal_form": 14
      },
      "witness": {
        "trace": [
          [
            "add",
            [
              "mul",
              -2,
              3
            ],
            [
              "mul",
              4,
              5
            ]
          ],
          [
            "add",
            -6,
            [
              "mul",
              4,
              5
            ]
          ],
          [
            "add",
            -6,
            20
          ],
          14
        ]
      },
      "verification_scope": "Exact reduction replay · 3 steps",
      "explanation": "The trace records intermediate terms, so the result’s derivation and the evaluation order are both inspectable.",
      "limitations": "This language uses mathematical integers and no side effects; machine overflow requires different semantics.",
      "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/Smallstep.html"
      ],
      "license_status": "not-yet-selected",
      "dataset": {
        "family": "semantics",
        "task": "Replay left-to-right integer arithmetic with add and mul nodes.",
        "input_encoding": "Structured JSON; field meanings are stated in the specification.",
        "coverage": "Exact reduction replay · 3 steps",
        "acceptance": [
          "Check that the trace begins with the declared syntax tree.",
          "Reduce the left non-literal operand before the right operand.",
          "Apply arithmetic only when both operands are integer literals.",
          "Check each adjacent trace pair and require a terminal integer."
        ],
        "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": "Turn an expression’s meaning into an inspectable sequence of rule applications. Evaluation order belongs to the specification.",
        "definitions": [
          {
            "term": "Term",
            "definition": "An integer literal or an add/mul syntax node."
          },
          {
            "term": "Small step",
            "definition": "One permitted local reduction, under an explicitly chosen evaluation context."
          },
          {
            "term": "Normal form",
            "definition": "A term with no further reduction; here it is an integer literal."
          }
        ],
        "reasoning": [
          "Check that the trace begins with the declared syntax tree.",
          "Reduce the left non-literal operand before the right operand.",
          "Apply arithmetic only when both operands are integer literals.",
          "Check each adjacent trace pair and require a terminal integer."
        ],
        "worked_example": "The trace records intermediate terms, so the result’s derivation and the evaluation order are both inspectable.",
        "complexity": "Replay costs one reduction per arithmetic node, plus traversal to find the next reducible node.",
        "common_error": "A final number alone does not certify the declared evaluation sequence.",
        "further_work": "Introduce variables, environments, conditionals, and explicit stuck-state outcomes."
      },
      "related_ids": [
        "KL-FCS-003",
        "KL-FCS-016"
      ]
    }
  ],
  "verification": [
    {
      "id": "KL-FCS-003",
      "status": "mechanically-checked",
      "check_units": 2,
      "scope": "Exact reduction replay · 2 steps",
      "review_status": "awaiting-independent-review"
    },
    {
      "id": "KL-FCS-016",
      "status": "mechanically-checked",
      "check_units": 3,
      "scope": "Exact reduction replay · 3 steps",
      "review_status": "awaiting-independent-review"
    },
    {
      "id": "KL-FCS-017",
      "status": "mechanically-checked",
      "check_units": 3,
      "scope": "Exact reduction replay · 3 steps",
      "review_status": "awaiting-independent-review"
    }
  ]
}
