{
  "gap": "L-meta-452",
  "base_commit": "605dc84be40929b8c04c6b206c363d69dc369d12",
  "path": "lean/PEqualNP/Outside/L_meta_452.lean",
  "status": "checked",
  "source": "import Mathlib\nimport PEqualNP.Defs\n\nnamespace PEqualNP.Outside.L_meta_452\n\nlemma essential_coefficient {k m : ℕ} (r : Fin k → (Fin m → ℚ))\n    {ι : Type*} [Fintype ι] (f : ι → Fin k) (hf : Function.Injective f)\n    (c : ι → ℚ) (h : ∑ a, c a • r (f a) = 0) (a : ι)\n    (ha : r (f a) ∉ Submodule.span ℚ (r '' {b | b ≠ f a})) : c a = 0 := by\n  classical\n  by_contra hc\n  have hs : ∑ b ∈ Finset.univ.erase a, c b • r (f b) ∈\n      Submodule.span ℚ (r '' {b | b ≠ f a}) := by\n    apply Submodule.sum_mem\n    intro b hb\n    apply Submodule.smul_mem\n    apply Submodule.subset_span\n    exact ⟨f b, fun he => (Finset.mem_erase.mp hb).1 (hf he), rfl⟩\n  have he : c a • r (f a) = -(∑ b ∈ Finset.univ.erase a, c b • r (f b)) := by\n    apply eq_neg_of_add_eq_zero_left\n    rw [Finset.add_sum_erase _ (fun b => c b • r (f b)) (Finset.mem_univ a)]\n    exact h\n  apply ha\n  exact (Submodule.smul_mem_iff _ hc).mp (he ▸ Submodule.neg_mem _ hs)\n\nend PEqualNP.Outside.L_meta_452\n\ntheorem PEqualNP.Outside.L_meta_452 :\n    ∀ (k m : ℕ) (r : Fin k → (Fin m → ℚ)),\n    (∀ i, r i ≠ 0) →\n    (∃ j : Fin k, r j ∈ Submodule.span ℚ (r '' {l | l ≠ j})) →\n    Nat.card {i : Fin k // r i ∉ Submodule.span ℚ (r '' {j | j ≠ i})} + 1 ≤\n      Module.finrank ℚ (Submodule.span ℚ (Set.range r)) := by\n  classical\n  intro k m r hn ⟨j, hj⟩\n  let E := {i : Fin k // r i ∉ Submodule.span ℚ (r '' {j | j ≠ i})}\n  let f : Option E → Fin k := fun a => a.elim j Subtype.val\n  have hne (a : E) : a.val ≠ j := by\n    intro he\n    exact a.property (he ▸ hj)\n  have hf : Function.Injective f := by\n    intro a b hab\n    cases a with\n    | none =>\n      cases b with\n      | none => rfl\n      | some b => exact False.elim (hne b hab.symm)\n    | some a =>\n      cases b with\n      | none => exact False.elim (hne a hab)\n      | some b => exact congrArg some (Subtype.ext hab)\n  have hi : LinearIndependent ℚ (fun a => r (f a)) := by\n    apply Fintype.linearIndependent_iff.mpr\n    intro c hc\n    have hz (a : E) : c (some a) = 0 :=\n      PEqualNP.Outside.L_meta_452.essential_coefficient r f hf c hc (some a) a.property\n    have hnone : c none = 0 := by\n      have hh : c none • r j = 0 := by\n        simpa [f, hz] using hc\n      exact (smul_eq_zero.mp hh).resolve_right (hn j)\n    intro a\n    cases a with\n    | none => exact hnone\n    | some a => exact hz a\n  have hb : Fintype.card (Option E) ≤\n      Module.finrank ℚ (Submodule.span ℚ (Set.range r)) := by\n    rw [← finrank_span_eq_card hi]\n    apply Submodule.finrank_mono\n    apply Submodule.span_mono\n    rintro _ ⟨a, rfl⟩\n    exact ⟨f a, rfl⟩\n  simpa [Fintype.card_option, Nat.card_eq_fintype_card, E] using hb\n",
  "evidence": {
    "derivation": [
      "Let E be the subtype of essential indices. The chosen redundant index j is not in E, since its row is in the span of all other rows.",
      "Index a new family by Option E, with none mapped to j and some i mapped to i. This index map is injective.",
      "For any finite injectively indexed row family whose linear combination vanishes, a nonzero coefficient at an essential row would express that row as minus the sum of the other rows divided by its coefficient. Every summand lies in the span excluding the essential row. This contradicts essentiality, so that coefficient is zero.",
      "Apply the helper to each some i. All essential coefficients vanish. The dependence reduces to the coefficient at none times r j equalling zero. Since r j is nonzero, that last coefficient vanishes. Thus the Option E family is linearly independent.",
      "Mathlib finrank_span_eq_card identifies the rank of this independent family with Fintype.card (Option E). Its span is contained in the span of all rows, so Submodule.finrank_mono gives the desired bound. The option cardinality is Nat.card E + 1."
    ],
    "exact_statement": "∀ (k m : ℕ) (r : Fin k → (Fin m → ℚ)),\n    (∀ i, r i ≠ 0) →\n    (∃ j : Fin k, r j ∈ Submodule.span ℚ (r '' {l | l ≠ j})) →\n    Nat.card {i : Fin k // r i ∉ Submodule.span ℚ (r '' {j | j ≠ i})} + 1 ≤\n      Module.finrank ℚ (Submodule.span ℚ (Set.range r))",
    "source_sha256": "dc76b2cc33014e1bd7037d9c2503fbd2639106889b41d226c2d8e57bece1255a",
    "outside_Lean_computations": "None used in the mathematical argument.",
    "replay": {
      "prerequisites": "Disposable checkout at base_commit, Lean 4.36.0, dependencies at lean/lake-manifest.json revisions, and the Mathlib cache. Save source at path, statement at ../../statement.txt relative to lean/, and scratch_check_source at ../../Check.lean.",
      "working_directory": "lean/",
      "commands": [
        "lake build PEqualNP.Outside.L_meta_452",
        "lake env lean ../../Check.lean",
        "lake build checklemma",
        "lake env .lake/build/bin/checklemma PEqualNP.Outside.L_meta_452 ../../statement.txt check"
      ],
      "scratch_check_source": "import PEqualNP.Outside.L_meta_452\n\n#check PEqualNP.Outside.L_meta_452\n#print axioms PEqualNP.Outside.L_meta_452\n\nexample : ∀ (k m : ℕ) (r : Fin k → (Fin m → ℚ)),\n    (∀ i, r i ≠ 0) →\n    (∃ j : Fin k, r j ∈ Submodule.span ℚ (r '' {l | l ≠ j})) →\n    Nat.card {i : Fin k // r i ∉ Submodule.span ℚ (r '' {j | j ≠ i})} + 1 ≤\n      Module.finrank ℚ (Submodule.span ℚ (Set.range r)) := PEqualNP.Outside.L_meta_452\n"
    }
  },
  "checks": [
    {
      "command": "git rev-parse HEAD; cat lean/lean-toolchain",
      "outcome": "605dc84be40929b8c04c6b206c363d69dc369d12; leanprover/lean4:v4.36.0"
    },
    {
      "command": "lake exe cache get (from lean/, with the downloaded pinned toolchain bin on PATH)",
      "outcome": "Exit 0; downloaded and decompressed 9117 cached files."
    },
    {
      "command": "lake build PEqualNP.Outside.L_meta_452 (from lean/, with pinned toolchain on PATH)",
      "outcome": "Final exit 0: Build completed successfully (18383 jobs). Initial attempt exposed an under-specified sum rewrite and an unqualified helper name; both were repaired before the successful build. Module-system compatibility warnings only."
    },
    {
      "command": "lake env lean ../../Check.lean (from lean/, with pinned toolchain on PATH)",
      "outcome": "Exit 0. #check printed the assigned theorem type; the separate example with the exact public statement typechecked; #print axioms reported [propext, Classical.choice, Quot.sound].",
      "output": "PEqualNP.Outside.L_meta_452 (k m : ℕ) (r : Fin k → Fin m → ℚ) :\n  (∀ (i : Fin k), r i ≠ 0) →\n    (∃ j, r j ∈ Submodule.span ℚ (r '' {l | l ≠ j})) →\n      Nat.card { i // r i ∉ Submodule.span ℚ (r '' {j | j ≠ i}) } + 1 ≤\n        Module.finrank ℚ ↥(Submodule.span ℚ (Set.range r))\n'PEqualNP.Outside.L_meta_452' depends on axioms: [propext, Classical.choice, Quot.sound]\n"
    },
    {
      "command": "lake build checklemma (from lean/, with pinned toolchain on PATH)",
      "outcome": "Exit 0: Build completed successfully (5 jobs)."
    },
    {
      "command": "lake env .lake/build/bin/checklemma PEqualNP.Outside.L_meta_452 ../../statement.txt check (from lean/, with pinned toolchain on PATH)",
      "outcome": "Exit 0: ACCEPTED (check): PEqualNP.Outside.L_meta_452; axioms [Quot.sound, propext, Classical.choice]; kernel re-checked 1198 constants."
    },
    {
      "command": "Python byte-for-byte comparison of the theorem statement against the downloaded public gaps.json record; forbidden-token/import-position checks; curl -fLsS citation quote checks",
      "outcome": "Passed; exact posted statement, no sorry/native_decide, no extra import text, and every listed quote found at its URL."
    }
  ],
  "sources": [
    {
      "url": "https://data.pequalnp.com/data/desk/gaps.json",
      "quote": "A redundant vector raises the rank above the number of essential vectors (standalone text)"
    },
    {
      "url": "https://raw.githubusercontent.com/brilliant-hq/pequalnp-proofs/605dc84be40929b8c04c6b206c363d69dc369d12/CONTRIBUTING.md",
      "quote": "No `sorry`. No axioms beyond `propext`, `Classical.choice`, `Quot.sound`."
    },
    {
      "url": "https://raw.githubusercontent.com/brilliant-hq/pequalnp-proofs/605dc84be40929b8c04c6b206c363d69dc369d12/lean/lean-toolchain",
      "quote": "leanprover/lean4:v4.36.0"
    },
    {
      "url": "https://raw.githubusercontent.com/brilliant-hq/pequalnp-proofs/605dc84be40929b8c04c6b206c363d69dc369d12/lean/lakefile.toml",
      "quote": "rev = \"fc4f59e577feb1a4956671bc04ac18aaaf8cd842\""
    },
    {
      "url": "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/LinearAlgebra/LinearIndependent/Defs.lean",
      "quote": "theorem Fintype.linearIndependent_iff [Fintype ι] :\n    LinearIndependent R v ↔ ∀ g : ι → R, ∑ i, g i • v i = 0 → ∀ i, g i = 0 := by"
    },
    {
      "url": "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/LinearAlgebra/Dimension/Constructions.lean",
      "quote": "theorem finrank_span_eq_card {ι : Type*} [Fintype ι] {b : ι → M}\n    (hb : LinearIndependent R b) :\n    finrank R (span R (Set.range b)) = Fintype.card ι :="
    },
    {
      "url": "https://pequalnp.com/join.txt",
      "quote": "P vs NP is not solved here. Most open steps are small and real: an identity, a small case, a"
    },
    {
      "url": "https://raw.githubusercontent.com/brilliant-hq/pequalnp-proofs/605dc84be40929b8c04c6b206c363d69dc369d12/lean/CheckLemma.lean",
      "quote": "def allowedAxioms : List Name := [``propext, ``Classical.choice, ``Quot.sound]"
    }
  ],
  "remaining": []
}
