Documentation

Mathlib.Data.Sum.Basic

Additional lemmas about sum types #

Most of the former contents of this file have been moved to Std.

theorem Sum.exists_sum {α : Type u} {β : Type v} {γ : α βSort u_3} (p : ((ab : α β) → γ ab) → Prop) :
(fab, p fab) fa fb, p fun t => Sum.rec fa fb t
theorem Sum.inl_injective {α : Type u} {β : Type v} :
theorem Sum.inr_injective {α : Type u} {β : Type v} :
theorem Sum.sum_rec_congr {α : Type u} {β : Type v} (P : α βSort u_3) (f : (i : α) → P (Sum.inl i)) (g : (i : β) → P (Sum.inr i)) {x : α β} {y : α β} (h : x = y) :
Sum.rec f g x = cast (_ : P y = P x) (Sum.rec f g y)
theorem Sum.eq_left_iff_getLeft_eq {α : Type u} {β : Type v} {x : α β} {a : α} :
x = Sum.inl a h, Sum.getLeft x h = a
theorem Sum.eq_right_iff_getRight_eq {α : Type u} {β : Type v} {x : α β} {b : β} :
x = Sum.inr b h, Sum.getRight x h = b
theorem Sum.getLeft_eq_getLeft? {α : Type u} {β : Type v} {x : α β} (h₁ : Sum.isLeft x = true) (h₂ : Option.isSome (Sum.getLeft? x) = true) :
theorem Sum.getRight_eq_getRight? {α : Type u} {β : Type v} {x : α β} (h₁ : Sum.isRight x = true) (h₂ : Option.isSome (Sum.getRight? x) = true) :
@[simp]
@[simp]
theorem Sum.update_elim_inl {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq α] [DecidableEq (α β)] {f : αγ} {g : βγ} {i : α} {x : γ} :
@[simp]
theorem Sum.update_elim_inr {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq β] [DecidableEq (α β)] {f : αγ} {g : βγ} {i : β} {x : γ} :
@[simp]
theorem Sum.update_inl_comp_inl {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq α] [DecidableEq (α β)] {f : α βγ} {i : α} {x : γ} :
Function.update f (Sum.inl i) x Sum.inl = Function.update (f Sum.inl) i x
@[simp]
theorem Sum.update_inl_apply_inl {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq α] [DecidableEq (α β)] {f : α βγ} {i : α} {j : α} {x : γ} :
Function.update f (Sum.inl i) x (Sum.inl j) = Function.update (f Sum.inl) i x j
@[simp]
theorem Sum.update_inl_comp_inr {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq (α β)] {f : α βγ} {i : α} {x : γ} :
Function.update f (Sum.inl i) x Sum.inr = f Sum.inr
theorem Sum.update_inl_apply_inr {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq (α β)] {f : α βγ} {i : α} {j : β} {x : γ} :
@[simp]
theorem Sum.update_inr_comp_inl {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq (α β)] {f : α βγ} {i : β} {x : γ} :
Function.update f (Sum.inr i) x Sum.inl = f Sum.inl
theorem Sum.update_inr_apply_inl {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq (α β)] {f : α βγ} {i : α} {j : β} {x : γ} :
@[simp]
theorem Sum.update_inr_comp_inr {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq β] [DecidableEq (α β)] {f : α βγ} {i : β} {x : γ} :
Function.update f (Sum.inr i) x Sum.inr = Function.update (f Sum.inr) i x
@[simp]
theorem Sum.update_inr_apply_inr {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq β] [DecidableEq (α β)] {f : α βγ} {i : β} {j : β} {x : γ} :
Function.update f (Sum.inr i) x (Sum.inr j) = Function.update (f Sum.inr) i x j
@[simp]
theorem Sum.swap_leftInverse {α : Type u} {β : Type v} :
Function.LeftInverse Sum.swap Sum.swap
@[simp]
theorem Sum.swap_rightInverse {α : Type u} {β : Type v} :
Function.RightInverse Sum.swap Sum.swap
theorem Function.Injective.sum_elim {α : Type u} {β : Type v} {γ : Type u_1} {f : αγ} {g : βγ} (hf : Function.Injective f) (hg : Function.Injective g) (hfg : ∀ (a : α) (b : β), f a g b) :
theorem Function.Injective.sum_map {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {f : αβ} {g : α'β'} (hf : Function.Injective f) (hg : Function.Injective g) :
theorem Function.Surjective.sum_map {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {f : αβ} {g : α'β'} (hf : Function.Surjective f) (hg : Function.Surjective g) :
theorem Function.Bijective.sum_map {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {f : αβ} {g : α'β'} (hf : Function.Bijective f) (hg : Function.Bijective g) :
@[simp]
theorem Sum.map_injective {α : Type u} {β : Type v} {γ : Type u_1} {δ : Type u_2} {f : αγ} {g : βδ} :
@[simp]
theorem Sum.map_surjective {α : Type u} {β : Type v} {γ : Type u_1} {δ : Type u_2} {f : αγ} {g : βδ} :
@[simp]
theorem Sum.map_bijective {α : Type u} {β : Type v} {γ : Type u_1} {δ : Type u_2} {f : αγ} {g : βδ} :
theorem Sum.elim_update_left {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq α] [DecidableEq β] (f : αγ) (g : βγ) (i : α) (c : γ) :
theorem Sum.elim_update_right {α : Type u} {β : Type v} {γ : Type u_1} [DecidableEq α] [DecidableEq β] (f : αγ) (g : βγ) (i : β) (c : γ) :

Ternary sum #

Abbreviations for the maps from the summands to α ⊕ β ⊕ γ. This is useful for pattern-matching.

@[match_pattern, reducible]
def Sum3.in₀ {α : Type u} {β : Type v} {γ : Type u_1} (a : α) :
α β γ

The map from the first summand into a ternary sum.

Equations
Instances For
    @[match_pattern, reducible]
    def Sum3.in₁ {α : Type u} {β : Type v} {γ : Type u_1} (b : β) :
    α β γ

    The map from the second summand into a ternary sum.

    Equations
    Instances For
      @[match_pattern, reducible]
      def Sum3.in₂ {α : Type u} {β : Type v} {γ : Type u_1} (c : γ) :
      α β γ

      The map from the third summand into a ternary sum.

      Equations
      Instances For