AFTD Auto-Formalizing Theoretical Domains

extendFromC

defimported Lean

The linear map $(C \to \mathbb{F}_p) \times (C \to \mathbb{F}_p) \to V_C$ that extends a pair of functions on $C$ to a vector of $V$ by setting all coordinates outside $C$ to zero.

Statement

open scoped BigOperators in
set_option linter.mathlibStandardSet false in
open scoped BigOperators in
open scoped Real in
open scoped Nat in
open Classical in
open scoped Pointwise in
set_option maxRecDepth 4000 in
set_option synthInstance.maxHeartbeats 20000 in
set_option synthInstance.maxSize 128 in
set_option relaxedAutoImplicit false in
set_option autoImplicit false in
set_option linter.unnecessarySimpa false in
variable {n : ℕ} {p : ℕ} [Fact p.Prime] in
variable {n : ℕ} {p : ℕ} [Fact p.Prime] in
noncomputable def extendFromC (C : Finset (Fin n)) :
    (C → F p) × (C → F p) →ₗ[F p] V_sub (p:=p) C
Defined in
TCSlib, `extendFromC`
Lean proof
By Allan Li, Hydroxyi (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
none listed
Built on 2
  • V_subFor $C \subseteq \mathrm{Fin}\,n$, the support submodule $V_C = \{v \in V \mid \mathrm{supp}(v) \subseteq C\}$.
  • FThe prime field $\mathrm{GF}(p)$, realized as $\mathbb{Z}/p\mathbb{Z}$ via ZMod.
Used by 3
  • restrictToC_extendFromCRestriction inverts extension on coordinates in $C$. Fix a prime $p$, a natural number $n$, and a subset $C \subseteq \{0,1,\dots,n-1\}$…
  • extendFromC_restrictToCExtension recovers a vector supported on $C$. Fix a prime $p$ and a subset $C \subseteq \{1,\dots,n\}$ of coordinates, and let…
  • V_sub_isoV_sub_iso

Lean source view module on GitHub

open scoped BigOperators in
set_option linter.mathlibStandardSet false in
open scoped BigOperators in
open scoped Real in
open scoped Nat in
open Classical in
open scoped Pointwise in
set_option maxRecDepth 4000 in
set_option synthInstance.maxHeartbeats 20000 in
set_option synthInstance.maxSize 128 in
set_option relaxedAutoImplicit false in
set_option autoImplicit false in
set_option linter.unnecessarySimpa false in
variable {n : ℕ} {p : ℕ} [Fact p.Prime] in
variable {n : ℕ} {p : ℕ} [Fact p.Prime] in
noncomputable def extendFromC (C : Finset (Fin n)) :
    (C → F p) × (C → F p) →ₗ[F p] V_sub (p:=p) C where
  toFun := fun ⟨f, g⟩ =>
    ⟨ ((fun i => if h : i ∈ C then f ⟨i, h⟩ else 0),
       (fun i => if h : i ∈ C then g ⟨i, h⟩ else 0)),
      by
        intro j hj
        constructor <;> simp [hj] ⟩
  map_add' := by
    classical
    rintro ⟨f1, g1⟩ ⟨f2, g2⟩
    apply Subtype.ext
    ext i <;> by_cases hi : i ∈ C <;> simp [hi]
  map_smul' := by
    classical
    intro r x
    rcases x with ⟨f, g⟩
    apply Subtype.ext
    ext i <;> by_cases hi : i ∈ C <;> simp [hi]
See it in the graphDiscuss this resultChallenge it