Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: port CategoryTheory.Adjunction.Lifting #4414

Closed
wants to merge 10 commits into from

Conversation

int-y1
Copy link
Collaborator

@int-y1 int-y1 commented May 27, 2023


todo:

  • constructLeftAdjoint error
    the error likely involves constructLeftAdjointEquiv_apply and @[simps (config := { rhsMd := semireducible })]

Open in Gitpod

Mathbin -> Mathlib
fix certain import statements
move "by" to end of line
add import to Mathlib.lean
@int-y1 int-y1 added help-wanted The author needs attention to resolve issues mathlib-port This is a port of a theory file from mathlib. labels May 27, 2023
@semorrison
Copy link
Contributor

Oh dear! It's an inscrutable block of rewrites that goes bad part way through.

@b-mehta, any chance you'd be able to look at this?

@semorrison semorrison requested a review from b-mehta June 14, 2023 07:17
@kbuzzard
Copy link
Member

kbuzzard commented Jul 5, 2023

As int-y1 suggests, I think the problem is that the type of constructLeftAdjointEquiv_apply is completely different in Lean 3 than in Lean 4. I don't know what @[simps (config := { rhsMd := semireducible })] did in Lean 3 but I can see that the type of the Lean 3 theorem is

construct_left_adjoint_equiv_apply :
  ∀ {A : Type u_4} {B : Type u_5} {C : Type u_6} [_inst_1 : category A] [_inst_2 : category B]
  [_inst_3 : category C]
  {U : B ⥤ C} {F : C ⥤ B} (R : A ⥤ B) (F' : C ⥤ A) (adj₁ : F ⊣ U) (adj₂ : F' ⊣ R ⋙ U)
  [_inst_4 : has_reflexive_coequalizers A]
  [_inst_5 : Π (X : B), regular_epi (adj₁.counit.app X)] (Y : A) (X : B)
  (ᾰ : construct_left_adjoint_obj R F' adj₁ adj₂ X ⟶ Y),
    ⇑(construct_left_adjoint_equiv R F' adj₁ adj₂ Y X) ᾰ =
      (⇑((cofork.is_colimit.hom_iso (counit_coequalises adj₁ X) (R.obj Y)).symm) ∘
         ⇑(((cofork.is_colimit.hom_iso
                (colimit.is_colimit
                   (parallel_pair (F'.map (U.map (adj₁.counit.app X))) (other_map R F' adj₁ adj₂ X)))
                Y).trans
               ((adj₂.hom_equiv (U.obj X) Y).subtype_equiv _)).trans
              ((adj₁.hom_equiv (U.obj X) (R.obj Y)).symm.subtype_equiv _)))

which is pretty much what you would expect from the definition. In Lean 4 the type is totally different: it's

CategoryTheory.LiftAdjoint.constructLeftAdjointEquiv_apply.{v₁, v₂, v₃, u₁, u₂, u₃} {A : Type u₁} {B : Type u₂}
  {C : Type u₃} [inst✝ : Category A] [inst✝¹ : Category B] [inst✝² : Category C] {U : B ⥤ C} {F : C ⥤ B} (R : A ⥤ B)
  (F' : C ⥤ A) (adj₁ : F ⊣ U) (adj₂ : F' ⊣ R ⋙ U) [inst✝³ : HasReflexiveCoequalizers A]
  [inst✝⁴ : (X : B) → RegularEpi (adj₁.counit.app X)] (Y : A) (X : B)
  (a✝ : constructLeftAdjointObj R F' adj₁ adj₂ X ⟶ Y) :
  ↑(constructLeftAdjointEquiv R F' adj₁ adj₂ Y X) a✝ =
    ↑(Cofork.IsColimit.homIso (counitCoequalises adj₁ X) (R.obj Y)).symm
      {
        val :=
          F.map
              (↑(Adjunction.homEquiv adj₂ (U.obj X) Y)
                ↑(↑(Cofork.IsColimit.homIso
                        (colimit.isColimit
                          (parallelPair (F'.map (U.map (adj₁.counit.app X))) (otherMap R F' adj₁ adj₂ X)))
                        Y)
                    a✝)) ≫
            adj₁.counit.app (R.obj Y),
        property :=
          (_ :
            (fun b ↦ F.map (U.map (adj₁.counit.app X)) ≫ b = adj₁.counit.app (F.obj (U.obj X)) ≫ b)
              (F.map
                  (↑(Adjunction.homEquiv adj₂ (U.obj X) Y)
                    ↑(↑(Cofork.IsColimit.homIso
                            (colimit.isColimit
                              (parallelPair (F'.map (U.map (adj₁.counit.app X))) (otherMap R F' adj₁ adj₂ X)))
                            Y)
                        a✝)) ≫
                adj₁.counit.app (R.obj Y))) }

and so after rw [constructLeftAdjointEquiv_apply, constructLeftAdjointEquiv_apply] the goal is totally different in Lean 3 than in Lean 4. I suspect the path of least resistance here is to figure out how to make Lean 4 simps make the same lemma as Lean 3 simps, or just make the Lean 3 lemma manually. I tried this with

lemma construct_left_adjoint_equiv_apply' [∀ (X : B), RegularEpi (adj₁.counit.app X)] (Y : A) (X : B)
  (a : constructLeftAdjointObj R F' adj₁ adj₂ X ⟶ Y) :
    (constructLeftAdjointEquiv R F' adj₁ adj₂ Y X) a =
      (↑((Cofork.IsColimit.homIso (counitCoequalises adj₁ X) (R.obj Y)).symm) ∘
         ⇑(((Cofork.IsColimit.homIso
                (colimit.isColimit
                   (parallelPair (F'.map (U.map (adj₁.counit.app X))) (otherMap R F' adj₁ adj₂ X)))
                Y).trans
               ((adj₂.homEquiv (U.obj X) Y).subtypeEquiv _)).trans
              ((adj₁.homEquiv (U.obj X) (R.obj Y)).symm.subtypeEquiv _))) := sorry

but I couldn't get the statement to typecheck. If there is just some quick way of making simps behave in the same way as Lean 3 then it would save all this bother.

@mattrobball mattrobball added awaiting-review The author would like community review of the PR and removed help-wanted The author needs attention to resolve issues labels Jul 7, 2023
@mattrobball
Copy link
Collaborator

Or just bull ahead naively...

Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🎉

bors merge

@semorrison semorrison added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels Jul 7, 2023
bors bot pushed a commit that referenced this pull request Jul 7, 2023
Co-authored-by: Matthew Ballard <matt@mrb.email>
Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>
@bors
Copy link

bors bot commented Jul 7, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title feat: port CategoryTheory.Adjunction.Lifting [Merged by Bors] - feat: port CategoryTheory.Adjunction.Lifting Jul 7, 2023
@bors bors bot closed this Jul 7, 2023
@bors bors bot deleted the port/CategoryTheory.Adjunction.Lifting branch July 7, 2023 04:28
qawbecrdtey pushed a commit to qawbecrdtey/greedoid-mathlib4 that referenced this pull request Jul 7, 2023
Co-authored-by: Matthew Ballard <matt@mrb.email>
Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>
semorrison pushed a commit that referenced this pull request Aug 14, 2023
Co-authored-by: Matthew Ballard <matt@mrb.email>
Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mathlib-port This is a port of a theory file from mathlib. ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants