More theorems about the sum type #
@[protected, instance]
def
sum.decidable_eq
(α : Type u)
[a : decidable_eq α]
(β : Type v)
[a_1 : decidable_eq β] :
decidable_eq (α ⊕ β)
@[simp]
@[simp]
@[simp]
theorem
sum.update_elim_inl
{α : Type u_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq α]
[decidable_eq (α ⊕ β)]
{f : α → γ}
{g : β → γ}
{i : α}
{x : γ} :
function.update (sum.elim f g) (sum.inl i) x = sum.elim (function.update f i x) g
@[simp]
theorem
sum.update_elim_inr
{α : Type u_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq β]
[decidable_eq (α ⊕ β)]
{f : α → γ}
{g : β → γ}
{i : β}
{x : γ} :
function.update (sum.elim f g) (sum.inr i) x = sum.elim f (function.update g i x)
@[simp]
theorem
sum.update_inl_comp_inl
{α : Type u_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq α]
[decidable_eq (α ⊕ β)]
{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_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq α]
[decidable_eq (α ⊕ β)]
{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_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq (α ⊕ β)]
{f : α ⊕ β → γ}
{i : α}
{x : γ} :
@[simp]
theorem
sum.update_inl_apply_inr
{α : Type u_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq (α ⊕ β)]
{f : α ⊕ β → γ}
{i : α}
{j : β}
{x : γ} :
function.update f (sum.inl i) x (sum.inr j) = f (sum.inr j)
@[simp]
theorem
sum.update_inr_comp_inl
{α : Type u_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq (α ⊕ β)]
{f : α ⊕ β → γ}
{i : β}
{x : γ} :
@[simp]
theorem
sum.update_inr_apply_inl
{α : Type u_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq (α ⊕ β)]
{f : α ⊕ β → γ}
{i : α}
{j : β}
{x : γ} :
function.update f (sum.inr j) x (sum.inl i) = f (sum.inl i)
@[simp]
theorem
sum.update_inr_comp_inr
{α : Type u_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq β]
[decidable_eq (α ⊕ β)]
{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_1}
{β : Type u_2}
{γ : Sort u_3}
[decidable_eq β]
[decidable_eq (α ⊕ β)]
{f : α ⊕ β → γ}
{i j : β}
{x : γ} :
function.update f (sum.inr i) x (sum.inr j) = function.update (f ∘ sum.inr) i x j
- inl : ∀ {α : Type u} {β : Type v} (ra : α → α → Prop) (rb : β → β → Prop) {a₁ a₂ : α}, ra a₁ a₂ → sum.lex ra rb (sum.inl a₁) (sum.inl a₂)
- inr : ∀ {α : Type u} {β : Type v} (ra : α → α → Prop) (rb : β → β → Prop) {b₁ b₂ : β}, rb b₁ b₂ → sum.lex ra rb (sum.inr b₁) (sum.inr b₂)
- sep : ∀ {α : Type u} {β : Type v} (ra : α → α → Prop) (rb : β → β → Prop) (a : α) (b : β), sum.lex ra rb (sum.inl a) (sum.inr b)
Lexicographic order for sum. Sort all the inl a
before the inr b
,
otherwise use the respective order on α
or β
.
theorem
sum.lex_wf
{α : Type u}
{β : Type v}
{ra : α → α → Prop}
{rb : β → β → Prop}
(ha : well_founded ra)
(hb : well_founded rb) :
well_founded (sum.lex ra rb)
@[simp]
@[simp]
theorem
function.injective.sum_elim
{α : Type u}
{β : Type v}
{γ : Sort u_1}
{f : α → γ}
{g : β → γ}
(hf : function.injective f)
(hg : function.injective g)
(hfg : ∀ (a : α) (b : β), f a ≠ g b) :
function.injective (sum.elim f g)
theorem
function.injective.sum_map
{α : Type u}
{α' : Type w}
{β : Type v}
{β' : Type x}
{f : α → β}
{g : α' → β'}
(hf : function.injective f)
(hg : function.injective g) :
function.injective (sum.map f g)
theorem
function.surjective.sum_map
{α : Type u}
{α' : Type w}
{β : Type v}
{β' : Type x}
{f : α → β}
{g : α' → β'}
(hf : function.surjective f)
(hg : function.surjective g) :
function.surjective (sum.map f g)