Documentation

Init.Data.Sum.Lemmas

Disjoint union of types #

Theorems about the definitions introduced in Init.Data.Sum.Basic.

theorem Sum.forall {α : Type u_1} {β : Type u_2} {p : α βProp} :
(∀ (x : α β), p x) (∀ (a : α), p (Sum.inl a)) ∀ (b : β), p (Sum.inr b)
theorem Sum.exists {α : Type u_1} {β : Type u_2} {p : α βProp} :
(∃ (x : α β), p x) (∃ (a : α), p (Sum.inl a)) ∃ (b : β), p (Sum.inr b)
theorem Sum.forall_sum {α : Type u_1} {β : Type u_2} {γ : α βSort u_3} (p : ((ab : α β) → γ ab)Prop) :
(∀ (fab : (ab : α β) → γ ab), p fab) ∀ (fa : (val : α) → γ (Sum.inl val)) (fb : (val : β) → γ (Sum.inr val)), p fun (t : α β) => Sum.rec fa fb t
@[simp]
theorem Sum.inl_getLeft {α : Type u_1} {β : Type u_2} (x : α β) (h : x.isLeft = true) :
Sum.inl (x.getLeft h) = x
@[simp]
theorem Sum.inr_getRight {α : Type u_1} {β : Type u_2} (x : α β) (h : x.isRight = true) :
Sum.inr (x.getRight h) = x
@[simp]
theorem Sum.getLeft?_eq_none_iff {α : Type u_1} {β : Type u_2} {x : α β} :
x.getLeft? = none x.isRight = true
@[simp]
theorem Sum.getRight?_eq_none_iff {α : Type u_1} {β : Type u_2} {x : α β} :
x.getRight? = none x.isLeft = true
theorem Sum.eq_left_getLeft_of_isLeft {α : Type u_1} {β : Type u_2} {x : α β} (h : x.isLeft = true) :
x = Sum.inl (x.getLeft h)
@[simp]
theorem Sum.getLeft_eq_iff {α✝ : Type u_1} {a : α✝} {β✝ : Type u_2} {x : α✝ β✝} (h : x.isLeft = true) :
x.getLeft h = a x = Sum.inl a
theorem Sum.eq_right_getRight_of_isRight {α : Type u_1} {β : Type u_2} {x : α β} (h : x.isRight = true) :
x = Sum.inr (x.getRight h)
@[simp]
theorem Sum.getRight_eq_iff {β✝ : Type u_1} {b : β✝} {α✝ : Type u_2} {x : α✝ β✝} (h : x.isRight = true) :
x.getRight h = b x = Sum.inr b
@[simp]
theorem Sum.getLeft?_eq_some_iff {α✝ : Type u_1} {a : α✝} {β✝ : Type u_2} {x : α✝ β✝} :
x.getLeft? = some a x = Sum.inl a
@[simp]
theorem Sum.getRight?_eq_some_iff {β✝ : Type u_1} {b : β✝} {α✝ : Type u_2} {x : α✝ β✝} :
x.getRight? = some b x = Sum.inr b
@[simp]
theorem Sum.bnot_isLeft {α : Type u_1} {β : Type u_2} (x : α β) :
(!decide (x.isLeft = x.isRight)) = true
@[simp]
theorem Sum.isLeft_eq_false {α : Type u_1} {β : Type u_2} {x : α β} :
x.isLeft = false x.isRight = true
theorem Sum.not_isLeft {α : Type u_1} {β : Type u_2} {x : α β} :
¬x.isLeft = true x.isRight = true
@[simp]
theorem Sum.bnot_isRight {α : Type u_1} {β : Type u_2} (x : α β) :
(!decide (x.isRight = x.isLeft)) = true
@[simp]
theorem Sum.isRight_eq_false {α : Type u_1} {β : Type u_2} {x : α β} :
x.isRight = false x.isLeft = true
theorem Sum.not_isRight {α : Type u_1} {β : Type u_2} {x : α β} :
¬x.isRight = true x.isLeft = true
theorem Sum.isLeft_iff {α✝ : Type u_1} {β✝ : Type u_2} {x : α✝ β✝} :
x.isLeft = true ∃ (y : α✝), x = Sum.inl y
theorem Sum.isRight_iff {α✝ : Type u_1} {β✝ : Type u_2} {x : α✝ β✝} :
x.isRight = true ∃ (y : β✝), x = Sum.inr y
theorem Sum.inl.inj_iff {α : Type u_1} {β : Type u_2} {a b : α} :
theorem Sum.inr.inj_iff {α : Type u_1} {β : Type u_2} {a b : β} :
theorem Sum.inl_ne_inr {α✝ : Type u_1} {a : α✝} {β✝ : Type u_2} {b : β✝} :
theorem Sum.inr_ne_inl {β✝ : Type u_1} {b : β✝} {α✝ : Type u_2} {a : α✝} :

Sum.elim #

@[simp]
theorem Sum.elim_comp_inl {α : Type u_1} {γ : Sort u_2} {β : Type u_3} (f : αγ) (g : βγ) :
Sum.elim f g Sum.inl = f
@[simp]
theorem Sum.elim_comp_inr {α : Type u_1} {γ : Sort u_2} {β : Type u_3} (f : αγ) (g : βγ) :
Sum.elim f g Sum.inr = g
@[simp]
theorem Sum.elim_inl_inr {α : Type u_1} {β : Type u_2} :
Sum.elim Sum.inl Sum.inr = id
theorem Sum.comp_elim {γ : Sort u_1} {δ : Sort u_2} {α : Type u_3} {β : Type u_4} (f : γδ) (g : αγ) (h : βγ) :
f Sum.elim g h = Sum.elim (f g) (f h)
@[simp]
theorem Sum.elim_comp_inl_inr {α : Type u_1} {β : Type u_2} {γ : Sort u_3} (f : α βγ) :
Sum.elim (f Sum.inl) (f Sum.inr) = f
theorem Sum.elim_eq_iff {α : Type u_1} {γ : Sort u_2} {β : Type u_3} {u u' : αγ} {v v' : βγ} :
Sum.elim u v = Sum.elim u' v' u = u' v = v'

Sum.map #

@[simp]
theorem Sum.map_map {α' : Type u_1} {α'' : Type u_2} {β' : Type u_3} {β'' : Type u_4} {α : Type u_5} {β : Type u_6} (f' : α'α'') (g' : β'β'') (f : αα') (g : ββ') (x : α β) :
Sum.map f' g' (Sum.map f g x) = Sum.map (f' f) (g' g) x
@[simp]
theorem Sum.map_comp_map {α' : Type u_1} {α'' : Type u_2} {β' : Type u_3} {β'' : Type u_4} {α : Type u_5} {β : Type u_6} (f' : α'α'') (g' : β'β'') (f : αα') (g : ββ') :
Sum.map f' g' Sum.map f g = Sum.map (f' f) (g' g)
@[simp]
theorem Sum.map_id_id {α : Type u_1} {β : Type u_2} :
Sum.map id id = id
theorem Sum.elim_map {α : Type u_1} {β : Type u_2} {ε : Sort u_3} {γ : Type u_4} {δ : Type u_5} {f₁ : αβ} {f₂ : βε} {g₁ : γδ} {g₂ : δε} {x : α γ} :
Sum.elim f₂ g₂ (Sum.map f₁ g₁ x) = Sum.elim (f₂ f₁) (g₂ g₁) x
theorem Sum.elim_comp_map {α : Type u_1} {β : Type u_2} {ε : Sort u_3} {γ : Type u_4} {δ : Type u_5} {f₁ : αβ} {f₂ : βε} {g₁ : γδ} {g₂ : δε} :
Sum.elim f₂ g₂ Sum.map f₁ g₁ = Sum.elim (f₂ f₁) (g₂ g₁)
@[simp]
theorem Sum.isLeft_map {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} (f : αβ) (g : γδ) (x : α γ) :
(Sum.map f g x).isLeft = x.isLeft
@[simp]
theorem Sum.isRight_map {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} (f : αβ) (g : γδ) (x : α γ) :
(Sum.map f g x).isRight = x.isRight
@[simp]
theorem Sum.getLeft?_map {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} (f : αβ) (g : γδ) (x : α γ) :
(Sum.map f g x).getLeft? = Option.map f x.getLeft?
@[simp]
theorem Sum.getRight?_map {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} (f : αβ) (g : γδ) (x : α γ) :
(Sum.map f g x).getRight? = Option.map g x.getRight?

Sum.swap #

@[simp]
theorem Sum.swap_swap {α : Type u_1} {β : Type u_2} (x : α β) :
x.swap.swap = x
@[simp]
theorem Sum.swap_swap_eq {α : Type u_1} {β : Type u_2} :
Sum.swap Sum.swap = id
@[simp]
theorem Sum.isLeft_swap {α : Type u_1} {β : Type u_2} (x : α β) :
x.swap.isLeft = x.isRight
@[simp]
theorem Sum.isRight_swap {α : Type u_1} {β : Type u_2} (x : α β) :
x.swap.isRight = x.isLeft
@[simp]
theorem Sum.getLeft?_swap {α : Type u_1} {β : Type u_2} (x : α β) :
x.swap.getLeft? = x.getRight?
@[simp]
theorem Sum.getRight?_swap {α : Type u_1} {β : Type u_2} (x : α β) :
x.swap.getRight? = x.getLeft?
theorem Sum.LiftRel.mono {α✝ : Type u_1} {α✝¹ : Type u_2} {r₁ r₂ : α✝α✝¹Prop} {β✝ : Type u_3} {β✝¹ : Type u_4} {s₁ s₂ : β✝β✝¹Prop} {x : α✝ β✝} {y : α✝¹ β✝¹} (hr : ∀ (a : α✝) (b : α✝¹), r₁ a br₂ a b) (hs : ∀ (a : β✝) (b : β✝¹), s₁ a bs₂ a b) (h : Sum.LiftRel r₁ s₁ x y) :
Sum.LiftRel r₂ s₂ x y
theorem Sum.LiftRel.mono_left {α✝ : Type u_1} {α✝¹ : Type u_2} {r₁ r₂ : α✝α✝¹Prop} {β✝ : Type u_3} {β✝¹ : Type u_4} {s : β✝β✝¹Prop} {x : α✝ β✝} {y : α✝¹ β✝¹} (hr : ∀ (a : α✝) (b : α✝¹), r₁ a br₂ a b) (h : Sum.LiftRel r₁ s x y) :
Sum.LiftRel r₂ s x y
theorem Sum.LiftRel.mono_right {β✝ : Type u_1} {β✝¹ : Type u_2} {s₁ s₂ : β✝β✝¹Prop} {α✝ : Type u_3} {α✝¹ : Type u_4} {r : α✝α✝¹Prop} {x : α✝ β✝} {y : α✝¹ β✝¹} (hs : ∀ (a : β✝) (b : β✝¹), s₁ a bs₂ a b) (h : Sum.LiftRel r s₁ x y) :
Sum.LiftRel r s₂ x y
theorem Sum.LiftRel.swap {α✝ : Type u_1} {α✝¹ : Type u_2} {r : α✝α✝¹Prop} {β✝ : Type u_3} {β✝¹ : Type u_4} {s : β✝β✝¹Prop} {x : α✝ β✝} {y : α✝¹ β✝¹} (h : Sum.LiftRel r s x y) :
Sum.LiftRel s r x.swap y.swap
@[simp]
theorem Sum.liftRel_swap_iff {β✝ : Type u_1} {β✝¹ : Type u_2} {s : β✝β✝¹Prop} {α✝ : Type u_3} {α✝¹ : Type u_4} {r : α✝α✝¹Prop} {x : α✝ β✝} {y : α✝¹ β✝¹} :
Sum.LiftRel s r x.swap y.swap Sum.LiftRel r s x y
theorem Sum.LiftRel.lex {α : Type u_1} {β : Type u_2} {r : ααProp} {s : ββProp} {a b : α β} (h : Sum.LiftRel r s a b) :
Sum.Lex r s a b
theorem Sum.liftRel_subrelation_lex {α✝ : Type u_1} {r : α✝α✝Prop} {β✝ : Type u_2} {s : β✝β✝Prop} :
theorem Sum.Lex.mono {α✝ : Type u_1} {r₁ r₂ : α✝α✝Prop} {β✝ : Type u_2} {s₁ s₂ : β✝β✝Prop} {x y : α✝ β✝} (hr : ∀ (a b : α✝), r₁ a br₂ a b) (hs : ∀ (a b : β✝), s₁ a bs₂ a b) (h : Sum.Lex r₁ s₁ x y) :
Sum.Lex r₂ s₂ x y
theorem Sum.Lex.mono_left {α✝ : Type u_1} {r₁ r₂ : α✝α✝Prop} {β✝ : Type u_2} {s : β✝β✝Prop} {x y : α✝ β✝} (hr : ∀ (a b : α✝), r₁ a br₂ a b) (h : Sum.Lex r₁ s x y) :
Sum.Lex r₂ s x y
theorem Sum.Lex.mono_right {β✝ : Type u_1} {s₁ s₂ : β✝β✝Prop} {α✝ : Type u_2} {r : α✝α✝Prop} {x y : α✝ β✝} (hs : ∀ (a b : β✝), s₁ a bs₂ a b) (h : Sum.Lex r s₁ x y) :
Sum.Lex r s₂ x y
theorem Sum.lex_acc_inl {α✝ : Type u_1} {r : α✝α✝Prop} {a : α✝} {β✝ : Type u_2} {s : β✝β✝Prop} (aca : Acc r a) :
Acc (Sum.Lex r s) (Sum.inl a)
theorem Sum.lex_acc_inr {α✝ : Type u_1} {r : α✝α✝Prop} {β✝ : Type u_2} {s : β✝β✝Prop} (aca : ∀ (a : α✝), Acc (Sum.Lex r s) (Sum.inl a)) {b : β✝} (acb : Acc s b) :
Acc (Sum.Lex r s) (Sum.inr b)
theorem Sum.lex_wf {α✝ : Type u_1} {r : α✝α✝Prop} {α✝¹ : Type u_2} {s : α✝¹α✝¹Prop} (ha : WellFounded r) (hb : WellFounded s) :
theorem Sum.elim_const_const {γ : Sort u_1} {α : Type u_2} {β : Type u_3} (c : γ) :
@[simp]
theorem Sum.elim_lam_const_lam_const {γ : Sort u_1} {α : Type u_2} {β : Type u_3} (c : γ) :
(Sum.elim (fun (x : α) => c) fun (x : β) => c) = fun (x : α β) => c