AFTD Auto-Formalizing Theoretical Domains

simple_graph_um_selector_extension

def

Given a type V, a subset S : Set V, natural numbers p and q, a function φ : S → Fin p, a function ψ : Sᶜ → Fin q, and an element v : V, simple_graph_um_selector_extension S φ ψ v is the element of Fin (q + p) defined by Fin.natAdd q (φ ⟨v, h⟩) if v ∈ S, and Fin.castAdd p (ψ ⟨v, h⟩) if v ∉ S.

Statement

noncomputable def simple_graph_um_selector_extension {V : Type*} (S : Set V) {p q : ℕ}
    (φ : ↥S → Fin p) (ψ : ↥(Sᶜ) → Fin q) (v : V) : Fin (q + p)
Defined in
arXiv:2611.23478, Lemma 5
Verified
19 Nov 2026
Axioms
none listed
Used by 1

Read back from the Lean

A definition simple_graph_um_selector_extension: given a type V, a subset S : Set V, natural numbers p, q : ℕ, a map φ : S → Fin p, a map ψ : Sᶜ → Fin q, and an element v : V, it returns an element of Fin (q + p) defined by cases: - if v ∈ S (with proof h), it returns Fin.natAdd q (φ ⟨v, h⟩) (which has value q + φ(⟨v, h⟩).val); - if v ∉ S (with proof h), it returns Fin.castAdd p (ψ ⟨v, h⟩) (which has value ψ(⟨v, h⟩).val).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- Extension of a colouring ψ of Sᶜ by a selector colouring φ on S into a colouring of V using q + p colours. -/
noncomputable def simple_graph_um_selector_extension {V : Type*} (S : Set V) {p q : ℕ}
    (φ : ↥S → Fin p) (ψ : ↥(Sᶜ) → Fin q) (v : V) : Fin (q + p) := by
  classical
  exact if h : v ∈ S then
    Fin.natAdd q (φ ⟨v, h⟩)
  else
    Fin.castAdd p (ψ ⟨v, h⟩)
See it in the graphDiscuss this resultChallenge it