Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/Mathlib/LinearAlgebra/Matrix/     Datei vom 15.10.2026 mit Größe 3 kB image not shown  

Quelle  Quotient.lean   Sprache: Lean

 

/-
Copyright (c) 2022 Yuyang Zhao. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yuyang Zhao
-/

module

public import Mathlib.Data.Finsupp.Defs
public import Mathlib.Data.Set.Finite.Lattice

set_option doc.verso true
set_option doc.verso.suggestions false

/-!
# Lifts a `Finsupp` from an underlying type to a `Finsupp` on a quotient
-/


@[expose] public section

noncomputable section

open Finset Function

variable {α β : Type*}

namespace Quot

variable {r : α → α → Prop} [Zero β] (f : α →₀ β) (h : ∀ a b, r a b → f a = f b)

/-- Lift a function `α →₀ β` to `Quot r →₀ β`. -/
protected def liftFinsupp : Quot r →₀ β := by
  classical
  refine ⟨image (mk r) f.support, Quot.lift f h, fun a => ⟨?_, ?_⟩⟩
  · rw [mem_image]; rintro ⟨b, hb, rfl⟩; exact Finsupp.mem_support_iff.mp hb
  · induction a using Quot.ind
    rw [lift_mk _ h]
    exact fun hb => mem_image_of_mem _ (Finsupp.mem_support_iff.mpr hb)

@[simp]
theorem liftFinsupp_mk (a : α) : Quot.liftFinsupp f h (Quot.mk r a) = f a :=
  rfl

end Quot

namespace Quotient

variable {s : Setoid α} [Zero β] (f : α →₀ β) (h : ∀ a b, s a b → f a = f b)

/-- Lift a function `α →₀ β` to `Quot r →₀ β`. -/
protected def liftFinsupp : Quotient s →₀ β :=
  Quot.liftFinsupp f h

@[simp]
theorem liftFinsupp_mk (a : α) : Quotient.liftFinsupp f h ⟦a⟧ = f a :=
  rfl

end Quotient

namespace Setoid

variable (s : Setoid α) [Zero β]

/-- Finitely supported functions on `α` that are constant on the classes of `s` correspond to
finitely supported functions on `Quotient s`, provided the classes are finite. -/

def liftFinsuppEquiv (hs : ∀ a, {b | s b a}.Finite) :
    {f : α →₀ β // ∀ a b, s a b → f a = f b} ≃ (Quotient s →₀ β) where
  toFun f := Quotient.liftFinsupp f.1 f.2
  invFun f := ⟨Finsupp.ofSupportFinite (f ∘ Quotient.mk s) <| by
    rw [Function.support_comp_eq_preimage]
    refine f.hasFiniteSupport.preimage' fun q _ ↦ ?_
    induction q using Quotient.inductionOn with | h a => ?_
    convert hs a using 1
    ext b
    simp [Quotient.eq], fun a b h ↦ by simp [Quotient.sound h]⟩
  left_inv _ := Subtype.ext <| Finsupp.ext fun _ ↦ rfl
  right_inv f := Finsupp.ext fun q ↦ Quotient.inductionOn q fun _ ↦ rfl

variable {s}

@[simp]
theorem liftFinsuppEquiv_apply_mk (hs : ∀ a, {b | s b a}.Finite)
    (f : {f : α →₀ β // ∀ a b, s a b → f a = f b}) (a : α) :
    liftFinsuppEquiv s hs f ⟦a⟧ = f.1 a :=
  rfl

@[simp]
theorem liftFinsuppEquiv_symm_apply (hs : ∀ a, {b | s b a}.Finite) (f : Quotient s →₀ β) (a : α) :
    ((liftFinsuppEquiv s hs).symm f).val a = f ⟦a⟧ :=
  rfl

end Setoid

Messung
CHZG
9210010097

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*Bot Zugriff