English
A variation on the injectivity of Sum.elim under weaker hypotheses; still ensures distinct inputs map to distinct outputs.
Русский
Вариант инъективности Sum.elim при ослабленных гипотезах; разные аргументы дают разные значения.
LaTeX
$$$$ \\text{Injective}(\\mathrm{Sum.elim} f g). $$$$
Lean4
theorem sumElim {γ : Sort*} {f : α → γ} {g : β → γ} (hf : Injective f) (hg : Injective g) (hfg : ∀ a b, f a ≠ g b) :
Injective (Sum.elim f g)
| inl _, inl _, h => congr_arg inl <| hf h
| inl _, inr _, h => (hfg _ _ h).elim
| inr _, inl _, h => (hfg _ _ h.symm).elim
| inr _, inr _, h => congr_arg inr <| hg h