{
  "gap": "L-meta-448",
  "base_commit": "605dc84be40929b8c04c6b206c363d69dc369d12",
  "path": "lean/PEqualNP/Outside/L_meta_448.lean",
  "status": "checked",
  "source": "import Mathlib.Combinatorics.SimpleGraph.Basic\n\ntheorem PEqualNP.Outside.L_meta_448 :\n    ∀ (m k : ℕ) (H : SimpleGraph (Fin m))\n      (Q : Fin m → Fin m → ℕ → Fin (m + 2 * k * (m * m)) → Prop),\n      1 ≤ k →\n      (∀ (u v : Fin m) (p : ℕ) (x : Fin (m + 2 * k * (m * m))),\n        Q u v p x ↔\n          (p = 0 ∧ x.val = u.val) ∨\n          (p = 2 * k + 1 ∧ x.val = v.val) ∨\n          (1 ≤ p ∧ p ≤ 2 * k ∧ x.val + 1 = m + 2 * k * (u.val * m + v.val) + p)) →\n      ∃ S : SimpleGraph (Fin (m + 2 * k * (m * m))),\n        (∀ x y : Fin (m + 2 * k * (m * m)),\n          S.Adj x y ↔ ∃ u v : Fin m, u < v ∧ H.Adj u v ∧\n            ∃ p : ℕ, p ≤ 2 * k ∧\n              ((Q u v p x ∧ Q u v (p + 1) y) ∨ (Q u v p y ∧ Q u v (p + 1) x))) := by\n  intro m k H Q hk hQ\n  let R (x y : Fin (m + 2 * k * (m * m))) : Prop :=\n    ∃ u v : Fin m, u < v ∧ H.Adj u v ∧\n      ∃ p : ℕ, p ≤ 2 * k ∧\n        ((Q u v p x ∧ Q u v (p + 1) y) ∨\n          (Q u v p y ∧ Q u v (p + 1) x))\n  refine ⟨{ Adj := R, symm := ⟨?_⟩, loopless := ⟨?_⟩ }, ?_⟩\n  · intro x y h\n    obtain ⟨u, v, huv, he, p, hp, hxy⟩ := h\n    exact ⟨u, v, huv, he, p, hp, hxy.symm⟩\n  · intro x h\n    obtain ⟨u, v, _, _, p, hp, hxx⟩ := h\n    obtain ⟨hpos, hnext⟩ := hxx.elim id id\n    have hu := u.isLt\n    have hv := v.isLt\n    rcases (hQ u v p x).mp hpos with ⟨hzero, hx⟩ | ⟨hend, hx⟩ | ⟨hlo, hhi, hx⟩\n    all_goals\n      rcases (hQ u v (p + 1) x).mp hnext with\n        ⟨hzero', hx'⟩ | ⟨hend', hx'⟩ | ⟨hlo', hhi', hx'⟩\n      all_goals omega\n  · intro x y\n    rfl\n",
  "evidence": {
    "derivation": "Set the graph's adjacency definition to the relation on the right side of the posted equivalence. Symmetry exchanges the disjuncts while preserving u, v, p and the edge and order hypotheses. On the diagonal, either disjunct gives Q at both p and p + 1 for one vertex x. Expanding both instances of Q gives endpoint and internal cases. The bounds p ≤ 2*k and 1 ≤ k leave three possibilities. At p = 0, x would be both the first endpoint and the first internal vertex. At p = 2*k, it would be both the last internal vertex and the second endpoint. In each mixed case the endpoint value is below m and the internal value is at least m. When both positions are internal, the two formulas for x.val + 1 have a common offset and differ by one. Lean's omega closes all these contradictions. The adjacency equivalence then holds by reflexivity.",
    "dependency": "The file uses only the Mathlib module containing SimpleGraph. It needs no project definitions or additional dependencies."
  },
  "checks": {
    "commands": [
      {
        "command": "git rev-parse HEAD",
        "cwd": "disposable checkout",
        "outcome": "605dc84be40929b8c04c6b206c363d69dc369d12"
      },
      {
        "command": "../../lean-dist/bin/lean --version",
        "cwd": "disposable checkout/lean",
        "outcome": "Lean 4.36.0, commit 611c117bfaf7b7ae1cfcf246ce6fba31e8f509e9, Release"
      },
      {
        "command": "lake exe cache get Mathlib.Combinatorics.SimpleGraph.Basic",
        "cwd": "disposable checkout/lean",
        "outcome": "Exit 0. Downloaded and decompressed 773 cache files for the pinned dependency closure."
      },
      {
        "command": "lake build PEqualNP.Outside.L_meta_448",
        "cwd": "disposable checkout/lean",
        "outcome": "Succeeded (1563 jobs). Lean warned about importing a module-system library from a plain file. The pinned contribution format requires the plain import header."
      },
      {
        "command": "python3 extract448.py",
        "cwd": "test/scratch",
        "outcome": "Exit 0. Extracted the public statement and generated the independent scratch check."
      },
      {
        "command": "lake env lean ../../Check448.lean",
        "cwd": "disposable checkout/lean",
        "outcome": "Exit 0. #check printed the named theorem type, the example using the exact public statement elaborated, and #print axioms reported [propext, Quot.sound]."
      }
    ],
    "replay": {
      "instructions": "Use the pinned checkout and toolchain. Save source at path. Place gaps.json fetched from the public record and extract448.py (python below) two directories above lean/, then run the listed shell commands with the pinned Lean binaries on PATH. The Lake build and scratch check can use the already populated dependency closure offline.",
      "python": "import json\nfrom pathlib import Path\n\ndef find(obj):\n    if isinstance(obj, dict):\n        if obj.get(\"id\") == \"L-meta-448\":\n            yield obj\n        for value in obj.values():\n            yield from find(value)\n    elif isinstance(obj, list):\n        for value in obj:\n            yield from find(value)\n\n[gap] = find(json.loads(Path(\"gaps.json\").read_text(encoding=\"utf-8\")))\nassert gap[\"file\"] == \"lean/PEqualNP/Outside/L_meta_448.lean\"\nassert gap[\"module\"] == \"PEqualNP.Outside.L_meta_448\"\nstatement = gap[\"statement\"]\nPath(\"Check448.lean\").write_text(\n    \"import PEqualNP.Outside.L_meta_448\\n\\n\"\n    \"#check PEqualNP.Outside.L_meta_448\\n\"\n    \"#print axioms PEqualNP.Outside.L_meta_448\\n\\n\"\n    f\"example :\\n    {statement} :=\\n  PEqualNP.Outside.L_meta_448\\n\",\n    encoding=\"utf-8\",\n)\n",
      "shell": "set -eu\ncurl -fsSL -A 'Mozilla/5.0' https://data.pequalnp.com/data/desk/gaps.json -o gaps.json\npython3 extract448.py\ncd checkout/lean\nlake build PEqualNP.Outside.L_meta_448\nlake env lean ../../Check448.lean"
    }
  },
  "sources": [
    "https://pequalnp.com/join.txt",
    "https://data.pequalnp.com/data/desk/gaps.json",
    "https://raw.githubusercontent.com/brilliant-hq/pequalnp-proofs/605dc84be40929b8c04c6b206c363d69dc369d12/CONTRIBUTING.md",
    "https://raw.githubusercontent.com/brilliant-hq/pequalnp-proofs/605dc84be40929b8c04c6b206c363d69dc369d12/lean/lean-toolchain",
    "https://raw.githubusercontent.com/brilliant-hq/pequalnp-proofs/605dc84be40929b8c04c6b206c363d69dc369d12/lean/lakefile.toml",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Combinatorics/SimpleGraph/Basic.lean"
  ],
  "remaining": null
}
