Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8fb146b
chore: start port
Vtec234 Feb 11, 2026
31aa326
chore: import
Vtec234 Feb 11, 2026
3f81c94
chore: rfl
Vtec234 Feb 11, 2026
94c4ec5
more adaptations
Vtec234 Feb 11, 2026
5b2bcf1
import
Vtec234 Feb 11, 2026
ac43449
feat: theory
Vtec234 Nov 19, 2025
fab85c8
feat: generalize interpretation universes
Vtec234 Nov 19, 2025
a5259b8
feat: scaffolding for semantics
Vtec234 Nov 19, 2025
90e367a
chore: universe
Vtec234 Nov 19, 2025
aa46e17
feat: internal theory
Vtec234 Nov 19, 2025
edf582a
chore: add univMax_le field
Vtec234 Nov 19, 2025
b62336a
fix: prop
Vtec234 Nov 19, 2025
b970286
doc: trunc levels
Vtec234 Nov 28, 2025
001d93b
feat: add Bhavik's example
Vtec234 Dec 5, 2025
be364b8
fix: slen le
Vtec234 Dec 5, 2025
56f7c87
feat: @[reflect] attribute
Vtec234 Jan 29, 2026
bc9b97c
fix: unitt test
Vtec234 Jan 29, 2026
b28a452
feat: signature maps
Vtec234 Jan 30, 2026
56e0dc8
more internal theory lemmas
Vtec234 Feb 3, 2026
27691de
misc
Vtec234 Feb 3, 2026
0e89c81
chore: move lemmas
Vtec234 Feb 4, 2026
7496dfc
feat: theory maps
Vtec234 Feb 4, 2026
d31d9b5
feat: snoc takes a wf-type
Vtec234 Feb 11, 2026
fcdfdfc
chore: disambiguate lib
Vtec234 Feb 11, 2026
719bcd6
chore: trace and doc
Vtec234 Feb 11, 2026
5b361d1
feat: Val.map
Vtec234 Feb 11, 2026
839a5fd
feat: instances
Vtec234 Feb 11, 2026
93142a6
feat: typecheck theory maps
Vtec234 Feb 11, 2026
7901d70
chore: Checked -> Reflected
Vtec234 Feb 12, 2026
32d3963
fix: some tests
Vtec234 Feb 12, 2026
da0fe3c
feat: unbracket
Vtec234 Feb 12, 2026
7d03d94
refactor: Qq madness
Vtec234 Feb 12, 2026
a70ccb8
feat: delaborators
Vtec234 Feb 13, 2026
3429724
feat: ctx widget
Vtec234 Feb 13, 2026
78b9760
feat: improve index tactic
Vtec234 Feb 19, 2026
9e11a6c
feat: type deinterp
Vtec234 Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 16 additions & 24 deletions HoTTLean/ForMathlib.lean
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Mathlib.Tactic.DepRewrite
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.PullbackCone
import Mathlib.CategoryTheory.Groupoid.Discrete
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.IsPullback.Basic
import Mathlib.CategoryTheory.Category.ULift
import Mathlib.Logic.Function.ULift
import Mathlib.CategoryTheory.Category.Cat
import Mathlib.CategoryTheory.Category.Grpd
import Mathlib.CategoryTheory.Groupoid.Grpd.Basic
import Mathlib.Data.Part
import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
import Mathlib.CategoryTheory.Core
Expand Down Expand Up @@ -101,29 +102,29 @@ namespace CategoryTheory.Cat

/-- This is the proof of equality used in the eqToHom in `Cat.eqToHom_hom` -/
theorem eqToHom_hom_aux {C1 C2 : Cat.{v,u}} (x y: C1) (eq : C1 = C2) :
(x ⟶ y) = ((eqToHom eq).obj x ⟶ (eqToHom eq).obj y) := by
(x ⟶ y) = ((eqToHom eq).toFunctor.obj x ⟶ (eqToHom eq).toFunctor.obj y) := by
cases eq
simp[CategoryStruct.id]

/-- This is the turns the hom part of eqToHom functors into a cast-/
theorem eqToHom_hom {C1 C2 : Cat.{v,u}} {x y: C1} (f : x ⟶ y) (eq : C1 = C2) :
(eqToHom eq).map f = (cast (Cat.eqToHom_hom_aux x y eq) f) := by
(eqToHom eq).toFunctor.map f = (cast (Cat.eqToHom_hom_aux x y eq) f) := by
cases eq
simp[CategoryStruct.id]

/-- This turns the object part of eqToHom functors into casts -/
theorem eqToHom_obj {C1 C2 : Cat.{v,u}} (x : C1) (eq : C1 = C2) :
(eqToHom eq).obj x = cast (congrArg Bundled.α eq) x := by
(eqToHom eq).toFunctor.obj x = cast (congrArg Bundled.α eq) x := by
cases eq
simp[CategoryStruct.id]

abbrev homOf {C D : Type u} [Category.{v} C] [Category.{v} D] (F : C ⥤ D) :
Cat.of C ⟶ Cat.of D := F
Cat.of C ⟶ Cat.of D := ⟨F⟩

@[simps] def ULift_lte_iso_self {C : Type (max u u₁)} [Category.{v} C] :
Cat.of (ULift.{u} C) ≅ Cat.of C where
hom := ULift.downFunctor
inv := ULift.upFunctor
hom := homOf ULift.downFunctor
inv := homOf ULift.upFunctor

@[simp] def ULift_succ_iso_self {C : Type (u + 1)} [Category.{v} C] :
of (ULift.{u, u + 1} C) ≅ of C := ULift_lte_iso_self.{v,u,u+1}
Expand All @@ -135,8 +136,8 @@ def ofULift (C : Type u) [Category.{v} C] : Cat.{v, max u w} :=
of $ ULift.{w} C

def uLiftFunctor : Cat.{v,u} ⥤ Cat.{v, max u w} where
obj X := Cat.ofULift.{w} X
map F := Cat.homOf $ ULift.downFunctor ⋙ F ⋙ ULift.upFunctor
obj X := ofULift.{w} X
map F := homOf $ ULift.downFunctor ⋙ F.toFunctor ⋙ ULift.upFunctor

end CategoryTheory.Cat

Expand Down Expand Up @@ -401,16 +402,15 @@ variable {Γ : Type u₂} [Category.{v₂} Γ] {A : Γ ⥤ Grpd.{v₁,u₁}}

@[simp] theorem Cat.map_id_obj {A : Γ ⥤ Cat.{v₁,u₁}}
{x : Γ} {a : A.obj x} :
(A.map (𝟙 x)).obj a = a := by
have : A.map (𝟙 x) = 𝟙 (A.obj x) := by simp
exact Functor.congr_obj this a
(A.map (𝟙 x)).toFunctor.obj a = a := by
simp

theorem Cat.map_id_map {A : Γ ⥤ Cat.{v₁,u₁}}
{x : Γ} {a b : A.obj x} {f : a ⟶ b} :
(A.map (𝟙 x)).map f = eqToHom Cat.map_id_obj
(A.map (𝟙 x)).toFunctor.map f = eqToHom Cat.map_id_obj
≫ f ≫ eqToHom Cat.map_id_obj.symm := by
have : A.map (𝟙 x) = 𝟙 (A.obj x) := by simp
exact Functor.congr_hom this f
rw! [show A.map (𝟙 x) = 𝟙 (A.obj x) by simp]
simp

end

Expand Down Expand Up @@ -624,14 +624,6 @@ lemma Discrete.functor_eq {X C : Type*} [Category C] {F : Discrete X ⥤ C} :
cases h
simp

lemma Discrete.functor_ext {X C : Type*} [Category C] (F G : Discrete X ⥤ C)
(h : ∀ x : X, F.obj ⟨x⟩ = G.obj ⟨x⟩) :
F = G :=
calc F
_ = Discrete.functor (fun x => F.obj ⟨x⟩) := Discrete.functor_eq
_ = Discrete.functor (fun x => G.obj ⟨x⟩) := Discrete.functor_ext' h
_ = G := Discrete.functor_eq.symm

lemma Discrete.hext {X Y : Type u} (a : Discrete X) (b : Discrete Y) (hXY : X ≍ Y)
(hab : a.1 ≍ b.1) : a ≍ b := by
aesop_cat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ variable (F : Pseudofunctor B Cat) {a b : B}
(X Y : LocallyDiscrete C) (e : X ≅ Y) : e.hom.toLoc ≫ e.inv.toLoc = 𝟙 _ :=
LocallyDiscrete.eq_of_hom ⟨⟨by simp⟩⟩

attribute [reassoc] StrongTrans.naturality_comp_inv_app

end

lemma _root_.CategoryTheory.Functor.toPseudofunctor'_map₂ {C : Type u₁} [Category.{v₁} C] (F : C ⥤ Cat)
Expand Down
16 changes: 7 additions & 9 deletions HoTTLean/ForMathlib/CategoryTheory/FreeGroupoid.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joseph Hua
-/
import Mathlib.CategoryTheory.Groupoid.FreeGroupoid
import Mathlib.CategoryTheory.Category.Grpd
import Mathlib.CategoryTheory.Groupoid.Grpd.Basic
import Mathlib.CategoryTheory.Adjunction.Reflective
import Mathlib.CategoryTheory.Localization.Predicate
import Mathlib.CategoryTheory.Monad.Limits
import Mathlib.CategoryTheory.Category.Cat.Limit

import HoTTLean.ForMathlib.CategoryTheory.Localization.Predicate

/-!
# Free groupoid on a category

Expand Down Expand Up @@ -190,15 +188,15 @@ open Category.FreeGroupoid
@[simps]
def free : Cat.{u,u} ⥤ Grpd.{u,u} where
obj C := Grpd.of <| Category.FreeGroupoid C
map {C D} F := map F
map_id C := by simp [Grpd.id_eq_id, ← map_id]; rfl
map_comp F G := by simp [Grpd.comp_eq_comp, ← map_comp]; rfl
map {C D} F := map F.toFunctor
map_id C := by simp [Grpd.id_eq_id, ← map_id]
map_comp F G := by simp [Grpd.comp_eq_comp, ← map_comp]

/-- The unit of the free-forgetful adjunction between `Grpd` and `Cat`. -/
@[simps]
def freeForgetAdjunction.unit : 𝟭 Cat ⟶ free ⋙ forgetToCat where
app C := Category.FreeGroupoid.of C
naturality C D F := by simp [forgetToCat, Cat.comp_eq_comp, map, lift_spec]
app C := Category.FreeGroupoid.of C
naturality C D F := by ext; simp [forgetToCat, map, lift_spec]

/-- The counit of the free-forgetful adjunction between `Grpd` and `Cat`. -/
@[simps]
Expand All @@ -218,7 +216,7 @@ def freeForgetAdjunction : free ⊣ Grpd.forgetToCat where
apply lift_unique
simp [Functor.assoc, lift_spec, Grpd.id_eq_id]
right_triangle_components G := by
simp [forgetToCat, Cat.comp_eq_comp, lift_spec, Cat.id_eq_id]
ext; simp [forgetToCat, lift_spec]

instance : Reflective Grpd.forgetToCat where
L := free
Expand Down
17 changes: 0 additions & 17 deletions HoTTLean/ForMathlib/CategoryTheory/Groupoid.lean

This file was deleted.

56 changes: 0 additions & 56 deletions HoTTLean/ForMathlib/CategoryTheory/Localization/Predicate.lean

This file was deleted.

19 changes: 0 additions & 19 deletions HoTTLean/ForMathlib/CategoryTheory/MorphismProperty/Basic.lean

This file was deleted.

1 change: 0 additions & 1 deletion HoTTLean/ForMathlib/CategoryTheory/NatTrans.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Mathlib.CategoryTheory.NatTrans
import Mathlib.CategoryTheory.Functor.TwoSquare
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
import HoTTLean.ForMathlib

universe w v u v₁ u₁ v₂ u₂ v₃ u₃
Expand Down
2 changes: 1 addition & 1 deletion HoTTLean/ForMathlib/CategoryTheory/RepPullbackCone.lean
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Mathlib.CategoryTheory.Limits.Yoneda
import Mathlib.CategoryTheory.Functor.KanExtension.Adjunction
import Mathlib.CategoryTheory.Limits.Preserves.Finite
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.IsPullback.Basic
import HoTTLean.ForMathlib.CategoryTheory.WeakPullback

/-!
Expand Down
10 changes: 5 additions & 5 deletions HoTTLean/ForMathlib/Tactic/CategoryTheory/FunctorMap.lean
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@ def functorMapExpr (e : Expr) (lvl_params : Bool) : MetaM (Expr × List Level) :
let some (hom, _, _) := eTp.eq? | throwError "expected an equality, got{indentD eTp}"
if !hom.isAppOf ``Quiver.Hom then
throwError "expected an equality of morphisms, got{indentD eTp}"
let [.succ v₁, u₁] := hom.getAppFn.constLevels! |
let [v₁, u₁] := hom.getAppFn.constLevels! |
throwError "unexpected universe levels in{indentD hom.getAppFn}"
let e' ← mkAppM' (.const ``eq_functor_map [v₁, u₁, v₂, u₂]) #[e]
simpType categorySimp' e'
return (e, [v₂, u₂])

syntax (name := functor_map) "functor_map" (" (" &"attr" ":=" Parser.Term.attrInstance,* ")")? : attr
syntax (name := functor_map) "functor_map" optAttrArg : attr

initialize registerBuiltinAttribute {
name := `functor_map
descr := ""
applicationTime := .afterCompilation
add := fun src ref kind => match ref with
| `(attr| functor_map $[(attr := $stx?,*)]?) => MetaM.run' do
| `(attr| functor_map $stx?) => MetaM.run' do
if (kind != AttributeKind.global) then
throwError "`functor_map` can only be used as a global attribute"
addRelatedDecl src "_functor_map" ref stx? fun type value levels => do
let (e, levels') ← functorMapExpr (← mkExpectedTypeHint value type) true
addRelatedDecl src (src.appendAfter "_functor_map") ref stx? fun value levels => do
let (e, levels') ← functorMapExpr value true
pure (e, levels ++ levels'.map fun | .param n => n | _ => panic! "")
| _ => throwUnsupportedSyntax }

Expand Down
4 changes: 2 additions & 2 deletions HoTTLean/ForPoly.lean
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ theorem fan_snd_map' {E B E' B' : C} {P : UvPoly E B} {P' : UvPoly E' B'}
slice_lhs 1 2 => rw [← this]
slice_lhs 2 3 => apply Category.comp_id
simp [α, Over.starPullbackIsoStar]
slice_lhs 5 6 => apply pullback.lift_fst
simp [Over.mapForget]
slice_lhs 4 5 => apply pullback.lift_fst
simp

open ExponentiableMorphism in
theorem fan_snd_map {E B A E' B' A' : C} {P : UvPoly E B} {P' : UvPoly E' B'}
Expand Down
62 changes: 0 additions & 62 deletions HoTTLean/Frontend/Checked.lean

This file was deleted.

Loading
Loading