Zulip Chat Archive

Stream: new members

Topic: passing to the quotient via surjective maps


Antoine Chambert-Loir (Dec 06 2021 at 20:25):

I have an explicit surjective map p : X -> Y and a map g : X -> T such that p(x) = p(x') implies g(x)=g(x'); how can I define the unique function f : Y -> Tsuch that f o p = g?

I can do it like this, but I am certain that there is a simpler way ? Is it necessary to pass through the quotient infrastructure ?

open function
variables (α β γ : Type*)

lemma factor (p : α  β) (hp : surjective p) (g : α  γ) (hpg :  (x y : α), p(x) = p(y)  g(x) = g(y)) :
   (f: β  γ), comp f p = g :=
  begin
    obtain q, hq := surjective.has_right_inverse hp,
    use comp g q,
    ext x,
    simp only [comp_app],
    exact hpg (q (p x)) x (hq (p x))
  end

Johan Commelin (Dec 06 2021 at 20:27):

Passing through quotient still wouldn't give you a map out of Y, right.

Kevin Buzzard (Dec 06 2021 at 20:28):

[usual #mwe moan -- your code doesn't paste]

Kevin Buzzard (Dec 06 2021 at 20:30):

You don't need the simp only [comp_app],, it's definitional.

Kevin Buzzard (Dec 06 2021 at 20:32):

The quotient infrastructure would give you a map out of quotient R for some R :-/

Antoine Chambert-Loir (Dec 06 2021 at 20:33):

Kevin Buzzard said:

[usual #mwe moan -- your code doesn't paste]

It was copy pasted from VSCode, but I forgot to include the open function line, sorry !

Kevin Buzzard (Dec 06 2021 at 20:34):

And the import tactic line ;-)

Johan Commelin (Dec 06 2021 at 20:34):

import logic.function.basic

open function

variables {α β γ : Type*}

noncomputable
def function.surjective.lift {p : α  β} (hp : surjective p) (g : α  γ) :
  β  γ :=
g  hp.has_right_inverse.some

lemma function.surjective.lift_eq (p : α  β) (hp : surjective p) (g : α  γ)
  (hg :  {x y}, p x = p y  g x = g y) :
  hp.lift g  p = g :=
funext $ λ x, hg $ hp.has_right_inverse.some_spec _ -- edit to include final `_`

Kevin Buzzard (Dec 06 2021 at 20:35):

Johan is making an API for surjections analogous to the API for quotient.

Antoine Chambert-Loir (Dec 06 2021 at 20:35):

Kevin Buzzard said:

And the import tactic line ;-)

What is this line ? I fear I'm missing some magic here…

Johan Commelin (Dec 06 2021 at 20:35):

You can't use the ext tactic if you don't import it.

Johan Commelin (Dec 06 2021 at 20:35):

import tactic at the top of the file gives you (almost) all tactics.

Antoine Chambert-Loir (Dec 06 2021 at 20:35):

But I don't have this line at the top of my file !

Johan Commelin (Dec 06 2021 at 20:36):

Right, so you should see errors.

Johan Commelin (Dec 06 2021 at 20:36):

I had errors when I copy-pasted your snippet.

Kevin Buzzard (Dec 06 2021 at 20:36):

use is also not a core lean tactic

Johan Commelin (Dec 06 2021 at 20:36):

Nor is obtain

Antoine Chambert-Loir (Dec 06 2021 at 20:38):

Capisco, I had an import data.fintype.basic (because my sandbox.lean file has many purposes) and I presume that this import was doing the job!

Adam Topaz (Dec 06 2021 at 20:38):

@Antoine Chambert-Loir docs#setoid.ker and docs#setoid.quotient_ker_equiv_of_surjective would be helpful to relate the surjective map to the quotient api in this case.

Antoine Chambert-Loir (Dec 06 2021 at 20:46):

@Johan Commelin
Your version renders an error,

type mismatch at application
  hg (Exists.some_spec hp.has_right_inverse)
term
  Exists.some_spec hp.has_right_inverse
has type
  right_inverse (Exists.some _) p
but is expected to have type
  p ?m_1 = p ?m_2

(but I don't understand it, because I don't understand the $ ... $constructions (and can't find their explanation in the docs, while I'm sure I've read it once!)

Johan Commelin (Dec 06 2021 at 20:47):

f $ g x = f (g x). It just reduced the amount of ().

Johan Commelin (Dec 06 2021 at 20:47):

So f $ g $ h x = f (g (h x))

Johan Commelin (Dec 06 2021 at 20:48):

My code compiles on my side. So I don't know what's wrong.

Kevin Buzzard (Dec 06 2021 at 20:48):

It doesn't compile on today's master

Johan Commelin (Dec 06 2021 at 20:49):

Oops, let me update my lean

Johan Commelin (Dec 06 2021 at 20:52):

-- rano% git show | head -1
-- commit 812431404d4669d4e055e2a790e964068ba5ac92
-- rano% cat src/demo.lean
import logic.function.basic

open function

variables {α β γ : Type*}

noncomputable
def function.surjective.lift {p : α  β} (hp : surjective p) (g : α  γ) :
  β  γ :=
g  hp.has_right_inverse.some

lemma function.surjective.lift_eq (p : α  β) (hp : surjective p) (g : α  γ)
  (hg :  {x y}, p x = p y  g x = g y) :
  hp.lift g  p = g :=
funext $ λ x, hg $ hp.has_right_inverse.some_spec _
-- rano% lean src/demo.lean
-- rano%

Johan Commelin (Dec 06 2021 at 20:52):

I seem to be on latest master, end Lean compiles this without error

Kevin Buzzard (Dec 06 2021 at 20:53):

type mismatch at application
  hg (Exists.some_spec hp.has_right_inverse)
term
  Exists.some_spec hp.has_right_inverse
has type
  right_inverse (Exists.some _) p
but is expected to have type
  p ?m_1 = p ?m_2

also on commit 812431404d4669d4e055e2a790e964068ba5ac92

Kevin Buzzard (Dec 06 2021 at 20:54):

Error on the $ in funext $ λ x, hg $ hp.has_right_inverse.some_spec

Eric Wieser (Dec 06 2021 at 20:54):

Is has_right_inverse.some just docs#function.surj_inv?

Kevin Buzzard (Dec 06 2021 at 20:54):

Oh lol your first post doesn't work and your second one does

Kevin Buzzard (Dec 06 2021 at 20:56):

The first time you posted you missed off the final _

Johan Commelin (Dec 06 2021 at 20:57):

Oops, copy-paste-error :sorry:


Last updated: Dec 20 2023 at 11:08 UTC