Zulip Chat Archive

Stream: Is there code for X?

Topic: Right inverse of injective


view this post on Zulip Pedro Minicz (Jul 24 2020 at 17:25):

Is there something equivalent to right_inverse_of_injective in mathlib?

import tactic.basic

variables {α β : Type} [nonempty α] {f : α  β}

lemma right_inverse_of_injective (hf : function.injective f) :
   g, function.right_inverse f g :=
begin
  classical,
  let g := λ b,
      if h :  a, f a = b
        then classical.some h
        else classical.choice (by apply_instance),
  use g,
  intro a,
  have ha :  a', f a' = f a, from a, rfl,
  simp only [g, dif_pos ha],
  apply hf,
  exact classical.some_spec ha
end

view this post on Zulip Reid Barton (Jul 24 2020 at 17:30):

left_inverse_inv_fun

view this post on Zulip Reid Barton (Jul 24 2020 at 17:34):

or even injective.has_left_inverse


Last updated: May 16 2021 at 05:21 UTC