The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Control.Functor.Multivariate

26 declarations. Mathlib docs · Source

theorem TypeVec.append1.match_1.congr_eq_1 E1 #

∀ {n : ℕ} (motive : Fin2 (n + 1) → Sort u_1) (x : Fin2 (n + 1)) (h_1 : (i : Fin2 n) → motive i.fs)
  (h_2 : Unit → motive Fin2.fz) (i : Fin2 n),
  x = i.fs →
    (match x with
      | i.fs => h_1 i
      | Fin2.fz => h_2 ()) ≍
      h_1 i

theorem TypeVec.append1.match_1.congr_eq_2 E1 #

∀ {n : ℕ} (motive : Fin2 (n + 1) → Sort u_1) (x : Fin2 (n + 1)) (h_1 : (i : Fin2 n) → motive i.fs)
  (h_2 : Unit → motive Fin2.fz),
  x = Fin2.fz →
    (match x with
      | i.fs => h_1 i
      | Fin2.fz => h_2 ()) ≍
      h_2 ()

def MvFunctor.ctorIdx E1 #

{n : ℕ} → {F : TypeVec.{u_2} n → Type u_1} → MvFunctor F → ℕ

class MvFunctor E1 #

{n : ℕ} → (TypeVec.{u_2} n → Type u_1) → Type (max u_1 (u_2 + 1))

Multivariate functors, i.e. functor between the category of type vectors and the category of Type

ctor MvFunctor.mk E0 #

{n : ℕ} → {F : TypeVec.{u_2} n → Type u_1} → ({α β : TypeVec.{u_2} n} → α.Arrow β → F α → F β) → MvFunctor F

abbrev MvFunctor.map E1 #

{n : ℕ} → {F : TypeVec.{u_2} n → Type u_1} → [self : MvFunctor F] → {α β : TypeVec.{u_2} n} → α.Arrow β → F α → F β

Multivariate map, if f : α ⟹ β and x : F α then f <$$> x : F β.

def MvFunctor.«term_<$$>_» E1 #

Lean.TrailingParserDescr

Multivariate map, if f : α ⟹ β and x : F α then f <$$> x : F β

def MvFunctor.LiftP E1 #

{n : ℕ} → {F : TypeVec.{u} n → Type v} → [MvFunctor F] → {α : TypeVec.{u} n} → ((i : Fin2 n) → α i → Prop) → F α → Prop

predicate lifting over multivariate functors

def MvFunctor.LiftR E1 #

{n : ℕ} →
  {F : TypeVec.{u} n → Type v} →
    [MvFunctor F] → {α : TypeVec.{u} n} → (⦃i : Fin2 n⦄ → α i → α i → Prop) → F α → F α → Prop

relational lifting over multivariate functors

def MvFunctor.supp E1 #

{n : ℕ} → {F : TypeVec.{u} n → Type v} → [MvFunctor F] → {α : TypeVec.{u} n} → F α → (i : Fin2 n) → Set (α i)

given x : F α and a projection i of type vector α, supp x i is the set of α.i contained in x

theorem MvFunctor.of_mem_supp E1 #

∀ {n : ℕ} {F : TypeVec.{u} n → Type v} [inst : MvFunctor F] {α : TypeVec.{u} n} {x : F α}
  {P : ⦃i : Fin2 n⦄ → α i → Prop}, MvFunctor.LiftP P x → ∀ (i : Fin2 n), ∀ y ∈ MvFunctor.supp x i, P y

class LawfulMvFunctor E1 #

{n : ℕ} → (F : TypeVec.{u_2} n → Type u_1) → [MvFunctor F] → Prop

laws for MvFunctor

ctor LawfulMvFunctor.mk E0 #

∀ {n : ℕ} {F : TypeVec.{u_2} n → Type u_1} [inst : MvFunctor F],
  (∀ {α : TypeVec.{u_2} n} (x : F α), MvFunctor.map TypeVec.id x = x) →
    (∀ {α β γ : TypeVec.{u_2} n} (g : α.Arrow β) (h : β.Arrow γ) (x : F α),
        MvFunctor.map (TypeVec.comp h g) x = MvFunctor.map h (MvFunctor.map g x)) →
      LawfulMvFunctor F

theorem LawfulMvFunctor.id_map E1 #

∀ {n : ℕ} {F : TypeVec.{u_2} n → Type u_1} {inst : MvFunctor F} [self : LawfulMvFunctor F] {α : TypeVec.{u_2} n}
  (x : F α), MvFunctor.map TypeVec.id x = x

map preserved identities, i.e., maps identity on α to identity on F α

theorem LawfulMvFunctor.comp_map E1 #

∀ {n : ℕ} {F : TypeVec.{u_2} n → Type u_1} {inst : MvFunctor F} [self : LawfulMvFunctor F] {α β γ : TypeVec.{u_2} n}
  (g : α.Arrow β) (h : β.Arrow γ) (x : F α), MvFunctor.map (TypeVec.comp h g) x = MvFunctor.map h (MvFunctor.map g x)

map preserves compositions

def MvFunctor.LiftP' E1 #

{n : ℕ} →
  {α : TypeVec.{u} n} → {F : TypeVec.{u} n → Type v} → [MvFunctor F] → α.Arrow (TypeVec.repeat n Prop) → F α → Prop

adapt MvFunctor.LiftP to accept predicates as arrows

def MvFunctor.LiftR' E1 #

{n : ℕ} →
  {α : TypeVec.{u} n} →
    {F : TypeVec.{u} n → Type v} → [MvFunctor F] → (α.prod α).Arrow (TypeVec.repeat n Prop) → F α → F α → Prop

adapt MvFunctor.LiftR to accept relations as arrows

theorem MvFunctor.id_map E0 #

∀ {n : ℕ} {α : TypeVec.{u} n} {F : TypeVec.{u} n → Type v} [inst : MvFunctor F] [LawfulMvFunctor F] (x : F α),
  MvFunctor.map TypeVec.id x = x

theorem MvFunctor.id_map' E0 #

∀ {n : ℕ} {α : TypeVec.{u} n} {F : TypeVec.{u} n → Type v} [inst : MvFunctor F] [LawfulMvFunctor F] (x : F α),
  MvFunctor.map (fun _i a ↦ a) x = x

theorem MvFunctor.map_map E0 #

∀ {n : ℕ} {α β γ : TypeVec.{u} n} {F : TypeVec.{u} n → Type v} [inst : MvFunctor F] [LawfulMvFunctor F] (g : α.Arrow β)
  (h : β.Arrow γ) (x : F α), MvFunctor.map h (MvFunctor.map g x) = MvFunctor.map (TypeVec.comp h g) x

theorem MvFunctor.exists_iff_exists_of_mono E1 #

∀ {n : ℕ} {α β : TypeVec.{u} n} (F : TypeVec.{u} n → Type v) [inst : MvFunctor F] [LawfulMvFunctor F] {P : F α → Prop}
  {q : F β → Prop} (f : α.Arrow β) (g : β.Arrow α),
  TypeVec.comp f g = TypeVec.id → (∀ (u : F α), P u ↔ q (MvFunctor.map f u)) → ((∃ u, P u) ↔ ∃ u, q u)

theorem MvFunctor.LiftP_def E0 #

∀ {n : ℕ} {α : TypeVec.{u} n} {F : TypeVec.{u} n → Type v} [inst : MvFunctor F] (P : α.Arrow (TypeVec.repeat n Prop))
  [LawfulMvFunctor F] (x : F α), MvFunctor.LiftP' P x ↔ ∃ u, MvFunctor.map (TypeVec.subtypeVal P) u = x

theorem MvFunctor.LiftR_def E0 #

∀ {n : ℕ} {α : TypeVec.{u} n} {F : TypeVec.{u} n → Type v} [inst : MvFunctor F]
  (R : (α.prod α).Arrow (TypeVec.repeat n Prop)) [LawfulMvFunctor F] (x y : F α),
  MvFunctor.LiftR' R x y ↔
    ∃ u,
      MvFunctor.map (TypeVec.comp TypeVec.prod.fst (TypeVec.subtypeVal R)) u = x ∧
        MvFunctor.map (TypeVec.comp TypeVec.prod.snd (TypeVec.subtypeVal R)) u = y

theorem MvFunctor.LiftP_PredLast_iff E0 #

∀ {n : ℕ} {F : TypeVec.{u} (n + 1) → Type u_1} [inst : MvFunctor F] [LawfulMvFunctor F] {α : TypeVec.{u} n} {β : Type u}
  (P : β → Prop) (x : F (α ::: β)), MvFunctor.LiftP' (α.PredLast' P) x ↔ MvFunctor.LiftP (α.PredLast P) x

theorem MvFunctor.LiftR_RelLast_iff E0 #

∀ {n : ℕ} {F : TypeVec.{u} (n + 1) → Type u_1} [inst : MvFunctor F] [LawfulMvFunctor F] {α : TypeVec.{u} n} {β : Type u}
  (rr : β → β → Prop) (x y : F (α ::: β)), MvFunctor.LiftR' (α.RelLast' rr) x y ↔ MvFunctor.LiftR (α.RelLast rr) x y

def MvFunctor.ofEquiv E1 #

{n : ℕ} →
  {F : TypeVec.{u} n → Type u_1} →
    {F' : TypeVec.{u} n → Type u_2} → [MvFunctor F'] → ((α : TypeVec.{u} n) → F α ≃ F' α) → MvFunctor F

Any type function that is (extensionally) equivalent to a functor, is itself a functor