├── .github
└── workflows
│ ├── blueprint.yml
│ ├── push.yml
│ └── push_pr.yml
├── .gitignore
├── .vscode
└── settings.json
├── Notes
└── HowNameSpacesWorkInLean.lean
├── Poly.lean
├── Poly
├── Bifunctor
│ ├── Basic.lean
│ └── Sigma.lean
├── ForMathlib
│ └── CategoryTheory
│ │ ├── Comma
│ │ └── Over
│ │ │ ├── Basic.lean
│ │ │ ├── Pullback.lean
│ │ │ └── Sections.lean
│ │ ├── Elements.lean
│ │ ├── LocallyCartesianClosed
│ │ ├── Basic.lean
│ │ ├── Basic_old.lean
│ │ ├── BeckChevalley.lean
│ │ ├── BeckChevalley_old.lean
│ │ ├── Distributivity.lean
│ │ └── Presheaf.lean
│ │ ├── NatIso.lean
│ │ ├── NatTrans.lean
│ │ ├── PartialProduct.lean
│ │ └── Types.lean
├── MvPoly
│ └── Basic.lean
├── Type
│ └── Univariate.lean
├── UvPoly
│ ├── Basic.lean
│ ├── UPFan.lean
│ └── UPIso.lean
├── Widget
│ └── CommDiag.lean
└── deprecated
│ ├── Basic.lean
│ ├── Exponentiable.lean
│ ├── ForMathlib.lean
│ ├── LCCC.lean
│ ├── LCCC
│ ├── Basic.lean
│ ├── BeckChevalley.lean
│ ├── Presheaf.lean
│ └── Presheaf_test.lean
│ ├── LawvereTheory.lean
│ ├── PartialProduct.lean
│ └── Slice.lean
├── README.md
├── blueprint
├── src
│ ├── Packages
│ │ └── bussproofs.py
│ ├── Templates
│ │ └── prooftree.jinja2
│ ├── blueprint.sty
│ ├── chapter
│ │ ├── all.tex
│ │ ├── lccc.tex
│ │ ├── mvpoly.tex
│ │ └── uvpoly.tex
│ ├── content.tex
│ ├── extra_styles.css
│ ├── latexmkrc
│ ├── macros
│ │ ├── common.tex
│ │ ├── print.tex
│ │ └── web.tex
│ ├── plastex.cfg
│ ├── print.pdf
│ ├── print.tex
│ ├── refs.bib
│ ├── web.paux
│ ├── web.pdf
│ └── web.tex
└── web
│ ├── dep_graph_document.html
│ ├── index.html
│ ├── js
│ ├── d3-graphviz.js
│ ├── d3.min.js
│ ├── expatlib.wasm
│ ├── graphvizlib.wasm
│ ├── hpcc.min.js
│ ├── jquery.min.js
│ ├── js.cookie.min.js
│ ├── plastex.js
│ ├── showmore.js
│ └── svgxuse.js
│ ├── styles
│ ├── amsthm.css
│ ├── blueprint.css
│ ├── dep_graph.css
│ ├── extra_styles.css
│ ├── showmore.css
│ ├── theme-blue.css
│ ├── theme-green.css
│ └── theme-white.css
│ └── symbol-defs.svg
├── home_page
├── 404.html
├── Gemfile
├── Gemfile.lock
├── _config.yml
├── _include
│ └── mathjax.html
├── _layouts
│ └── default.html
├── assets
│ └── css
│ │ └── style.scss
└── index.md
├── lake-manifest.json
├── lakefile.lean
└── lean-toolchain
/.github/workflows/blueprint.yml:
--------------------------------------------------------------------------------
1 | name: Compile blueprint
2 |
3 | on:
4 | push:
5 | branches:
6 | - master # Trigger on pushes to the default branch
7 | workflow_dispatch: # Allow manual triggering of the workflow from the GitHub Actions interface
8 |
9 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10 | permissions:
11 | contents: read # Read access to repository contents
12 | pages: write # Write access to GitHub Pages
13 | id-token: write # Write access to ID tokens
14 |
15 | jobs:
16 | build_project:
17 | runs-on: ubuntu-latest
18 | name: Build project
19 | steps:
20 | - name: Checkout project
21 | uses: actions/checkout@v4
22 | with:
23 | fetch-depth: 0 # Fetch all history for all branches and tags
24 |
25 | - name: Install elan
26 | run: curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y
27 |
28 | - name: Get Mathlib cache
29 | run: ~/.elan/bin/lake exe cache get || true
30 |
31 | - name: Build project
32 | run: ~/.elan/bin/lake build Poly
33 |
34 | - name: Cache mathlib API docs
35 | uses: actions/cache@v4
36 | with:
37 | path: |
38 | .lake/build/doc/Init
39 | .lake/build/doc/Lake
40 | .lake/build/doc/Lean
41 | .lake/build/doc/Std
42 | .lake/build/doc/Mathlib
43 | .lake/build/doc/declarations
44 | .lake/build/doc/find
45 | .lake/build/doc/*.*
46 | !.lake/build/doc/declarations/declaration-data-Poly*
47 | key: MathlibDoc-${{ hashFiles('lake-manifest.json') }}
48 | restore-keys: MathlibDoc-
49 |
50 | - name: Build project API documentation
51 | run: ~/.elan/bin/lake -R -Kenv=dev build Poly:docs
52 |
53 | - name: Check for `home_page` folder # this is meant to detect a Jekyll-based website
54 | id: check_home_page
55 | run: |
56 | if [ -d home_page ]; then
57 | echo "The 'home_page' folder exists in the repository."
58 | echo "HOME_PAGE_EXISTS=true" >> $GITHUB_ENV
59 | else
60 | echo "The 'home_page' folder does not exist in the repository."
61 | echo "HOME_PAGE_EXISTS=false" >> $GITHUB_ENV
62 | fi
63 |
64 | - name: Build blueprint and copy to `home_page/blueprint`
65 | uses: xu-cheng/texlive-action@v2
66 | with:
67 | docker_image: ghcr.io/xu-cheng/texlive-full:20231201
68 | run: |
69 | # Install necessary dependencies and build the blueprint
70 | apk update
71 | apk add --update make py3-pip git pkgconfig graphviz graphviz-dev gcc musl-dev
72 | git config --global --add safe.directory $GITHUB_WORKSPACE
73 | git config --global --add safe.directory `pwd`
74 | python3 -m venv env
75 | source env/bin/activate
76 | pip install --upgrade pip requests wheel
77 | pip install pygraphviz --global-option=build_ext --global-option="-L/usr/lib/graphviz/" --global-option="-R/usr/lib/graphviz/"
78 | pip install leanblueprint
79 | leanblueprint pdf
80 | mkdir -p home_page
81 | cp blueprint/print/print.pdf home_page/blueprint.pdf
82 | leanblueprint web
83 | cp -r blueprint/web home_page/blueprint
84 |
85 | - name: Check declarations mentioned in the blueprint exist in Lean code
86 | run: |
87 | ~/.elan/bin/lake exe checkdecls blueprint/lean_decls
88 |
89 | - name: Copy API documentation to `home_page/docs`
90 | run: cp -r .lake/build/doc home_page/docs
91 |
92 | - name: Remove unnecessary lake files from documentation in `home_page/docs`
93 | run: |
94 | find home_page/docs -name "*.trace" -delete
95 | find home_page/docs -name "*.hash" -delete
96 |
97 | - name: Bundle dependencies
98 | uses: ruby/setup-ruby@v1
99 | with:
100 | working-directory: home_page
101 | ruby-version: "3.0" # Specify Ruby version
102 | bundler-cache: true # Enable caching for bundler
103 |
104 | - name: Build website using Jekyll
105 | if: env.HOME_PAGE_EXISTS == 'true'
106 | working-directory: home_page
107 | run: JEKYLL_ENV=production bundle exec jekyll build # Note this will also copy the blueprint and API doc into home_page/_site
108 |
109 | - name: "Upload website (API documentation, blueprint and any home page)"
110 | uses: actions/upload-pages-artifact@v3
111 | with:
112 | path: ${{ env.HOME_PAGE_EXISTS == 'true' && 'home_page/_site' || 'home_page/' }}
113 |
114 | - name: Deploy to GitHub Pages
115 | id: deployment
116 | uses: actions/deploy-pages@v4
117 |
118 | - name: Make sure the API documentation cache works
119 | run: mv home_page/docs .lake/build/doc
120 |
--------------------------------------------------------------------------------
/.github/workflows/push.yml:
--------------------------------------------------------------------------------
1 | on:
2 | push:
3 | branches:
4 | - master
5 |
6 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
7 | permissions:
8 | contents: read
9 | pages: write
10 | id-token: write
11 |
12 | jobs:
13 | style_lint:
14 | name: Lint style
15 | runs-on: ubuntu-latest
16 | steps:
17 | - name: Check for long lines
18 | if: always()
19 | run: |
20 | ! (find Poly -name "*.lean" -type f -exec grep -E -H -n '^.{101,}$' {} \; | grep -v -E 'https?://')
21 |
22 | - name: Don't 'import Mathlib', use precise imports
23 | if: always()
24 | run: |
25 | ! (find Poly -name "*.lean" -type f -print0 | xargs -0 grep -E -n '^import Mathlib$')
26 |
27 | build_project:
28 | runs-on: ubuntu-latest
29 | name: Build project
30 | steps:
31 | - name: Checkout project
32 | uses: actions/checkout@v2
33 | with:
34 | fetch-depth: 0
35 |
36 | - name: Install elan
37 | run: curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none
38 |
39 | - name: Get cache
40 | run: ~/.elan/bin/lake exe cache get || true
41 |
42 | - name: Build project
43 | run: ~/.elan/bin/lake build Poly
44 |
45 | # - name: Cache mathlib docs
46 | # uses: actions/cache@v3
47 | # with:
48 | # path: |
49 | # .lake/build/doc/Init
50 | # .lake/build/doc/Lake
51 | # .lake/build/doc/Lean
52 | # .lake/build/doc/Std
53 | # .lake/build/doc/Mathlib
54 | # .lake/build/doc/declarations
55 | # !.lake/build/doc/declarations/declaration-data-Poly*
56 | # key: MathlibDoc-${{ hashFiles('lake-manifest.json') }}
57 | # restore-keys: |
58 | # MathlibDoc-
--------------------------------------------------------------------------------
/.github/workflows/push_pr.yml:
--------------------------------------------------------------------------------
1 | on:
2 | pull_request:
3 |
4 | jobs:
5 | build_project:
6 | runs-on: ubuntu-latest
7 | name: Build project
8 | steps:
9 | - name: Checkout project
10 | uses: actions/checkout@v2
11 | with:
12 | fetch-depth: 0
13 |
14 | - name: Install elan
15 | run: curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain leanprover/lean4:4.0.0
16 |
17 | - name: Get cache
18 | run: ~/.elan/bin/lake exe cache get
19 |
20 | - name: Build project
21 | run: ~/.elan/bin/lake build Poly
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## macOS
2 | .DS_Store
3 | ## Lake
4 | .lake/*
5 | .cache/*
6 | ## Python
7 | __pycache__
8 | venv
9 | ## Blueprint
10 | blueprint/web/
11 | blueprint/src/chapter/auto
12 | blueprint/lean_decls
13 | blueprint/print/
14 | ## Docs
15 | docs/_includes/sorries.md
16 | ## TeX
17 | *.paux
18 | *.aux
19 | *.lof
20 | *.log
21 | *.lot
22 | *.fls
23 | *.out
24 | *.toc
25 | *.fmt
26 | *.fot
27 | *.cb
28 | *.cb2
29 | .*.lb
30 | *.bbl
31 | *.bcf
32 | *.blg
33 | *-blx.aux
34 | *-blx.bib
35 | *.run.xml
36 | *.fdb_latexmk
37 | *.synctex
38 | *.synctex(busy)
39 | *.synctex.gz
40 | *.synctex.gz(busy)
41 | *.pdfsync
42 | *.json
43 | *.auctex-auto
44 |
45 | build/
46 | lake-packages/
47 | .lake/
48 | **/.DS_Store
49 | *_Sina
50 | **/*_Sina
51 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.insertSpaces": true,
3 | "editor.tabSize": 2,
4 | "editor.rulers" : [100],
5 | "files.encoding": "utf8",
6 | "files.eol": "\n",
7 | "files.insertFinalNewline": true,
8 | "files.trimFinalNewlines": true,
9 | "files.trimTrailingWhitespace": true
10 | }
11 |
--------------------------------------------------------------------------------
/Notes/HowNameSpacesWorkInLean.lean:
--------------------------------------------------------------------------------
1 | def bar : Nat := 3
2 |
3 | namespace Foo
4 |
5 | def bar : Nat := 0
6 |
7 | def baz : Nat := 1
8 |
9 | end Foo
10 |
11 |
12 | -- #check baz -- fails because `baz` is not in the root namespace
13 |
14 | section annonymous1
15 |
16 | #check bar
17 |
18 | #check Foo.bar
19 |
20 | #eval bar -- evaluates to 3
21 |
22 | #eval Foo.bar -- evaluates to 0
23 |
24 | #check Foo.baz
25 |
26 | -- or first open `Foo` in this section and then access `bar` and `baz` in it
27 |
28 | open Foo
29 |
30 | #check bar -- this is `Foo.bar`
31 |
32 | #check _root_.bar -- this is the root `bar` defined in the first line of this file outside the namespace `Foo`.
33 |
34 | -- #eval bar -- ambiguous, possible interpretations ` _root_.bar : Nat` and ` Foo.bar : Nat`.
35 |
36 | #eval _root_.bar -- evaluates to 3
37 |
38 | #eval Foo.bar -- evaluates to 0
39 |
40 | #check baz
41 |
42 | end annonymous1
43 |
44 |
45 |
46 |
47 |
48 | section annonymous2
49 |
50 | -- open `Foo` but only access `bar` in it
51 | open Foo (bar)
52 |
53 | #check bar -- works
54 |
55 | #check baz -- fails
56 |
57 | end annonymous2
58 |
59 |
60 | section annonymous3
61 |
62 | open Foo hiding bar
63 |
64 | #check bar -- fails
65 |
66 | #check baz -- works
67 |
68 |
69 |
70 |
71 | end annonymous3
72 |
73 |
74 | section annonymous4
75 |
76 | open Foo in
77 | #check bar
78 |
79 | -- #check baz -- fails because `Foo` was opened only for `bar`.
80 |
81 | end annonymous4
82 |
83 |
84 | namespace Foo
85 |
86 | -- introducing a new namespace `Qux` inside `Foo`
87 |
88 | namespace Qux
89 |
90 | def quux : Nat := 2
91 |
92 | end Qux
93 |
94 | end Foo
95 |
96 | #check Foo.Qux.quux
97 |
98 |
99 | section annonymous5
100 |
101 | --#check Foo.quux -- fails because `quux` is in `Foo.Qux` namespace
102 |
103 | open Foo.Qux
104 |
105 | #check quux
106 |
107 | end annonymous5
108 |
--------------------------------------------------------------------------------
/Poly.lean:
--------------------------------------------------------------------------------
1 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.Basic
2 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.BeckChevalley
3 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.Distributivity
4 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.Presheaf
5 | -- import Poly.LCCC.BeckChevalley
6 | -- import Poly.LCCC.Presheaf
7 | -- import Poly.Type.Univariate
8 | -- import Poly.Exponentiable
9 | import Poly.UvPoly.Basic
10 | import Poly.MvPoly.Basic
11 |
--------------------------------------------------------------------------------
/Poly/Bifunctor/Basic.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Wojciech Nawrocki. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Wojciech Nawrocki
5 | -/
6 | import Mathlib.CategoryTheory.Adjunction.Basic
7 |
8 | import Poly.ForMathlib.CategoryTheory.NatIso
9 | import Poly.ForMathlib.CategoryTheory.Types
10 |
11 | /-! ## Composition of bifunctors -/
12 |
13 | namespace CategoryTheory.Functor
14 |
15 | variable {𝒞 𝒟' 𝒟 ℰ : Type*} [Category 𝒞] [Category 𝒟'] [Category 𝒟] [Category ℰ]
16 |
17 | /-- Precompose a bifunctor in the second argument.
18 | Note that `G ⋙₂ F ⋙ P = F ⋙ G ⋙₂ P` definitionally. -/
19 | @[simps]
20 | def comp₂ (F : 𝒟' ⥤ 𝒟) (P : 𝒞 ⥤ 𝒟 ⥤ ℰ) : 𝒞 ⥤ 𝒟' ⥤ ℰ where
21 | obj Γ := F ⋙ P.obj Γ
22 | map f := whiskerLeft F (P.map f)
23 |
24 | @[inherit_doc]
25 | scoped [CategoryTheory] infixr:80 " ⋙₂ " => Functor.comp₂
26 |
27 | @[simp]
28 | theorem comp_comp₂ {𝒟'' : Type*} [Category 𝒟'']
29 | (F : 𝒟'' ⥤ 𝒟') (G : 𝒟' ⥤ 𝒟) (P : 𝒞 ⥤ 𝒟 ⥤ ℰ) :
30 | (F ⋙ G) ⋙₂ P = F ⋙₂ (G ⋙₂ P) := by
31 | rfl
32 |
33 | /-- Composition with `F,G` ordered like the arguments of `P` is considered `simp`ler. -/
34 | @[simp]
35 | theorem comp₂_comp {𝒞' : Type*} [Category 𝒞']
36 | (F : 𝒞' ⥤ 𝒞) (G : 𝒟' ⥤ 𝒟) (P : 𝒞 ⥤ 𝒟 ⥤ ℰ) :
37 | G ⋙₂ (F ⋙ P) = F ⋙ (G ⋙₂ P) := by
38 | rfl
39 |
40 | @[simps!]
41 | def comp₂_iso {F₁ F₂ : 𝒟' ⥤ 𝒟} {P₁ P₂ : 𝒞 ⥤ 𝒟 ⥤ ℰ}
42 | (i : F₁ ≅ F₂) (j : P₁ ≅ P₂) : F₁ ⋙₂ P₁ ≅ F₂ ⋙₂ P₂ :=
43 | NatIso.ofComponents₂ (fun C D => (j.app C).app (F₁.obj D) ≪≫ (P₂.obj C).mapIso (i.app D))
44 | (fun _ _ => by simp [NatTrans.naturality_app_assoc])
45 | (fun C f => by
46 | have := congr_arg (P₂.obj C).map (i.hom.naturality f)
47 | simp only [map_comp] at this
48 | simp [this])
49 |
50 | @[simps!]
51 | def comp₂_isoWhiskerLeft {P₁ P₂ : 𝒞 ⥤ 𝒟 ⥤ ℰ} (F : 𝒟' ⥤ 𝒟) (i : P₁ ≅ P₂) :
52 | F ⋙₂ P₁ ≅ F ⋙₂ P₂ :=
53 | comp₂_iso (Iso.refl F) i
54 |
55 | @[simps!]
56 | def comp₂_isoWhiskerRight {F₁ F₂ : 𝒟' ⥤ 𝒟} (i : F₁ ≅ F₂) (P : 𝒞 ⥤ 𝒟 ⥤ ℰ) :
57 | F₁ ⋙₂ P ≅ F₂ ⋙₂ P :=
58 | comp₂_iso i (Iso.refl P)
59 |
60 | end CategoryTheory.Functor
61 |
62 | /-! ## Natural isomorphisms of bifunctors -/
63 |
64 | namespace CategoryTheory
65 | universe v u
66 | variable {𝒞 : Type u} [Category.{v} 𝒞]
67 | variable {𝒟 : Type*} [Category 𝒟]
68 |
69 | namespace coyoneda
70 |
71 | theorem comp₂_naturality₂_left (F : 𝒟 ⥤ 𝒞) (P : 𝒞ᵒᵖ ⥤ 𝒟 ⥤ Type v)
72 | (i : F ⋙₂ coyoneda (C := 𝒞) ⟶ P) (X Y : 𝒞) (Z : 𝒟) (f : X ⟶ Y) (g : Y ⟶ F.obj Z) :
73 | -- The `op`s really are a pain. Why can't they be definitional like in Lean 3 :(
74 | (i.app <| .op X).app Z (f ≫ g) = (P.map f.op).app Z ((i.app <| .op Y).app Z g) := by
75 | simp [← FunctorToTypes.naturality₂_left]
76 |
77 | theorem comp₂_naturality₂_right (F : 𝒟 ⥤ 𝒞) (P : 𝒞ᵒᵖ ⥤ 𝒟 ⥤ Type v)
78 | (i : F ⋙₂ coyoneda (C := 𝒞) ⟶ P) (X : 𝒞) (Y Z : 𝒟) (f : X ⟶ F.obj Y) (g : Y ⟶ Z) :
79 | (i.app <| .op X).app Z (f ≫ F.map g) = (P.obj <| .op X).map g ((i.app <| .op X).app Y f) := by
80 | simp [← FunctorToTypes.naturality₂_right]
81 |
82 | end coyoneda
83 |
84 | namespace Adjunction
85 |
86 | variable {𝒟 : Type*} [Category 𝒟]
87 |
88 | /-- For `F ⊣ G`, `𝒟(FX, Y) ≅ 𝒞(X, GY)`. -/
89 | def coyoneda_iso {F : 𝒞 ⥤ 𝒟} {G : 𝒟 ⥤ 𝒞} (A : F ⊣ G) :
90 | F.op ⋙ coyoneda (C := 𝒟) ≅ G ⋙₂ coyoneda (C := 𝒞) :=
91 | NatIso.ofComponents₂ (fun C D => Equiv.toIso <| A.homEquiv C.unop D)
92 | (fun _ _ => by ext : 1; simp [A.homEquiv_naturality_left])
93 | (fun _ _ => by ext : 1; simp [A.homEquiv_naturality_right])
94 |
95 | end Adjunction
96 | end CategoryTheory
97 |
--------------------------------------------------------------------------------
/Poly/Bifunctor/Sigma.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Wojciech Nawrocki. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Wojciech Nawrocki
5 | -/
6 | import Mathlib.CategoryTheory.Comma.Over.Basic
7 | import Mathlib.CategoryTheory.Functor.Currying
8 |
9 | import SEq.Tactic.DepRewrite
10 |
11 | import Poly.ForMathlib.CategoryTheory.Elements
12 | import Poly.ForMathlib.CategoryTheory.Comma.Over.Basic
13 | import Poly.Bifunctor.Basic
14 |
15 | /-! ## Dependent sums of functors -/
16 |
17 | namespace CategoryTheory.Functor
18 |
19 | universe w v u t s r
20 |
21 | variable {𝒞 : Type t} [Category.{u} 𝒞] {𝒟 : Type r} [Category.{s} 𝒟]
22 |
23 | /-- Given functors `F : 𝒞 ⥤ Type v` and `G : ∫F ⥤ 𝒟 ⥤ Type v`,
24 | produce the functor `(C, D) ↦ (a : F(C)) × G((C, a))(D)`.
25 |
26 | This is a dependent sum that varies naturally
27 | in a parameter `C` of the first component,
28 | and a parameter `D` of the second component.
29 |
30 | We use this to package and compose natural equivalences
31 | where one side (or both) is a dependent sum, e.g.
32 | ```
33 | H(C) ⟶ I(D)
34 | =========================
35 | (a : F(C)) × (G(C, a)(D))
36 | ```
37 | is a natural isomorphism of bifunctors `𝒞ᵒᵖ ⥤ 𝒟 ⥤ Type v`
38 | given by `(C, D) ↦ H(C) ⟶ I(D)` and `G.Sigma`. -/
39 | @[simps!]
40 | /- Q: Is it necessary to special-case bifunctors?
41 | (1) General case `G : F.Elements ⥤ Type v` needs
42 | a functor `F'` s.t. `F'.Elements ≅ F.Elements × 𝒟`; very awkward.
43 | (2) General case `F : 𝒞 ⥤ 𝒟`, `G : ∫F ⥤ 𝒟`:
44 | - what conditions are needed on `𝒟` for `∫F` to make sense?
45 | - what about for `ΣF. G : 𝒞 ⥤ 𝒟` to make sense?
46 | - known concrete instances are `𝒟 ∈ {Type, Cat, Grpd}` -/
47 | def Sigma {F : 𝒞 ⥤ Type w} (G : F.Elements ⥤ 𝒟 ⥤ Type v) : 𝒞 ⥤ 𝒟 ⥤ Type (max w v) := by
48 | refine curry.obj {
49 | obj := fun (C, D) => (a : F.obj C) × (G.obj ⟨C, a⟩).obj D
50 | map := fun (f, g) ⟨a, b⟩ =>
51 | ⟨F.map f a, (G.map ⟨f, rfl⟩).app _ ((G.obj ⟨_, a⟩).map g b)⟩
52 | map_id := ?_
53 | map_comp := ?_
54 | } <;> {
55 | intros
56 | ext ⟨a, b⟩ : 1
57 | dsimp
58 | congr! 1 with h
59 | . simp
60 | . rw! [h]; simp [FunctorToTypes.naturality]
61 | }
62 |
63 | def Sigma.isoCongrLeft {F₁ F₂ : 𝒞 ⥤ Type w}
64 | /- Q: What kind of map `F₂.Elements ⥤ F₁.Elements`
65 | could `NatTrans.mapElements i.hom` generalize to?
66 | We need to send `x ∈ F₂(C)` to something in `F₁(C)`;
67 | so maybe the map has to at least be over `𝒞`. -/
68 | (G : F₁.Elements ⥤ 𝒟 ⥤ Type v) (i : F₂ ≅ F₁) :
69 | Sigma (NatTrans.mapElements i.hom ⋙ G) ≅ Sigma G := by
70 | refine NatIso.ofComponents₂
71 | (fun C D => Equiv.toIso {
72 | toFun := fun ⟨a, b⟩ => ⟨i.hom.app C a, b⟩
73 | invFun := fun ⟨a, b⟩ => ⟨i.inv.app C a, cast (by simp) b⟩
74 | left_inv := fun ⟨_, _⟩ => by simp
75 | right_inv := fun ⟨_, _⟩ => by simp
76 | }) ?_ ?_ <;> {
77 | intros
78 | ext : 1
79 | dsimp
80 | apply have h := ?_; Sigma.ext h ?_
81 | . simp [FunctorToTypes.naturality]
82 | . dsimp [Sigma] at h ⊢
83 | rw! [← h]
84 | simp [NatTrans.mapElements]
85 | }
86 |
87 | def Sigma.isoCongrRight {F : 𝒞 ⥤ Type w} {G₁ G₂ : F.Elements ⥤ 𝒟 ⥤ Type v} (i : G₁ ≅ G₂) :
88 | Sigma G₁ ≅ Sigma G₂ := by
89 | refine NatIso.ofComponents₂
90 | (fun C D => Equiv.toIso {
91 | toFun := fun ⟨a, b⟩ => ⟨a, (i.hom.app ⟨C, a⟩).app D b⟩
92 | invFun := fun ⟨a, b⟩ => ⟨a, (i.inv.app ⟨C, a⟩).app D b⟩
93 | left_inv := fun ⟨_, _⟩ => by simp
94 | right_inv := fun ⟨_, _⟩ => by simp
95 | }) ?_ ?_ <;> {
96 | intros
97 | ext : 1
98 | dsimp
99 | apply have h := ?_; Sigma.ext h ?_
100 | . simp
101 | . dsimp [Sigma] at h ⊢
102 | simp [FunctorToTypes.naturality₂_left, FunctorToTypes.naturality₂_right]
103 | }
104 |
105 | theorem comp₂_Sigma {𝒟' : Type*} [Category 𝒟']
106 | {F : 𝒞 ⥤ Type w} (G : 𝒟' ⥤ 𝒟) (P : F.Elements ⥤ 𝒟 ⥤ Type v) :
107 | G ⋙₂ Sigma P = Sigma (G ⋙₂ P) := by
108 | apply Functor.hext
109 | . intro C
110 | apply Functor.hext
111 | . intro; simp
112 | . intros
113 | apply heq_of_eq
114 | ext : 1
115 | apply Sigma.ext <;> simp
116 | . intros
117 | apply heq_of_eq
118 | ext : 3
119 | apply Sigma.ext <;> simp
120 |
121 | end CategoryTheory.Functor
122 |
123 | /-! ## Over categories -/
124 |
125 | namespace CategoryTheory.Over
126 |
127 | universe v u
128 | variable {𝒞 : Type u} [Category.{v} 𝒞]
129 |
130 | -- Q: is this in mathlib?
131 | @[simps]
132 | def equiv_Sigma {A : 𝒞} (X : 𝒞) (U : Over A) : (X ⟶ U.left) ≃ (b : X ⟶ A) × (Over.mk b ⟶ U) where
133 | toFun g := ⟨g ≫ U.hom, Over.homMk g rfl⟩
134 | invFun p := p.snd.left
135 | left_inv _ := by simp
136 | right_inv := fun _ => by
137 | dsimp; congr! 1 with h
138 | . simp
139 | . rw! [h]; simp
140 |
141 | @[simps]
142 | def equivalence_Elements (A : 𝒞) : (yoneda.obj A).Elements ≌ (Over A)ᵒᵖ where
143 | functor := {
144 | obj := fun x => .op <| Over.mk x.snd
145 | map := fun f => .op <| Over.homMk f.val.unop (by simpa using f.property)
146 | }
147 | inverse := {
148 | obj := fun U => ⟨.op U.unop.left, U.unop.hom⟩
149 | map := fun f => ⟨.op f.unop.left, by simp⟩
150 | }
151 | unitIso := NatIso.ofComponents Iso.refl (by simp)
152 | counitIso := NatIso.ofComponents Iso.refl
153 | -- TODO: `simp` fails to unify `id_comp`/`comp_id`
154 | (fun f => by simp [Category.comp_id f, Category.id_comp f])
155 |
156 | /-- For `X ∈ 𝒞` and `f ∈ 𝒞/A`, `𝒞(X, Over.forget f) ≅ Σ(g: X ⟶ A), 𝒞/A(g, f)`. -/
157 | def forget_iso_Sigma (A : 𝒞) :
158 | Over.forget A ⋙₂ coyoneda (C := 𝒞) ≅
159 | Functor.Sigma ((equivalence_Elements A).functor ⋙ coyoneda (C := Over A)) := by
160 | refine NatIso.ofComponents₂ (fun X U => Equiv.toIso <| equiv_Sigma X.unop U) ?_ ?_
161 | . intros X Y U f
162 | ext : 1
163 | dsimp
164 | apply have h := ?_; Sigma.ext h ?_
165 | . simp
166 | . dsimp at h ⊢
167 | rw! [h]
168 | simp
169 | . intros X Y U f
170 | ext : 1
171 | dsimp
172 | apply have h := ?_; Sigma.ext h ?_
173 | . simp
174 | . dsimp at h ⊢
175 | rw! [h]
176 | apply heq_of_eq
177 | ext : 1
178 | simp
179 |
180 | end CategoryTheory.Over
181 |
182 | #min_imports
183 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/Comma/Over/Basic.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour, Wojciech Nawrocki
5 | -/
6 | import Mathlib.CategoryTheory.Comma.Over.Basic
7 | import Mathlib.CategoryTheory.Comma.StructuredArrow.Basic
8 | import Mathlib.CategoryTheory.Category.Cat
9 |
10 | namespace CategoryTheory
11 |
12 | -- morphism levels before object levels. See note [CategoryTheory universes].
13 | universe v₁ v₂ v₃ u₁ u₂ u₃
14 |
15 | variable {T : Type u₁} [Category.{v₁} T]
16 |
17 | namespace Over
18 |
19 | @[simp]
20 | theorem mk_eta {X : T} (U : Over X) : mk U.hom = U := by
21 | rfl
22 |
23 | /-- A variant of `homMk_comp` that can trigger in `simp`. -/
24 | @[simp]
25 | lemma homMk_comp' {X Y Z W : T} (f : X ⟶ Y) (g : Y ⟶ Z) (h : Z ⟶ W) (fgh_comp) :
26 | homMk (U := mk (f ≫ g ≫ h)) (f ≫ g) fgh_comp =
27 | homMk f ≫ homMk (U := mk (g ≫ h)) (V := mk h) g :=
28 | rfl
29 |
30 | @[simp]
31 | lemma homMk_comp'_assoc {X Y Z W : T} (f : X ⟶ Y) (g : Y ⟶ Z) (h : Z ⟶ W) (fgh_comp) :
32 | homMk (U := mk ((f ≫ g) ≫ h)) (f ≫ g) fgh_comp =
33 | homMk f ≫ homMk (U := mk (g ≫ h)) (V := mk h) g := by
34 | rfl
35 |
36 | @[simp]
37 | lemma homMk_id {X B : T} (f : X ⟶ B) (h : 𝟙 X ≫ f = f) : homMk (𝟙 X) h = 𝟙 (mk f) :=
38 | rfl
39 |
40 | /-- `Over.Sigma Y U` is a shorthand for `(Over.map Y.hom).obj U`.
41 | This is a category-theoretic analogue of `Sigma` for types. -/
42 | abbrev Sigma {X : T} (Y : Over X) (U : Over (Y.left)) : Over X :=
43 | (map Y.hom).obj U
44 |
45 | namespace Sigma
46 |
47 | variable {X : T}
48 |
49 | lemma hom {Y : Over X} (Z : Over (Y.left)) : (Sigma Y Z).hom = Z.hom ≫ Y.hom := map_obj_hom
50 |
51 | /-- `Σ_ ` is functorial in the second argument. -/
52 | def map {Y : Over X} {Z Z' : Over (Y.left)} (g : Z ⟶ Z') : (Sigma Y Z) ⟶ (Sigma Y Z') :=
53 | (Over.map Y.hom).map g
54 |
55 | @[simp]
56 | lemma map_left {Y : Over X} {Z Z' : Over (Y.left)} {g : Z ⟶ Z'} :
57 | ((Over.map Y.hom).map g).left = g.left := Over.map_map_left
58 |
59 | lemma map_homMk_left {Y : Over X} {Z Z' : Over (Y.left)} {g : Z ⟶ Z'} :
60 | map g = (Over.homMk g.left : Sigma Y Z ⟶ Sigma Y Z') := by
61 | rfl
62 |
63 | /-- The first projection of the sigma object. -/
64 | @[simps!]
65 | def fst {Y : Over X} (Z : Over (Y.left)) : (Sigma Y Z) ⟶ Y := Over.homMk Z.hom
66 |
67 | @[simp]
68 | lemma map_comp_fst {Y : Over X} {Z Z' : Over (Y.left)} (g : Z ⟶ Z') :
69 | (Over.map Y.hom).map g ≫ fst Z' = fst Z := by
70 | ext
71 | simp [Sigma.fst, Over.w]
72 |
73 | /-- Promoting a morphism `g : Σ_Y Z ⟶ Σ_Y Z'` in `Over X` with `g ≫ fst Z' = fst Z`
74 | to a morphism `Z ⟶ Z'` in `Over (Y.left)`. -/
75 | def overHomMk {Y : Over X} {Z Z' : Over (Y.left)} (g : Sigma Y Z ⟶ Sigma Y Z')
76 | (w : g ≫ fst Z' = fst Z := by aesop_cat) : Z ⟶ Z' :=
77 | Over.homMk g.left (congr_arg CommaMorphism.left w)
78 |
79 | end Sigma
80 |
81 | end Over
82 |
83 | end CategoryTheory
84 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/Comma/Over/Sections.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour
5 | -/
6 | import Poly.ForMathlib.CategoryTheory.Comma.Over.Pullback
7 | import Mathlib.CategoryTheory.Closed.Cartesian
8 |
9 | /-!
10 | # The section functor as a right adjoint to the star functor
11 |
12 | We show that if `C` is cartesian closed then `star I : C ⥤ Over I`
13 | has a right adjoint `sectionsFunctor` whose object part is the object of sections
14 | of `X` over `I`.
15 |
16 | -/
17 |
18 | noncomputable section
19 |
20 | universe v₁ v₂ u₁ u₂
21 |
22 | namespace CategoryTheory
23 |
24 | open Category Limits MonoidalCategory CartesianClosed Adjunction Over
25 |
26 | variable {C : Type u₁} [Category.{v₁} C]
27 |
28 | attribute [local instance] hasBinaryProducts_of_hasTerminal_and_pullbacks
29 | attribute [local instance] hasFiniteProducts_of_has_binary_and_terminal
30 | attribute [local instance] ChosenFiniteProducts.ofFiniteProducts
31 | attribute [local instance] monoidalOfChosenFiniteProducts
32 |
33 | section
34 |
35 | variable [HasFiniteProducts C]
36 |
37 | /-- The isomorphism between `X ⨯ Y` and `X ⊗ Y` for objects `X` and `Y` in `C`.
38 | This is tautological by the definition of the cartesian monoidal structure on `C`.
39 | This isomorphism provides an interface between `prod.fst` and `ChosenFiniteProducts.fst`
40 | as well as between `prod.map` and `tensorHom`. -/
41 | def prodIsoTensorObj (X Y : C) : X ⨯ Y ≅ X ⊗ Y := Iso.refl _
42 |
43 | @[reassoc (attr := simp)]
44 | theorem prodIsoTensorObj_inv_fst {X Y : C} :
45 | (prodIsoTensorObj X Y).inv ≫ prod.fst = ChosenFiniteProducts.fst X Y :=
46 | Category.id_comp _
47 |
48 | @[reassoc (attr := simp)]
49 | theorem prodIsoTensorObj_inv_snd {X Y : C} :
50 | (prodIsoTensorObj X Y).inv ≫ prod.snd = ChosenFiniteProducts.snd X Y :=
51 | Category.id_comp _
52 |
53 | @[reassoc (attr := simp)]
54 | theorem prodIsoTensorObj_hom_fst {X Y : C} :
55 | (prodIsoTensorObj X Y).hom ≫ ChosenFiniteProducts.fst X Y = prod.fst :=
56 | Category.id_comp _
57 |
58 | @[reassoc (attr := simp)]
59 | theorem prodIsoTensorObj_hom_snd {X Y : C} :
60 | (prodIsoTensorObj X Y).hom ≫ ChosenFiniteProducts.snd X Y = prod.snd :=
61 | Category.id_comp _
62 |
63 | @[reassoc (attr := simp)]
64 | theorem prodMap_comp_prodIsoTensorObj_hom {X Y Z W : C} (f : X ⟶ Y) (g : Z ⟶ W) :
65 | prod.map f g ≫ (prodIsoTensorObj _ _).hom = (prodIsoTensorObj _ _).hom ≫ (f ⊗ g) := by
66 | apply ChosenFiniteProducts.hom_ext <;> simp
67 |
68 | end
69 |
70 | variable [HasTerminal C] [HasPullbacks C]
71 |
72 | variable (I : C) [Exponentiable I]
73 |
74 | /-- The first leg of a cospan constructing a pullback diagram in `C` used to define `sections` . -/
75 | def curryId : ⊤_ C ⟶ (I ⟹ I) :=
76 | CartesianClosed.curry (ChosenFiniteProducts.fst I (⊤_ C))
77 |
78 | variable {I}
79 |
80 | namespace Over
81 |
82 | /-- Given `X : Over I`, `sectionsObj X` is the object of sections of `X` defined by the following
83 | pullback diagram:
84 |
85 | ```
86 | sections X --> I ⟹ X
87 | | |
88 | | |
89 | v v
90 | ⊤_ C ----> I ⟹ I
91 | ```-/
92 | abbrev sectionsObj (X : Over I) : C :=
93 | Limits.pullback (curryId I) ((exp I).map X.hom)
94 |
95 | /-- The functoriality of `sectionsObj`. -/
96 | def sectionsMap {X X' : Over I} (u : X ⟶ X') :
97 | sectionsObj X ⟶ sectionsObj X' := by
98 | fapply pullback.map
99 | · exact 𝟙 _
100 | · exact (exp I).map u.left
101 | · exact 𝟙 _
102 | · simp only [comp_id, id_comp]
103 | · simp only [comp_id, ← Functor.map_comp, w]
104 |
105 | @[simp]
106 | lemma sectionsMap_id {X : Over I} : sectionsMap (𝟙 X) = 𝟙 _ := by
107 | apply pullback.hom_ext
108 | · aesop
109 | · simp [sectionsMap]
110 |
111 | @[simp]
112 | lemma sectionsMap_comp {X X' X'' : Over I} (u : X ⟶ X') (v : X' ⟶ X'') :
113 | sectionsMap (u ≫ v) = sectionsMap u ≫ sectionsMap v := by
114 | apply pullback.hom_ext
115 | · aesop
116 | · simp [sectionsMap]
117 |
118 | variable (I)
119 |
120 | /-- The functor mapping an object `X` in `C` to the object of sections of `X` over `I`. -/
121 | @[simps]
122 | def sections :
123 | Over I ⥤ C where
124 | obj X := sectionsObj X
125 | map u := sectionsMap u
126 |
127 | variable {I}
128 |
129 | /-- An auxiliary morphism used to define the currying of a morphism in `Over I` to a morphism
130 | in `C`. See `sectionsCurry`. -/
131 | def sectionsCurryAux {X : Over I} {A : C} (u : (star I).obj A ⟶ X) :
132 | A ⟶ (I ⟹ X.left) :=
133 | CartesianClosed.curry (u.left)
134 |
135 | /-- The currying operation `Hom ((star I).obj A) X → Hom A (I ⟹ X.left)`. -/
136 | def sectionsCurry {X : Over I} {A : C} (u : (star I).obj A ⟶ X) :
137 | A ⟶ (sections I).obj X := by
138 | apply pullback.lift (terminal.from A)
139 | (CartesianClosed.curry ((prodIsoTensorObj _ _).inv ≫ u.left)) (uncurry_injective _)
140 | rw [uncurry_natural_left]
141 | simp [curryId, uncurry_natural_right, uncurry_curry]
142 |
143 | /-- The uncurrying operation `Hom A (section X) → Hom ((star I).obj A) X`. -/
144 | def sectionsUncurry {X : Over I} {A : C} (v : A ⟶ (sections I).obj X) :
145 | (star I).obj A ⟶ X := by
146 | let v₂ : A ⟶ (I ⟹ X.left) := v ≫ pullback.snd ..
147 | have w : terminal.from A ≫ (curryId I) = v₂ ≫ (exp I).map X.hom := by
148 | rw [IsTerminal.hom_ext terminalIsTerminal (terminal.from A ) (v ≫ (pullback.fst ..))]
149 | simp [v₂, pullback.condition]
150 | dsimp [curryId] at w
151 | have w' := homEquiv_naturality_right_square (F := MonoidalCategory.tensorLeft I)
152 | (adj := exp.adjunction I) _ _ _ _ w
153 | simp [CartesianClosed.curry] at w'
154 | refine Over.homMk ((prodIsoTensorObj I A).hom ≫ CartesianClosed.uncurry v₂) ?_
155 | · dsimp [CartesianClosed.uncurry] at *
156 | rw [Category.assoc, ← w']
157 | simp [star_obj_hom]
158 |
159 | @[simp]
160 | theorem sections_curry_uncurry {X : Over I} {A : C} {v : A ⟶ (sections I).obj X} :
161 | sectionsCurry (sectionsUncurry v) = v := by
162 | dsimp [sectionsCurry, sectionsUncurry]
163 | let v₂ : A ⟶ (I ⟹ X.left) := v ≫ pullback.snd _ _
164 | apply pullback.hom_ext
165 | · simp
166 | rw [IsTerminal.hom_ext terminalIsTerminal (terminal.from A ) (v ≫ (pullback.fst ..))]
167 | · simp
168 |
169 | @[simp]
170 | theorem sections_uncurry_curry {X : Over I} {A : C} {u : (star I).obj A ⟶ X} :
171 | sectionsUncurry (sectionsCurry u) = u := by
172 | dsimp [sectionsCurry, sectionsUncurry]
173 | ext
174 | simp
175 |
176 | /-- An auxiliary definition which is used to define the adjunction between the star functor
177 | and the sections functor. See starSectionsAdjunction`. -/
178 | def coreHomEquiv : CoreHomEquiv (star I) (sections I) where
179 | homEquiv A X := {
180 | toFun := sectionsCurry
181 | invFun := sectionsUncurry
182 | left_inv {u} := sections_uncurry_curry
183 | right_inv {v} := sections_curry_uncurry
184 | }
185 | homEquiv_naturality_left_symm := by
186 | intro A' A X g v
187 | dsimp [sectionsCurry, sectionsUncurry, curryId]
188 | simp only [star_map]
189 | rw [← Over.homMk_comp] -- note: in a newer version of mathlib this is `Over.homMk_eta`
190 | congr 1
191 | simp [CartesianClosed.uncurry_natural_left]
192 | homEquiv_naturality_right := by
193 | intro A X' X u g
194 | dsimp [sectionsCurry, sectionsUncurry, curryId]
195 | apply pullback.hom_ext (IsTerminal.hom_ext terminalIsTerminal _ _)
196 | simp [sectionsMap, curryId]
197 | rw [← CartesianClosed.curry_natural_right, Category.assoc]
198 |
199 | variable (I)
200 |
201 | /-- The adjunction between the star functor and the sections functor. -/
202 | @[simps! unit_app counit_app]
203 | def starSectionsAdj : star I ⊣ sections I :=
204 | .mkOfHomEquiv coreHomEquiv
205 |
206 | end Over
207 |
208 | end CategoryTheory
209 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/Elements.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Wojciech Nawrocki. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Wojciech Nawrocki
5 | -/
6 | import Mathlib.CategoryTheory.Elements
7 |
8 | namespace CategoryTheory.CategoryOfElements
9 |
10 | variable {𝒞 𝒟 : Type*} [Category 𝒞] [Category 𝒟]
11 | variable (F : 𝒞 ⥤ Type*) (G : F.Elements ⥤ 𝒟)
12 |
13 | -- FIXME(mathlib): `NatTrans.mapElements` and `CategoryOfElements.map` are the same thing
14 |
15 | @[simp]
16 | theorem map_homMk_id {X : 𝒞} (a : F.obj X) (eq : F.map (𝟙 X) a = a) :
17 | -- NOTE: without `α := X ⟶ X`, a bad discrimination tree key involving `⟨X, a⟩.1` is generated.
18 | G.map (Subtype.mk (α := X ⟶ X) (𝟙 X) eq) = 𝟙 (G.obj ⟨X, a⟩) :=
19 | show G.map (𝟙 _) = 𝟙 _ by simp
20 |
21 | @[simp]
22 | theorem map_homMk_comp {X Y Z : 𝒞} (f : X ⟶ Y) (g : Y ⟶ Z) (a : F.obj X) eq :
23 | G.map (Y := ⟨Z, F.map g (F.map f a)⟩) (Subtype.mk (α := X ⟶ Z) (f ≫ g) eq) =
24 | G.map (X := ⟨X, a⟩) (Y := ⟨Y, F.map f a⟩) (Subtype.mk (α := X ⟶ Y) f rfl) ≫
25 | G.map (Subtype.mk (α := Y ⟶ Z) g (by rfl)) := by
26 | set X : F.Elements := ⟨X, a⟩
27 | set Y : F.Elements := ⟨Y, F.map f a⟩
28 | set Z : F.Elements := ⟨Z, F.map g (F.map f a)⟩
29 | set f : X ⟶ Y := ⟨f, rfl⟩
30 | set g : Y ⟶ Z := ⟨g, rfl⟩
31 | show G.map (f ≫ g) = G.map f ≫ G.map g
32 | simp
33 |
34 | end CategoryTheory.CategoryOfElements
35 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/LocallyCartesianClosed/Distributivity.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour, Emily Riehl
5 | -/
6 | import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
7 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.Basic
8 | import Poly.ForMathlib.CategoryTheory.NatTrans
9 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.BeckChevalley
10 |
11 | /-!
12 | # Pentagon distributivity
13 |
14 | Given morphims `u : M ⟶ B` and `f : B ⟶ A`, consider the following commutative diagram where
15 | `v = Pi' f u` is the dependent product of `u` along `f`, `w` is the pullback of `v` along `f`,
16 | and `e` is the component of the counit of the adjunction `pullback f ⊣ pushforward f` at `u`:
17 | ```
18 | P ---g--> D
19 | e / | |
20 | M | w | v
21 | u \ | |
22 | B ---f--> A
23 | ```
24 |
25 | We construct a natural isomorphism
26 | `Over.map u ⋙ pushforward f ≅ pullback e ⋙ pushforward g ⋙ Over.map v`
27 | -/
28 |
29 | noncomputable section
30 | namespace CategoryTheory
31 |
32 | open Category Functor Adjunction Limits NatTrans Over ExponentiableMorphism Reindex
33 | LocallyCartesianClosed
34 |
35 | universe v u
36 |
37 | variable {C : Type u} [Category.{v} C] [HasPullbacks C] [HasFiniteWidePullbacks C]
38 | [LocallyCartesianClosed C]
39 |
40 | variable {A B M : C} (f : B ⟶ A) (u : M ⟶ B)
41 |
42 | abbrev v := Pi' f u
43 |
44 | abbrev P := Limits.pullback f (v f u) -- not really needed
45 |
46 | def g := pullback.fst (v f u) f -- (μ_ (Over.mk f) (Over.mk (v f u))).left --pullback.fst (@v _ _ _ _ _ _ _ f u) f
47 |
48 | /-- This should not be an instance because it's not usually how we want to construct
49 | exponentiable morphisms, we'll usually prove all morphims are exponential uniformly
50 | from LocallyCartesianClosed structure.
51 | The instance is inferred from the LocallyCartesianClosed structure, but
52 | we should prove this more generally without assuming the LCCC structure. -/
53 | def exponentiableMorphism : ExponentiableMorphism (g f u) := by infer_instance
54 |
55 | namespace ExponentiableMorphism
56 |
57 | /-- The pullback of exponentiable morphisms is exponentiable. -/
58 | def pullback {I J K : C} (f : I ⟶ J) (g : K ⟶ J)
59 | [gexp : ExponentiableMorphism g] :
60 | ExponentiableMorphism (pullback.fst f g ) :=
61 | sorry
62 |
63 | end ExponentiableMorphism
64 |
65 | def w := pullback.snd (v f u) f
66 |
67 | def e := ((ev f).app (Over.mk u)).left -- ev' (Over.mk f) (Over.mk u)
68 |
69 | /- On the way to prove `pentagonIso`.
70 | We show that the pasting of the 2-cells in below is an isomorphism.
71 | ```
72 | Δe Πg
73 | C/M ----> C/P ----> C/D
74 | | | |
75 | Σu | ↙ | Σw ≅ | Σv
76 | v v v
77 | C/B ---- C/B ----> C/A
78 | f
79 | ```
80 | 1. To do this we first prove that that the left cell is cartesian.
81 | 2. Then we observe the right cell is cartesian since it is an iso.
82 | 3. So the pasting is also cartesian.
83 | 4. The component of this 2-cell at the terminal object is an iso,
84 | so the 2-cell is an iso.
85 | -/
86 |
87 | def cellLeftTriangle : e f u ≫ u = w f u := by
88 | unfold e w v
89 | have := ((ev f).app (Over.mk u)).w
90 | aesop_cat
91 |
92 | def cellLeft : pullback (e f u) ⋙ map (w f u) ⟶ map u :=
93 | pullbackMapTriangle _ _ _ (cellLeftTriangle f u)
94 |
95 | lemma cellLeftCartesian : cartesian (cellLeft f u) := by
96 | unfold cartesian
97 | simp only [id_obj, mk_left, comp_obj, pullback_obj_left, Functor.comp_map]
98 | unfold cellLeft
99 | intros i j f'
100 | have α := pullbackMapTriangle (w f u) (e f u)
101 | simp only [id_obj, mk_left] at α u
102 | sorry
103 |
104 | def cellRightCommSq : CommSq (g f u) (w f u) (v f u) f :=
105 | IsPullback.toCommSq (IsPullback.of_hasPullback _ _)
106 |
107 | def cellRight' : pushforward (g f u) ⋙ map (v f u)
108 | ≅ map (w f u) ⋙ pushforward f := sorry
109 |
110 | lemma cellRightCartesian : cartesian (cellRight' f u).hom :=
111 | cartesian_of_isIso ((cellRight' f u).hom)
112 |
113 | def pasteCell1 : pullback (e f u) ⋙ pushforward (g f u) ⋙ map (v f u) ⟶
114 | pullback (e f u) ⋙ map (w f u) ⋙ pushforward f := by
115 | apply whiskerLeft
116 | exact (cellRight' f u).hom
117 |
118 | def pasteCell2 : (pullback (e f u) ⋙ map (w f u)) ⋙ pushforward f
119 | ⟶ (map u) ⋙ pushforward f := by
120 | apply whiskerRight
121 | exact cellLeft f u
122 |
123 | def pasteCell := pasteCell1 f u ≫ pasteCell2 f u
124 |
125 | def paste : cartesian (pasteCell f u) := by
126 | apply cartesian.comp
127 | · unfold pasteCell1
128 | apply cartesian.whiskerLeft (cellRightCartesian f u)
129 | · unfold pasteCell2
130 | apply cartesian.whiskerRight (cellLeftCartesian f u)
131 |
132 | #check pushforwardPullbackTwoSquare
133 |
134 | -- use `pushforwardPullbackTwoSquare` to construct this iso.
135 | def pentagonIso : map u ⋙ pushforward f ≅
136 | pullback (e f u) ⋙ pushforward (g f u) ⋙ map (v f u) := by
137 | have := cartesian_of_isPullback_to_terminal (pasteCell f u)
138 | letI : IsIso ((pasteCell f u).app (⊤_ Over ((𝟭 (Over B)).obj (Over.mk u)).left)) := sorry
139 | have := isIso_of_cartesian (pasteCell f u) (paste f u)
140 | exact (asIso (pasteCell f u)).symm
141 |
142 | end CategoryTheory
143 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/LocallyCartesianClosed/Presheaf.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyv (c) 2025 Sina Hazratpour. All vs reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Steve Awodey, Sina Hazratpour
5 | -/
6 |
7 | import Mathlib.CategoryTheory.Closed.Types
8 | import Mathlib.CategoryTheory.Limits.Constructions.Over.Basic
9 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.Basic
10 | import Mathlib.CategoryTheory.Closed.FunctorCategory.Basic
11 |
12 |
13 | noncomputable section
14 |
15 | namespace CategoryTheory
16 |
17 | open CategoryTheory Limits
18 |
19 | universe u v w
20 |
21 | abbrev Psh (C : Type u) [Category.{v} C] : Type (max u (v + 1)) := Cᵒᵖ ⥤ Type v
22 |
23 | variable {C : Type*} [SmallCategory C] [HasTerminal C]
24 |
25 | attribute [local instance] ChosenFiniteProducts.ofFiniteProducts
26 |
27 | instance cartesianClosedOver {C : Type u} [Category.{max u v} C] (P : Psh C) :
28 | CartesianClosed (Over P) :=
29 | cartesianClosedOfEquiv (overEquivPresheafCostructuredArrow P).symm
30 |
31 | instance locallyCartesianClosed : LocallyCartesianClosed (Psh C) := by
32 | infer_instance
33 |
34 | instance {X Y : Psh C} (f : X ⟶ Y) : ExponentiableMorphism f := by infer_instance
35 |
36 | end CategoryTheory
37 |
38 | end
39 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/NatIso.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Wojciech Nawrocki. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Wojciech Nawrocki
5 | -/
6 |
7 | import Mathlib.CategoryTheory.NatIso
8 |
9 | namespace CategoryTheory.NatIso
10 |
11 | variable {𝒞 𝒟 ℰ : Type*} [Category 𝒞] [Category 𝒟] [Category ℰ]
12 |
13 | /-- Natural isomorphism of bifunctors from naturality in both arguments. -/
14 | def ofComponents₂ {F G : 𝒞 ⥤ 𝒟 ⥤ ℰ}
15 | (app : ∀ Γ X, (F.obj Γ).obj X ≅ (G.obj Γ).obj X)
16 | (naturality₂_left : ∀ {Γ Δ : 𝒞} (X : 𝒟) (σ : Γ ⟶ Δ),
17 | (F.map σ).app X ≫ (app Δ X).hom = (app Γ X).hom ≫ (G.map σ).app X := by aesop_cat)
18 | (naturality₂_right : ∀ {X Y : 𝒟} (Γ : 𝒞) (f : X ⟶ Y),
19 | (F.obj Γ).map f ≫ (app Γ Y).hom = (app Γ X).hom ≫ (G.obj Γ).map f := by aesop_cat) :
20 | F ≅ G :=
21 | NatIso.ofComponents
22 | (fun Γ => NatIso.ofComponents (app Γ) (fun f => by simpa using naturality₂_right Γ f))
23 | (fun σ => by ext X : 2; simpa using naturality₂_left X σ)
24 |
25 | end CategoryTheory.NatIso
26 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/NatTrans.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour
5 | -/
6 |
7 | import Mathlib.CategoryTheory.NatTrans
8 | import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
9 |
10 | open CategoryTheory Limits IsPullback
11 |
12 | namespace CategoryTheory
13 |
14 | universe v' u' v u
15 |
16 | variable {J : Type v'} [Category.{u'} J] {C : Type u} [Category.{v} C]
17 | variable {K : Type*} [Category K] {D : Type*} [Category D]
18 |
19 | namespace NatTrans
20 |
21 | /-- A natural transformation is cartesian if every commutative square of the following form is
22 | a pullback.
23 | ```
24 | F(X) → F(Y)
25 | ↓ ↓
26 | G(X) → G(Y)
27 | ```
28 | -/
29 | def cartesian {F G : J ⥤ C} (α : F ⟶ G) : Prop :=
30 | ∀ ⦃i j : J⦄ (f : i ⟶ j), IsPullback (F.map f) (α.app i) (α.app j) (G.map f)
31 |
32 | theorem cartesian_of_isIso {F G : J ⥤ C} (α : F ⟶ G) [IsIso α] : cartesian α :=
33 | fun _ _ f => IsPullback.of_vert_isIso ⟨NatTrans.naturality _ f⟩
34 |
35 | theorem isIso_of_cartesian [HasTerminal J] {F G : J ⥤ C} (α : F ⟶ G) (hα : cartesian α)
36 | [IsIso (α.app (⊤_ J))] : IsIso α := by
37 | refine @NatIso.isIso_of_isIso_app _ _ _ _ _ _ α
38 | (fun j ↦ isIso_snd_of_isIso <| hα <| terminal.from j)
39 |
40 | theorem cartesian.comp {F G H : J ⥤ C} {α : F ⟶ G} {β : G ⟶ H} (hα : cartesian α)
41 | (hβ : cartesian β) : cartesian (α ≫ β) :=
42 | fun _ _ f => (hα f).paste_vert (hβ f)
43 |
44 | theorem cartesian.whiskerRight {F G : J ⥤ C} {α : F ⟶ G} (hα : cartesian α)
45 | (H : C ⥤ D) [∀ (i j : J) (f : j ⟶ i), PreservesLimit (cospan (α.app i) (G.map f)) H] :
46 | cartesian (whiskerRight α H) :=
47 | fun _ _ f => (hα f).map H
48 |
49 | theorem cartesian.whiskerLeft {K : Type*} [Category K] {F G : J ⥤ C} {α : F ⟶ G}
50 | (hα : cartesian α) (H : K ⥤ J) : cartesian (whiskerLeft H α) :=
51 | fun _ _ f => hα (H.map f)
52 |
53 | theorem cartesian.comp_horizz {M N K : Type*}
54 | [Category M] [Category N] [Category K] {F G : J ⥤ C} {M N : C ⥤ K} {α : F ⟶ G} {β : M ⟶ N}
55 | (hα : cartesian α) (hβ : cartesian β)
56 | [∀ (i j : J) (f : j ⟶ i), PreservesLimit (cospan (α.app i) (G.map f)) M] :
57 | cartesian (NatTrans.hcomp α β) := by {
58 | have ha := cartesian.whiskerRight hα M
59 | have hb := cartesian.whiskerLeft hβ G
60 | have hc := cartesian.comp ha hb
61 | unfold cartesian
62 | intros i j f
63 | specialize hc f
64 | simp only [Functor.comp_obj, Functor.comp_map, comp_app,
65 | whiskerRight_app, whiskerLeft_app,
66 | naturality] at hc
67 | exact hc
68 | }
69 |
70 | theorem cartesian_of_discrete {ι : Type*} {F G : Discrete ι ⥤ C}
71 | (α : F ⟶ G) : cartesian α := by
72 | rintro ⟨i⟩ ⟨j⟩ ⟨⟨rfl : i = j⟩⟩
73 | simp only [Discrete.functor_map_id]
74 | exact IsPullback.of_horiz_isIso ⟨by rw [Category.id_comp, Category.comp_id]⟩
75 |
76 | theorem cartesian_of_isPullback_to_terminal [HasTerminal J] {F G : J ⥤ C} (α : F ⟶ G)
77 | (pb : ∀ j,
78 | IsPullback (F.map (terminal.from j)) (α.app j) (α.app (⊤_ J)) (G.map (terminal.from j))) :
79 | cartesian α := by
80 | intro i j f
81 | apply IsPullback.of_right (h₁₂ := F.map (terminal.from j)) (h₂₂ := G.map (terminal.from j))
82 | simpa [← F.map_comp, ← G.map_comp] using (pb i)
83 | exact α.naturality f
84 | exact pb j
85 |
86 |
87 | end NatTrans
88 |
89 | open NatTrans
90 |
91 | theorem mapPair_cartesian {F F' : Discrete WalkingPair ⥤ C} (α : F ⟶ F') : cartesian α :=
92 | cartesian_of_discrete α
93 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/PartialProduct.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour
5 | -/
6 | import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
7 | import Mathlib.CategoryTheory.Comma.Over.Pullback
8 | import Poly.ForMathlib.CategoryTheory.Comma.Over.Pullback
9 | import Mathlib.CategoryTheory.Closed.Cartesian
10 | import Mathlib.CategoryTheory.EqToHom
11 |
12 | /-! ## Partial Products
13 | A partial product is a simultaneous generalization of a product and an exponential object.
14 |
15 | A partial product of an object `X` over a morphism `s : E ⟶ B` is is an object `P` together
16 | with morphisms `fst : P —> A` and `snd : pullback fst s —> X` which is universal among
17 | such data.
18 | -/
19 |
20 | noncomputable section
21 |
22 | namespace CategoryTheory
23 |
24 | open CategoryTheory Category Limits Functor Over
25 |
26 |
27 | variable {C : Type*} [Category C] [HasPullbacks C]
28 |
29 | namespace PartialProduct
30 |
31 | variable {E B : C} (s : E ⟶ B) (X : C)
32 |
33 | /--
34 | A partial product cone over an object `X : C` and a morphism `s : E ⟶ B` is an object `pt : C`
35 | together with morphisms `Fan.fst : pt —> B` and `Fan.snd : pullback Fan.fst s —> X`.
36 |
37 | ```
38 | X
39 | ^
40 | Fan.snd |
41 | |
42 | • ---------------> pt
43 | | |
44 | | (pb) | Fan.fst
45 | v v
46 | E ----------------> B
47 | s
48 | ```
49 | -/
50 | structure Fan where
51 | {pt : C}
52 | fst : pt ⟶ B
53 | snd : pullback fst s ⟶ X
54 |
55 | theorem Fan.fst_mk {pt : C} (f : pt ⟶ B) (g : pullback f s ⟶ X) :
56 | Fan.fst (Fan.mk f g) = f := by
57 | rfl
58 |
59 | variable {s X}
60 |
61 | def Fan.over (c : Fan s X) : Over B := Over.mk c.fst
62 |
63 | def Fan.overPullbackToStar [HasBinaryProducts C] (c : Fan s X) :
64 | (Over.pullback s).obj c.over ⟶ (Over.star E).obj X :=
65 | (forgetAdjStar E).homEquiv _ _ c.snd
66 |
67 | @[reassoc (attr := simp)]
68 | theorem Fan.overPullbackToStar_snd {c : Fan s X} [HasBinaryProducts C] :
69 | (Fan.overPullbackToStar c).left ≫ prod.snd = c.snd := by
70 | simp [Fan.overPullbackToStar, Adjunction.homEquiv, forgetAdjStar.unit_app]
71 |
72 | -- note: the reason we use `(Over.pullback s).map` instead of `pullback.map` is that
73 | -- we want to readily use lemmas about the adjunction `pullback s ⊣ pushforward s` in `UvPoly`.
74 | def comparison {P} {c : Fan s X} (f : P ⟶ c.pt) : pullback (f ≫ c.fst) s ⟶ pullback c.fst s :=
75 | (Over.pullback s |>.map (homMk f (by simp) : Over.mk (f ≫ c.fst) ⟶ Over.mk c.fst)).left
76 |
77 | theorem comparison_pullback.map {P} {c : Fan s X} {f : P ⟶ c.pt} :
78 | comparison f = pullback.map (f ≫ c.fst) s (c.fst) s f (𝟙 E) (𝟙 B) (by aesop) (by aesop) := by
79 | simp [comparison, pullback.map]
80 |
81 | def pullbackMap {c' c : Fan s X} (f : c'.pt ⟶ c.pt)
82 | (_ : f ≫ c.fst = c'.fst := by aesop_cat) :
83 | pullback c'.fst s ⟶ pullback c.fst s :=
84 | ((Over.pullback s).map (Over.homMk f (by aesop) : Over.mk (c'.fst) ⟶ Over.mk c.fst)).left
85 |
86 | theorem pullbackMap_comparison {P} {c : Fan s X} (f : P ⟶ c.pt) :
87 | pullbackMap (c' := Fan.mk (f ≫ c.fst) (comparison f ≫ c.snd)) (c := c) f = comparison f := by
88 | rfl
89 |
90 | /-- A map to the apex of a partial product cone induces a partial product cone by precomposition. -/
91 | @[simps]
92 | def Fan.extend (c : Fan s X) {A : C} (f : A ⟶ c.pt) : Fan s X where
93 | pt := A
94 | fst := f ≫ c.fst
95 | snd := (pullback.map _ _ _ _ f (𝟙 E) (𝟙 B) (by simp) (by aesop)) ≫ c.snd
96 |
97 | @[ext]
98 | structure Fan.Hom (c c' : Fan s X) where
99 | hom : c.pt ⟶ c'.pt
100 | w_left : hom ≫ c'.fst = c.fst := by aesop_cat
101 | w_right : pullbackMap hom ≫ c'.snd = c.snd := by aesop_cat
102 |
103 | attribute [reassoc (attr := simp)] Fan.Hom.w_left Fan.Hom.w_right
104 |
105 | @[simps]
106 | instance : Category (Fan s X) where
107 | Hom := Fan.Hom
108 | id c := ⟨𝟙 c.pt, by simp, by simp [pullbackMap]⟩
109 | comp {X Y Z} f g := ⟨f.hom ≫ g.hom, by simp [g.w_left, f.w_left], by
110 | rw [← f.w_right, ← g.w_right]
111 | simp_rw [← Category.assoc]
112 | congr 1
113 | ext <;> simp [pullbackMap]
114 | ⟩
115 | id_comp f := by dsimp; ext; simp
116 | comp_id f := by dsimp; ext; simp
117 | assoc f g h := by dsimp; ext; simp
118 |
119 | /-- Constructs an isomorphism of `PartialProduct.Fan`s out of an isomorphism of the apexes
120 | that commutes with the projections. -/
121 | def Fan.ext {c c' : Fan s X} (e : c.pt ≅ c'.pt)
122 | (h₁ : e.hom ≫ c'.fst = c.fst)
123 | (h₂ : pullbackMap e.hom ≫ c'.snd = c.snd) :
124 | c ≅ c' where
125 | hom := ⟨e.hom, h₁, h₂⟩
126 | inv := ⟨e.inv, by simp [Iso.inv_comp_eq, h₁] , by sorry⟩
127 |
128 | structure IsLimit (cone : Fan s X) where
129 | /-- There is a morphism from any cone apex to `cone.pt` -/
130 | lift : ∀ c : Fan s X, c.pt ⟶ cone.pt
131 | /-- For any cone `c`, the morphism `lift c` followed by the first project `cone.fst` is equal
132 | to `c.fst`. -/
133 | fac_left : ∀ c : Fan s X, lift c ≫ cone.fst = c.fst := by aesop_cat
134 | /-- For any cone `c`, the pullback pullbackMap of the cones followed by the second project
135 | `cone.snd` is equal to `c.snd` -/
136 | fac_right : ∀ c : Fan s X,
137 | pullbackMap (lift c) ≫ cone.snd = c.snd := by
138 | aesop_cat
139 | /-- `lift c` is the unique such map -/
140 | uniq : ∀ (c : Fan s X) (m : c.pt ⟶ cone.pt) (_ : m ≫ cone.fst = c.fst)
141 | (_ : pullbackMap m ≫ cone.snd = c.snd), m = lift c := by aesop_cat
142 |
143 | variable (s X)
144 |
145 | /--
146 | A partial product of an object `X` over a morphism `s : E ⟶ B` is the universal partial product cone
147 | over `X` and `s`.
148 | -/
149 | structure LimitFan where
150 | /-- The cone itself -/
151 | cone : Fan s X
152 | /-- The proof that is the limit cone -/
153 | isLimit : IsLimit cone
154 |
155 | end PartialProduct
156 |
157 | open PartialProduct
158 |
159 | variable {E B : C} {s : E ⟶ B} {X : C}
160 |
161 | def overPullbackToStar [HasBinaryProducts C] {W} (f : W ⟶ B) (g : pullback f s ⟶ X) :
162 | (Over.pullback s).obj (Over.mk f) ⟶ (Over.star E).obj X :=
163 | Fan.overPullbackToStar <| Fan.mk f g
164 |
165 | theorem overPullbackToStar_prod_snd [HasBinaryProducts C]
166 | {W} {f : W ⟶ B} {g : pullback f s ⟶ X} :
167 | (overPullbackToStar f g).left ≫ prod.snd = g := by
168 | simp only [overPullbackToStar, Fan.overPullbackToStar, Fan.over]
169 | simp only [forgetAdjStar.homEquiv_left_lift]
170 | aesop
171 |
172 | abbrev partialProd (c : LimitFan s X) : C :=
173 | c.cone.pt
174 |
175 | abbrev partialProd.cone (c : LimitFan s X) : Fan s X :=
176 | c.cone
177 |
178 | abbrev partialProd.isLimit (c : LimitFan s X) : IsLimit (partialProd.cone c) :=
179 | c.isLimit
180 |
181 | abbrev partialProd.fst (c : LimitFan s X) : partialProd c ⟶ B :=
182 | Fan.fst <| partialProd.cone c
183 |
184 | abbrev partialProd.snd (c : LimitFan s X) :
185 | pullback (partialProd.fst c) s ⟶ X :=
186 | Fan.snd <| partialProd.cone c
187 |
188 | /-- If the partial product of `s` and `X` exists, then every pair of morphisms `f : W ⟶ B` and
189 | `g : pullback f s ⟶ X` induces a morphism `W ⟶ partialProd s X`. -/
190 | abbrev partialProd.lift {W} (c : LimitFan s X)
191 | (f : W ⟶ B) (g : pullback f s ⟶ X) : W ⟶ partialProd c :=
192 | ((partialProd.isLimit c)).lift (Fan.mk f g)
193 |
194 | @[reassoc, simp]
195 | theorem partialProd.lift_fst {W} {c : LimitFan s X} (f : W ⟶ B) (g : pullback f s ⟶ X) :
196 | partialProd.lift c f g ≫ partialProd.fst c = f :=
197 | ((partialProd.isLimit c)).fac_left (Fan.mk f g)
198 |
199 | @[reassoc]
200 | theorem partialProd.lift_snd {W} (c : LimitFan s X) (f : W ⟶ B) (g : pullback f s ⟶ X) :
201 | (comparison (partialProd.lift c f g)) ≫ (partialProd.snd c) =
202 | (pullback.congrHom (partialProd.lift_fst f g) rfl).hom ≫ g := by
203 | let h := ((partialProd.isLimit c)).fac_right (Fan.mk f g)
204 | rw [← pullbackMap_comparison]
205 | simp [pullbackMap, pullback.map]
206 | sorry
207 |
208 | -- theorem hom_lift (h : IsLimit t) {W : C} (m : W ⟶ t.pt) :
209 | -- m = h.lift { pt := W, π := { app := fun b => m ≫ t.π.app b } } :=
210 | -- h.uniq { pt := W, π := { app := fun b => m ≫ t.π.app b } } m fun _ => rfl
211 |
212 | theorem partialProd.hom_ext {W : C} (c : LimitFan s X) {f g : W ⟶ partialProd c}
213 | (h₁ : f ≫ partialProd.fst c = g ≫ partialProd.fst c)
214 | (h₂ : comparison f ≫ partialProd.snd c =
215 | (pullback.congrHom h₁ rfl).hom ≫ comparison g ≫ partialProd.snd c) :
216 | f = g := by
217 | sorry
218 | -- apply c.isLimit.uniq
219 |
--------------------------------------------------------------------------------
/Poly/ForMathlib/CategoryTheory/Types.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Wojciech Nawrocki. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Wojciech Nawrocki
5 | -/
6 |
7 | import Mathlib.CategoryTheory.Types
8 |
9 | namespace CategoryTheory.FunctorToTypes
10 |
11 | /-! Repetitive lemmas about bifunctors into `Type`.
12 |
13 | Q: Is there a better way?
14 | Mathlib doesn't seem to think so:
15 | see `hom_inv_id_app`, `hom_inv_id_app_app`, `hom_inv_id_app_app_app`.
16 | Can a `simproc` that tries `congr_fun/congr_arg simpLemma` work? -/
17 |
18 | universe w
19 | variable {𝒞 𝒟 : Type*} [Category 𝒞] [Category 𝒟] (F G : 𝒞 ⥤ 𝒟 ⥤ Type w)
20 | {C₁ C₂ : 𝒞} {D₁ D₂ : 𝒟}
21 |
22 | theorem naturality₂_left (σ : F ⟶ G) (f : C₁ ⟶ C₂) (x : (F.obj C₁).obj D₁) :
23 | (σ.app C₂).app D₁ ((F.map f).app D₁ x) = (G.map f).app D₁ ((σ.app C₁).app D₁ x) :=
24 | congr_fun (congr_fun (congr_arg NatTrans.app (σ.naturality f)) D₁) x
25 |
26 | theorem naturality₂_right (σ : F ⟶ G) (f : D₁ ⟶ D₂) (x : (F.obj C₁).obj D₁) :
27 | (σ.app C₁).app D₂ ((F.obj C₁).map f x) = (G.obj C₁).map f ((σ.app C₁).app D₁ x) :=
28 | naturality ..
29 |
30 | @[simp]
31 | theorem hom_inv_id_app_app_apply (α : F ≅ G) (C D) (x) :
32 | (α.inv.app C).app D ((α.hom.app C).app D x) = x :=
33 | congr_fun (α.hom_inv_id_app_app C D) x
34 |
35 | @[simp]
36 | theorem inv_hom_id_app_app_apply (α : F ≅ G) (C D) (x) :
37 | (α.hom.app C).app D ((α.inv.app C).app D x) = x :=
38 | congr_fun (α.inv_hom_id_app_app C D) x
39 |
--------------------------------------------------------------------------------
/Poly/MvPoly/Basic.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2024 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour
5 | -/
6 |
7 | -- import Poly.LCCC.BeckChevalley
8 | -- import Poly.LCCC.Basic
9 | -- import Poly.ForMathlib.CategoryTheory.Comma.Over.Basic
10 | -- import Poly.ForMathlib.CategoryTheory.Comma.Over.Pullback
11 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.Basic
12 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.BeckChevalley
13 | import Poly.ForMathlib.CategoryTheory.LocallyCartesianClosed.Distributivity
14 | import Mathlib.CategoryTheory.Extensive
15 | --import Poly.UvPoly
16 |
17 | /-!
18 | # Polynomial Functor
19 |
20 | -- TODO: there are various `sorry`-carrying proofs in below which require instances of
21 | `ExponentiableMorphism` for various constructions on morphisms. They need to be defined in
22 | `Poly.Exponentiable`.
23 | -/
24 |
25 | noncomputable section
26 |
27 | namespace CategoryTheory
28 |
29 | open CategoryTheory Category Limits Functor Adjunction ExponentiableMorphism
30 |
31 | variable {C : Type*} [Category C] [HasPullbacks C] [HasTerminal C] [HasFiniteWidePullbacks C]
32 |
33 | /-- `P : MvPoly I O` is a multivariable polynomial with input variables in `I`,
34 | output variables in `O`, and with arities `E` dependent on `I`. -/
35 | structure MvPoly (I O : C) where
36 | (E B : C)
37 | (i : E ⟶ I)
38 | (p : E ⟶ B)
39 | (exp : ExponentiableMorphism p := by infer_instance)
40 | (o : B ⟶ O)
41 |
42 | namespace MvPoly
43 |
44 | open ExponentiableMorphism
45 |
46 | attribute [instance] MvPoly.exp
47 |
48 | /-- The identity polynomial in many variables. -/
49 | @[simps!]
50 | def id (I : C) : MvPoly I I := ⟨I, I, 𝟙 I, 𝟙 I, ExponentiableMorphism.id, 𝟙 I⟩
51 |
52 | instance (I : C) : ExponentiableMorphism ((id I).p) := ExponentiableMorphism.id
53 |
54 | -- let's prove that the pullback along `initial.to` is isomorphic to the initial object
55 | example [HasInitial C] {X Y : C} (f : Y ⟶ X) :
56 | IsPullback (initial.to Y) (𝟙 _) f (initial.to X) where
57 | w := by aesop
58 | isLimit' := by
59 | refine ⟨?_⟩
60 | sorry
61 |
62 | /-- Given an object `X`, The unique map `initial.to X : ⊥_ C ⟶ X ` is exponentiable. -/
63 | instance [HasInitial C] (X : C) : ExponentiableMorphism (initial.to X) := sorry
64 | -- functor := {
65 | -- obj := sorry
66 | -- map := sorry
67 | -- }
68 | -- adj := sorry
69 |
70 | /-- The constant polynomial in many variables: for this we need the initial object. -/
71 | def const {I O : C} [HasInitial C] (A : C) [HasBinaryProduct O A] : MvPoly I O :=
72 | ⟨⊥_ C, Limits.prod O A, initial.to I , initial.to _, inferInstance, prod.fst⟩
73 |
74 | /-- The monomial polynomial in many variables. -/
75 | def monomial {I O E : C} (i : E ⟶ I) (p : E ⟶ O) [ExponentiableMorphism p]: MvPoly I O :=
76 | ⟨E, O, i, p, inferInstance, 𝟙 O⟩
77 |
78 | /-- The sum of two polynomials in many variables. -/
79 | def sum {I O : C} [HasBinaryCoproducts C] (P Q : MvPoly I O) : MvPoly I O where
80 | E := P.E ⨿ Q.E
81 | B := P.B ⨿ Q.B
82 | i := coprod.desc P.i Q.i
83 | p := coprod.map P.p Q.p
84 | exp := sorry
85 | o := coprod.desc P.o Q.o
86 |
87 | /-- The product of two polynomials in many variables. -/
88 | def prod {I O : C} [HasBinaryProducts C] [FinitaryExtensive C] (P Q : MvPoly I O) : MvPoly I O where
89 | E := (pullback (P.p ≫ P.o) Q.o) ⨿ (pullback P.o (Q.p ≫ Q.o))
90 | B := pullback P.o Q.o
91 | i := coprod.desc (pullback.fst _ _ ≫ P.i) (pullback.snd _ _ ≫ Q.i)
92 | p := coprod.desc (pullback.map _ _ _ _ P.p (𝟙 _) (𝟙 _) (by aesop) (by aesop)) (pullback.map _ _ _ _ (𝟙 _) Q.p (𝟙 _) (by aesop) (by aesop))
93 | exp := sorry -- by extensivity -- PreservesPullbacksOfInclusions
94 | o := pullback.fst (P.o) Q.o ≫ P.o
95 |
96 | protected def functor {I O : C} (P : MvPoly I O) :
97 | Over I ⥤ Over O :=
98 | (Over.pullback P.i) ⋙ (pushforward P.p) ⋙ (Over.map P.o)
99 |
100 | variable (I O : C) (P : MvPoly I O)
101 |
102 | def apply {I O : C} (P : MvPoly I O) [ExponentiableMorphism P.p] : Over I → Over O := (P.functor).obj
103 |
104 | /-TODO: write a coercion from `MvPoly` to a functor for evaluation of polynomials at a given
105 | object.-/
106 |
107 | def idApplyIso (q : X ⟶ I) : (id I).apply (Over.mk q) ≅ Over.mk q where
108 | hom := by
109 | simp [apply]
110 | exact {
111 | left := by
112 | dsimp
113 | sorry
114 | right := sorry
115 | w := sorry
116 | }
117 | inv := sorry
118 | hom_inv_id := sorry
119 | inv_hom_id := sorry
120 |
121 | section Composition
122 |
123 | variable {I J K : C} (P : MvPoly I J) (Q : MvPoly J K) [LocallyCartesianClosed C]
124 |
125 | open Over
126 |
127 | abbrev h : (Limits.pullback P.o Q.i) ⟶ P.B := pullback.fst P.o Q.i
128 |
129 | abbrev k := pullback.snd P.o Q.i
130 |
131 | abbrev m := pullback.fst P.p (h P Q)
132 |
133 | /-- `w` is obtained by applying `pushforward g` to `k`. -/
134 | abbrev w := v Q.p (k P Q) --(functor Q.p).obj (Over.mk <| k P Q)
135 |
136 | abbrev r := pullback.snd P.p (h P Q)
137 |
138 | abbrev ε := e (Q.p) (k P Q) -- (ε' P Q).left
139 |
140 | def q := g Q.p (k P Q) --pullback.fst (P.w Q).hom Q.p
141 |
142 | /-- This is `p` in the diagram. -/
143 | abbrev p' := pullback.snd (r P Q) (ε P Q)
144 |
145 | -- N P Q ⟶ B' P Q
146 | abbrev n := pullback.fst (r P Q) (ε P Q)
147 |
148 | open LocallyCartesianClosed
149 |
150 | /-- Functor composition for polynomial functors in the diagrammatic order. -/
151 | def comp (P : MvPoly I J) (Q : MvPoly J K) : MvPoly I K where
152 | E := pullback (r P Q) (e Q.p (k P Q))
153 | B := (Pi (Over.mk Q.p) (Over.mk (k P Q))).left
154 | i := n P Q ≫ m P Q ≫ P.i
155 | p := p' P Q ≫ q P Q
156 | exp := ExponentiableMorphism.comp (P.p' Q) (P.q Q)
157 | o := (w P Q) ≫ Q.o
158 |
159 | def comp.functor : P.functor ⋙ Q.functor ≅ (P.comp Q).functor := by
160 | unfold MvPoly.functor
161 | unfold comp
162 | apply Iso.trans
163 | calc _ ≅ Over.pullback P.i ⋙ pushforward P.p ⋙ (Over.pullback (P.h Q) ⋙
164 | Over.map (P.k Q)) ⋙ pushforward Q.p ⋙ Over.map Q.o := ?_
165 | _ ≅ Over.pullback P.i ⋙ pushforward P.p ⋙ Over.pullback (P.h Q) ⋙
166 | (Over.pullback (e Q.p (P.k Q)) ⋙ pushforward (g Q.p (P.k Q)) ⋙
167 | Over.map (v Q.p (P.k Q))) ⋙ Over.map Q.o := ?_
168 | _ ≅ Over.pullback P.i ⋙ (Over.pullback (P.m Q) ⋙ pushforward (r P Q)) ⋙
169 | (Over.pullback (P.ε Q) ⋙ pushforward (P.q Q) ⋙ Over.map (P.w Q)) ⋙ Over.map Q.o := ?_
170 | (Over.pullback P.i ⋙ (Over.pullback (P.m Q) ⋙ pushforward (r P Q)) ⋙
171 | (Over.pullback (P.ε Q) ⋙ pushforward (P.q Q) ⋙ Over.map (P.w Q)) ⋙ Over.map Q.o) ≅ _ := ?_
172 | (Over.pullback P.i ⋙ Over.pullback (P.m Q) ⋙ Over.pullback (P.n Q))
173 | ⋙ (pushforward (P.p' Q) ⋙ pushforward (P.q Q)) ⋙ Over.map (P.w Q) ⋙ Over.map Q.o ≅ _ := ?_
174 | (Over.pullback P.i ⋙ Over.pullback (P.m Q) ⋙ Over.pullback (P.n Q))
175 | ⋙ pushforward (P.p' Q ≫ P.q Q) ⋙ Over.map (P.w Q) ⋙ Over.map Q.o ≅ _ := ?_
176 |
177 | · let hA' := (IsPullback.of_hasPullback P.o Q.i).flip
178 | apply Iso.symm
179 | letI := pullbackMapTwoSquare_of_isPullback_isIso hA'
180 | let this := asIso (pullbackMapTwoSquare (P.k Q) (P.h Q) Q.i P.o hA'.toCommSq)
181 | exact isoWhiskerLeft (Over.pullback P.i) <| isoWhiskerLeft (pushforward P.p) <| isoWhiskerRight this <| _
182 | · exact isoWhiskerLeft (Over.pullback P.i) <| isoWhiskerLeft (pushforward P.p)
183 | <| isoWhiskerLeft (Over.pullback (P.h Q)) <| isoWhiskerRight (pentagonIso Q.p (P.k Q)) <| (Over.map Q.o)
184 |
185 | · let hpb := (IsPullback.of_hasPullback P.p (pullback.fst P.o Q.i))
186 | have (hpb : IsPullback (P.m Q) (P.r Q) P.p (P.h Q)) :
187 | Over.pullback P.i ⋙ (pushforward P.p ⋙ Over.pullback (P.h Q)) ⋙
188 | (Over.pullback (P.ε Q) ⋙ pushforward (P.q Q) ⋙ Over.map (P.w Q)) ⋙ Over.map Q.o ≅
189 | Over.pullback P.i ⋙ (Over.pullback (P.m Q) ⋙ pushforward (r P Q)) ⋙
190 | (Over.pullback (P.ε Q) ⋙ pushforward (P.q Q) ⋙ Over.map (P.w Q)) ⋙ Over.map Q.o := by
191 | {exact isoWhiskerLeft _ <| isoWhiskerRight (pushforwardPullbackIsoSquare hpb) <| _}
192 | exact this hpb
193 | · let hpb : IsPullback (P.n Q) (P.p' Q) (P.r Q) (P.ε Q) := (IsPullback.of_hasPullback (r P Q) (ε P Q))
194 | have (hpb : IsPullback (P.n Q) (P.p' Q) (P.r Q) (P.ε Q)) :
195 | Over.pullback P.i ⋙ Over.pullback (P.m Q) ⋙ (pushforward (r P Q) ⋙ Over.pullback (P.ε Q))
196 | ⋙ pushforward (P.q Q) ⋙ Over.map (P.w Q) ⋙ Over.map Q.o ≅
197 | Over.pullback P.i ⋙ Over.pullback (P.m Q) ⋙ (Over.pullback (P.n Q) ⋙ pushforward (p' P Q))
198 | ⋙ pushforward (P.q Q) ⋙ Over.map (P.w Q) ⋙ Over.map Q.o := by {
199 | apply isoWhiskerLeft _ <| isoWhiskerLeft _ <| _
200 | apply isoWhiskerRight
201 | exact pushforwardPullbackIsoSquare hpb}
202 | exact this hpb
203 | · apply isoWhiskerLeft _ <| isoWhiskerRight _ <| _; apply Iso.symm;
204 | exact pushforwardCompIso (P.p' Q) (P.q Q)
205 | · have : Over.pullback ((P.n Q ≫ P.m Q) ≫ P.i) ≅
206 | Over.pullback P.i ⋙ Over.pullback (P.m Q) ⋙ Over.pullback (P.n Q) := by
207 | apply Iso.trans (pullbackComp ((P.n Q) ≫ (P.m Q)) P.i)
208 | apply isoWhiskerLeft _ <| (pullbackComp (P.n Q) (P.m Q))
209 | exact isoWhiskerRight (this).symm ((pushforward (P.p' Q ≫ P.q Q)) ⋙ Over.map (P.w Q) ⋙ Over.map Q.o)
210 | simp only [assoc]
211 | exact isoWhiskerLeft _ <| isoWhiskerLeft _ (mapComp (P.w Q) Q.o).symm
212 |
213 | end Composition
214 |
215 |
216 |
217 |
218 |
219 |
220 | end MvPoly
221 | #exit
222 | namespace UvPoly
223 |
224 | /-Note (SH): Alternatively, we can define the functor associated to a single variable polynomial in
225 | terms of `MvPoly.functor` and then reduce the proofs of statements about single variable polynomials
226 | to the multivariable case using the equivalence between `Over (⊤_ C)` and `C`.-/
227 | def toMvPoly (P : UvPoly E B) : MvPoly (⊤_ C) (⊤_ C) :=
228 | ⟨E, B, terminal.from E, P.p, P.exp, terminal.from B⟩
229 |
230 | /-- The projection morphism from `∑ b : B, X ^ (E b)` to `B`. -/
231 | def proj' (P : UvPoly E B) (X : Over (⊤_ C)) :
232 | ((Π_ P.p).obj ((Over.pullback (terminal.from E)).obj X)).left ⟶ B :=
233 | ((Over.pullback (terminal.from _) ⋙ (Π_ P.p)).obj X).hom
234 |
235 | def auxFunctor (P : UvPoly E B) : Over (⊤_ C) ⥤ Over (⊤_ C) := MvPoly.functor P.toMvPoly
236 |
237 | /-- We use the equivalence between `Over (⊤_ C)` and `C` to get `functor : C ⥤ C`.
238 | Alternatively we can give a direct definition of `functor` in terms of exponentials. -/
239 | def functor' (P : UvPoly E B) : C ⥤ C := equivOverTerminal.functor ⋙ P.auxFunctor ⋙ equivOverTerminal.inverse
240 |
241 | def functorIsoFunctor' [HasBinaryProducts C] (P : UvPoly E B) : P.functor ≅ P.functor' := by
242 | unfold functor' auxFunctor functor MvPoly.functor toMvPoly
243 | simp
244 | sorry
245 |
246 | end UvPoly
247 |
248 | end CategroyTheory
249 |
250 | end
251 |
--------------------------------------------------------------------------------
/Poly/Type/Univariate.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2024 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour
5 | -/
6 |
7 | import Mathlib.CategoryTheory.Types
8 |
9 | open CategoryTheory Category Functor
10 |
11 | /-!
12 | # Polynomial functors
13 |
14 | We define the notion of one-variable polynomial functors on the category of sets. The locally cartesian closed structure of sets is implicit in all the constructions.
15 |
16 | The bundle corresponding to a `P : Poly` is the projection
17 | `fst : Σ b : P.B, P.E b → P.B`.
18 |
19 | In LCCCs, instead of working with a type family we shall work with a bundle `p : E → B`.
20 |
21 | -/
22 |
23 | universe u v v₁ v₂ v₃
24 |
25 | /-- A polynomial functor `P` is given by a type family `B → Type u`.
26 | `Poly` is the type of polynomial functors is.
27 |
28 | Given a polynomial `P` and a type `X` we define a new type `P X`, which is defined as the sigma
29 | type `Σ (b : P.B), (P.E b) → X` (mor informally `Σ (b : B), X ^ (E b)`).
30 |
31 | An element of `P X` is a pair `⟨b, x⟩`, where `b` is a term of the base type `B` and `x : E b → X`.
32 | -/
33 | structure Poly where
34 | /-- The base type -/
35 | B : Type u
36 | /-- The dependent fibres -/
37 | E : B → Type u
38 |
39 | namespace Poly
40 |
41 | instance : Inhabited Poly :=
42 | ⟨⟨default, default⟩⟩
43 |
44 | /-- A monomial at `α` is a polynomial with base type `Unit` and and the type family given by the
45 | map `fun _ => α : PUnit → Type u`.
46 | -/
47 | @[simps!]
48 | def monomial (α : Type*) : Poly := ⟨PUnit, fun _ => α⟩
49 |
50 | /-- A constant polynomial at `α` is a polynomial with a base type `β` and the type family given by
51 | the constant map `fun _ => Empty : β → Type u`.
52 | -/
53 | def constant (β : Type*) : Poly := ⟨β, fun _ => PEmpty⟩
54 |
55 | /-- A linear polynomial at `α` is a polynomial with base type `α` and the type family given by the
56 | identity map `id : α → α` -/
57 | @[simps!]
58 | def linear (α : Type*) : Poly := ⟨α, fun _ => PUnit⟩
59 |
60 | @[simps!]
61 | def sum (P : Poly.{u}) (Q : Poly.{u}): Poly :=
62 | ⟨P.B ⊕ Q.B, Sum.elim P.E Q.E⟩
63 |
64 | lemma sum_base {P : Poly.{u}} {Q : Poly.{u}} : (P.sum Q).B = (P.B ⊕ Q.B) := rfl
65 |
66 | lemma sum_fibre_left {P : Poly.{u}} {Q : Poly.{u}} (b : P.B) :
67 | (P.sum Q).E (Sum.inl b) = P.E b := rfl
68 |
69 | lemma sum_fibre_right {P : Poly.{u}} {Q : Poly.{u}} (b : Q.B) :
70 | (P.sum Q).E (Sum.inr b) = Q.E b := rfl
71 |
72 | variable (P : Poly.{u}) {X : Type v₁} {Y : Type v₂} {Z : Type v₃}
73 |
74 | @[simp]
75 | def Total :=
76 | Σ b : P.B, P.E b
77 |
78 | @[simps!]
79 | def monomialTotalEquiv (α : Type*) : Total (monomial α) ≃ α where
80 | toFun t := t.2
81 | invFun a := ⟨PUnit.unit, a⟩
82 | left_inv := by aesop_cat
83 | right_inv := by aesop_cat
84 |
85 | @[simps!]
86 | def linearTotalEquiv (α : Type*) : Total (linear α) ≃ α where
87 | toFun t := t.1
88 | invFun a := ⟨a, PUnit.unit⟩
89 | left_inv := by aesop_cat
90 | right_inv := by aesop_cat
91 |
92 | @[simps!]
93 | def sumTotalEquiv (P Q : Poly) : Total (sum P Q) ≃ Total P ⊕ Total Q where
94 | toFun := fun ⟨a, e⟩ => match a with
95 | | Sum.inl b => Sum.inl ⟨b, e⟩
96 | | Sum.inr b => Sum.inr ⟨b, e⟩
97 | invFun := fun t => match t with
98 | | Sum.inl ⟨b, e⟩ => ⟨Sum.inl b, e⟩
99 | | Sum.inr ⟨c, f⟩ => ⟨Sum.inr c, f⟩
100 | left_inv := by
101 | simp
102 | aesop_cat
103 | right_inv := by aesop_cat
104 |
105 | /-- The bundle associated to a polynomial `P`. -/
106 | def bundle : Total P → P.B := Sigma.fst
107 |
108 | -- TODO: universe issue debugging.
109 | /- The bundle of the `sum P Q` is the sum of the bundles. -/
110 | -- theorem sum_bundle_eq : bundle (P.sum Q) = (Sum.map P.bundle Q.bundle) ∘ (sumTotalEquiv P Q) := by
111 | -- rfl
112 |
113 | /-- Applying `P` to an object of `Type` -/
114 | @[coe]
115 | def Obj (X : Type v) :=
116 | Σ b : P.B, P.E b → X
117 |
118 | instance Total.inhabited [Inhabited P.B] [Inhabited (P.E default)] : Inhabited P.Total :=
119 | ⟨⟨default, default⟩⟩
120 |
121 | instance : CoeFun Poly.{u} (fun _ => Type v → Type (max u v)) where
122 | coe := Obj
123 |
124 | /-- A monomial functor with exponent `α` evaluated at `X` is isomorphic to `α → X`. -/
125 | def monomialEquiv (α : Type*) (X) : monomial α X ≃ (α → X) where
126 | toFun := fun ⟨_, f⟩ => f
127 | invFun := fun f => ⟨PUnit.unit, f⟩
128 | left_inv := by aesop_cat
129 | right_inv := by aesop_cat
130 |
131 | def linearEquiv (α : Type*) (X) : linear α X ≃ α × X where
132 | toFun := fun ⟨a, x⟩ => (a, x PUnit.unit)
133 | invFun := fun ⟨a, x⟩ => ⟨a, fun _ => x⟩
134 | left_inv := by aesop_cat
135 | right_inv := by aesop_cat
136 |
137 | /-- Polynomial `P` evaluated at the type `Unit` is isomorphic to the base type of `P`. -/
138 | def baseEquiv : P Unit ≃ P.B where
139 | toFun := fun ⟨b, _⟩ => b
140 | invFun := fun b => ⟨b , fun _ => () ⟩
141 | left_inv := by aesop_cat
142 | right_inv := by aesop_cat
143 |
144 | def sumEquiv : (P.sum Q) X ≃ P X ⊕ Q X where
145 | toFun := fun ⟨b, x⟩ => match b with
146 | | Sum.inl b => Sum.inl ⟨b, x⟩
147 | | Sum.inr b => Sum.inr ⟨b, x⟩
148 | invFun := fun t => match t with
149 | | Sum.inl ⟨b, x⟩ => ⟨Sum.inl b, x⟩
150 | | Sum.inr ⟨b, x⟩ => ⟨Sum.inr b, x⟩
151 | left_inv := by
152 | sorry
153 | right_inv := by
154 | aesop_cat
155 |
156 | /-- Applying `P` to a morphism in `Type`. -/
157 | def map (f : X → Y) : P X → P Y :=
158 | fun ⟨b, x⟩ => ⟨b, f ∘ x⟩
159 |
160 | @[simp]
161 | protected theorem map_eq (f : X → Y) (b : P.B) (x : P.E b → X) :
162 | P.map f ⟨b, x⟩ = ⟨b, f ∘ x⟩ := rfl
163 |
164 | @[simp]
165 | theorem fst_map (x : P X) (f : X → Y) : (P.map f x).1 = x.1 := by cases x; rfl
166 |
167 | instance Obj.inhabited [Inhabited P.B] [Inhabited X] : Inhabited (P X) :=
168 | ⟨⟨default, default⟩⟩
169 |
170 | @[simp]
171 | protected theorem id_map : ∀ x : P X, P.map id x = x := fun ⟨_, _⟩ => rfl
172 |
173 | @[simp]
174 | theorem map_map (f : X → Y) (g : Y → Z) :
175 | ∀ x : P X, P.map g (P.map f x) = P.map (g ∘ f) x := fun ⟨_, _⟩ => rfl
176 |
177 | /-- The associated functor of `P : Poly`. -/
178 | def functor : Type u ⥤ Type u where
179 | obj X := P X
180 | map {X Y} f := P.map f
181 |
182 | variable {P}
183 |
184 | /-- `x.iget i` takes the component of `x` designated by `i` if any is or returns
185 | a default value -/
186 | def Obj.iget [DecidableEq P.B] {X} [Inhabited X] (x : P X) (i : P.Total) : X :=
187 | if h : i.1 = x.1 then x.2 (cast (congr_arg _ h) i.2) else default
188 |
189 | @[simp]
190 | theorem iget_map [DecidableEq P.B] [Inhabited X] [Inhabited Y] (x : P X)
191 | (f : X → Y) (i : P.Total) (h : i.1 = x.1) : (P.map f x).iget i = f (x.iget i) := by
192 | simp only [Obj.iget, fst_map, *, dif_pos, eq_self_iff_true]
193 | cases x
194 | rfl
195 |
196 | end Poly
197 |
198 | /-- Composition of polynomials. -/
199 | def Poly.comp (Q P : Poly.{u}) : Poly.{u} :=
200 | ⟨Σ b : P.B, P.E b → Q.B, fun ⟨b, c⟩ ↦ Σ e : P.E b, Q.E (c e)⟩
201 |
202 | /-
203 | Note to self: The polynomial composition of bundles
204 | `p : E → B`
205 | `q : F → C`
206 | is a bundle
207 | `comp p q : D → A`
208 | where
209 | `A := Σ (b : B), E b → C`
210 | and
211 | `D := Σ (b : B), Σ (c : E b → C), Σ (e : E b), F (c e)`
212 | -/
213 |
214 | namespace PolyFunctor
215 |
216 | open Poly
217 |
218 | variable (P Q : Poly.{u})
219 |
220 | /-- Constructor for composition -/
221 | def comp.mk {X : Type u} (x : P (Q X)) : Q.comp P X :=
222 | ⟨⟨x.1, Sigma.fst ∘ x.2⟩, fun z => (x.2 z.1).2 z.2⟩
223 |
224 | /-- Functor composition for polynomial functors in the diagrammatic order. -/
225 | def comp.functor : Poly.functor (Q.comp P) ≅ Poly.functor Q ⋙ Poly.functor P where
226 | hom := {
227 | app := fun X => fun ⟨b,e⟩ =>
228 | ⟨ b.1, fun x' => ⟨ b.2 x', fun b' => e ⟨x',b'⟩ ⟩⟩
229 | naturality := by aesop_cat
230 | }
231 | inv := {
232 | app X := comp.mk P Q
233 | naturality := by aesop_cat
234 | }
235 |
236 | example : (Poly.functor Q ⋙ Poly.functor P).obj PUnit = P Q.B := by
237 | sorry
238 |
239 | -- def comp.baseEquiv : (comp P Q) Unit ≃ P Q.B := by
240 | -- TODO: classify linear polynomial functors as the ones which preserve colimits.
241 |
242 | end PolyFunctor
243 |
--------------------------------------------------------------------------------
/Poly/UvPoly/UPFan.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour
5 | -/
6 | import Poly.UvPoly.Basic
7 |
8 | noncomputable section
9 |
10 | namespace CategoryTheory.UvPoly
11 | open Limits PartialProduct
12 |
13 | universe v u
14 | variable {C : Type u} [Category.{v} C] [HasPullbacks C] [HasTerminal C] {E B : C}
15 |
16 | /-- Universal property of the polynomial functor. -/
17 | @[simps]
18 | def equiv (P : UvPoly E B) (Γ : C) (X : C) :
19 | (Γ ⟶ P @ X) ≃ (b : Γ ⟶ B) × (pullback b P.p ⟶ X) where
20 | toFun := P.proj
21 | invFun u := P.lift (Γ := Γ) (X := X) u.1 u.2
22 | left_inv f := by
23 | dsimp
24 | symm
25 | fapply partialProd.hom_ext ⟨fan P X, isLimitFan P X⟩
26 | · simp [partialProd.lift]
27 | rfl
28 | · sorry
29 | right_inv := by
30 | intro ⟨b, e⟩
31 | ext
32 | · simp only [proj_fst, lift_fst]
33 | · sorry
34 |
35 | end CategoryTheory.UvPoly
36 |
--------------------------------------------------------------------------------
/Poly/UvPoly/UPIso.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2025 Wojciech Nawrocki. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Wojciech Nawrocki
5 | -/
6 | import Poly.UvPoly.Basic
7 | import Poly.Bifunctor.Sigma
8 |
9 | noncomputable section
10 |
11 | namespace CategoryTheory.UvPoly
12 | open Limits Over ExponentiableMorphism Functor
13 |
14 | universe v u
15 | variable {C : Type u} [Category.{v} C] [HasPullbacks C] {E B : C} (P : UvPoly E B)
16 |
17 | /-- Sends `(Γ, X)` to `Σ(b : Γ ⟶ B), 𝒞(pullback b P.p, X)`.
18 | This is equivalent to the type of partial product cones with apex `Γ` over `X`. -/
19 | @[simps! obj_obj map_app]
20 | def partProdsOver : Cᵒᵖ ⥤ C ⥤ Type v :=
21 | Functor.Sigma
22 | ((Over.equivalence_Elements B).functor ⋙ (Over.pullback P.p).op ⋙
23 | (forget E).op ⋙ coyoneda (C := C))
24 |
25 | @[simp]
26 | theorem partProdsOver_obj_map {X Y : C} (Γ : Cᵒᵖ) (f : X ⟶ Y) (x : (P.partProdsOver.obj Γ).obj X) :
27 | (P.partProdsOver.obj Γ).map f x = ⟨x.1, x.2 ≫ f⟩ := by
28 | dsimp [partProdsOver]
29 | have : 𝟙 Γ.unop ≫ x.1 = x.1 := by simp
30 | ext : 1
31 | . simp
32 | . dsimp
33 | rw! (castMode := .all) [this]
34 | simp
35 |
36 | variable [HasTerminal C]
37 |
38 | /-- `𝒞(Γ, PₚX) ≅ Σ(b : Γ ⟶ B), 𝒞(b*p, X)` -/
39 | def iso_Sigma (P : UvPoly E B) :
40 | P.functor ⋙₂ coyoneda (C := C) ≅ P.partProdsOver :=
41 | calc
42 | P.functor ⋙₂ coyoneda (C := C) ≅
43 | (star E ⋙ pushforward P.p) ⋙₂ (forget B ⋙₂ coyoneda (C := C)) :=
44 | Iso.refl _
45 |
46 | _ ≅ (star E ⋙ pushforward P.p) ⋙₂ Functor.Sigma
47 | ((equivalence_Elements B).functor ⋙ coyoneda (C := Over B)) :=
48 | comp₂_isoWhiskerLeft _ (forget_iso_Sigma B)
49 |
50 | _ ≅ Functor.Sigma
51 | ((equivalence_Elements B).functor ⋙
52 | star E ⋙₂ pushforward P.p ⋙₂ coyoneda (C := Over B)) :=
53 | -- Q: better make `comp₂_Sigma` an iso and avoid `eqToIso`?
54 | eqToIso (by simp [comp₂_Sigma])
55 |
56 | _ ≅ _ :=
57 | let i :=
58 | calc
59 | star E ⋙₂ pushforward P.p ⋙₂ coyoneda (C := Over B) ≅
60 | star E ⋙₂ (Over.pullback P.p).op ⋙ coyoneda (C := Over E) :=
61 | comp₂_isoWhiskerLeft (star E) (Adjunction.coyoneda_iso <| adj P.p).symm
62 |
63 | _ ≅ (Over.pullback P.p).op ⋙ star E ⋙₂ coyoneda (C := Over E) :=
64 | Iso.refl _
65 |
66 | _ ≅ (Over.pullback P.p).op ⋙ (forget E).op ⋙ coyoneda (C := C) :=
67 | isoWhiskerLeft (Over.pullback P.p).op (Adjunction.coyoneda_iso <| forgetAdjStar E).symm;
68 |
69 | Functor.Sigma.isoCongrRight (isoWhiskerLeft _ i)
70 |
71 | def equiv (Γ X : C) : (Γ ⟶ P.functor.obj X) ≃ (b : Γ ⟶ B) × (pullback b P.p ⟶ X) :=
72 | Iso.toEquiv <| (P.iso_Sigma.app (.op Γ)).app X
73 |
74 | theorem equiv_app (Γ X : C) (be : Γ ⟶ P.functor.obj X) :
75 | P.equiv Γ X be = (P.iso_Sigma.hom.app <| .op Γ).app X be := by
76 | dsimp [equiv]
77 |
78 | -- TODO(WN): Checking the theorem statement takes 5s, and kernel typechecking 10s!
79 | lemma equiv_naturality_left {Δ Γ : C} (σ : Δ ⟶ Γ) (X : C) (be : Γ ⟶ P.functor.obj X) :
80 | P.equiv Δ X (σ ≫ be) =
81 | let p := P.equiv Γ X be
82 | ⟨σ ≫ p.1, pullback.lift (pullback.fst .. ≫ σ) (pullback.snd ..)
83 | (Category.assoc (obj := C) .. ▸ pullback.condition) ≫ p.2⟩ := by
84 | conv_lhs => rw [equiv_app, coyoneda.comp₂_naturality₂_left, ← equiv_app]
85 | simp
86 |
87 | -- TODO(WN): Kernel typechecking takes 10s!
88 | lemma equiv_naturality_right {Γ X Y : C} (be : Γ ⟶ P.functor.obj X) (f : X ⟶ Y) :
89 | equiv P Γ Y (be ≫ P.functor.map f) =
90 | let p := equiv P Γ X be
91 | ⟨p.1, p.2 ≫ f⟩ := by
92 | conv_lhs => rw [equiv_app, coyoneda.comp₂_naturality₂_right, ← equiv_app]
93 | simp
94 |
95 | end CategoryTheory.UvPoly
96 |
--------------------------------------------------------------------------------
/Poly/Widget/CommDiag.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2024 Wojciech Nawrocki. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Wojciech Nawrocki
5 | -/
6 | import ProofWidgets.Component.GraphDisplay
7 | import ProofWidgets.Component.Panel.SelectionPanel
8 | import ProofWidgets.Component.Panel.GoalTypePanel
9 | import Mathlib.CategoryTheory.Category.Basic
10 |
11 | /-! ## Definitions copied from Mathlib.Tactic.Widget.CommDiag
12 |
13 | We don't want to import it because it registers an `ExprPresenter`
14 | that is worse than the one here. -/
15 |
16 | open Lean in
17 | /-- If the expression is a function application of `fName` with 7 arguments, return those arguments.
18 | Otherwise return `none`. -/
19 | @[inline] def Lean.Expr.app7? (e : Expr) (fName : Name) :
20 | Option (Expr × Expr × Expr × Expr × Expr × Expr × Expr) :=
21 | if e.isAppOfArity fName 7 then
22 | some (
23 | e.appFn!.appFn!.appFn!.appFn!.appFn!.appFn!.appArg!,
24 | e.appFn!.appFn!.appFn!.appFn!.appFn!.appArg!,
25 | e.appFn!.appFn!.appFn!.appFn!.appArg!,
26 | e.appFn!.appFn!.appFn!.appArg!,
27 | e.appFn!.appFn!.appArg!,
28 | e.appFn!.appArg!,
29 | e.appArg!
30 | )
31 | else
32 | none
33 |
34 | namespace Mathlib.Tactic.Widget
35 | open Lean
36 | open CategoryTheory
37 |
38 | /-- Given a Hom type `α ⟶ β`, return `(α, β)`. Otherwise `none`. -/
39 | def homType? (e : Expr) : Option (Expr × Expr) := do
40 | let some (_, _, A, B) := e.app4? ``Quiver.Hom | none
41 | return (A, B)
42 |
43 | /-- Given composed homs `g ≫ h`, return `(g, h)`. Otherwise `none`. -/
44 | def homComp? (f : Expr) : Option (Expr × Expr) := do
45 | let some (_, _, _, _, _, f, g) := f.app7? ``CategoryStruct.comp | none
46 | return (f, g)
47 |
48 | end Mathlib.Tactic.Widget
49 |
50 | /-! ## Metaprogramming utilities for breaking down category theory expressions -/
51 |
52 | namespace Mathlib.Tactic.Widget
53 | open Lean Meta
54 | open ProofWidgets
55 | open CategoryTheory
56 |
57 | /-- Given a composite hom `f ≫ g ≫ … ≫ h` (parenthesized in any way),
58 | return `(dom f, [(f, cod f), (g, cod g), …, (h, cod h)])`. -/
59 | partial def splitHomComps (f : Expr) : MetaM (Expr × List (Expr × Expr)) := do
60 | let fTp ← inferType f >>= instantiateMVars
61 | let some (X, _) := homType? fTp | throwError "expected morphism, got {f}"
62 | return (X, ← go f)
63 | where go (f : Expr) : MetaM (List (Expr × Expr)) := do
64 | if let some (f, g) := homComp? f then
65 | return (← go f) ++ (← go g)
66 | else
67 | let fTp ← inferType f >>= instantiateMVars
68 | let some (_, Y) := homType? fTp | throwError "expected morphism, got {f}"
69 | return [(f, Y)]
70 |
71 | structure DiagState where
72 | /-- vertex id ↦ object -/
73 | vertices: Std.HashMap Nat Expr := .empty
74 | /-- morphism `f` ↦ (src, tgt) for every occurrence of `f` -/
75 | edges: Std.HashMap Expr (List (Nat × Nat)) := .empty
76 | freshVertId : Nat := 0
77 |
78 | variable {m : Type → Type} [Monad m] [MonadStateOf DiagState m]
79 |
80 | /-- Add a hom `f : X ⟶ Y`.
81 | If `f` already exists in the diagram,
82 | the first edge matching `f` is reused.
83 | Otherwise a new free-floating edge (with new endpoints) is created.
84 | Returns the source and target vertices. -/
85 | def addHom (f X Y : Expr) : m (Nat × Nat) := do
86 | let es := (← get).edges.getD f []
87 | if let some (s, t) := es.head? then
88 | return (s, t)
89 | modifyGet fun { vertices, edges, freshVertId } =>
90 | let src := freshVertId
91 | let tgt := freshVertId + 1
92 | ((src, tgt), {
93 | vertices := vertices.insert src X |>.insert tgt Y
94 | edges := edges.insert f ((src, tgt) :: es)
95 | freshVertId := freshVertId + 2
96 | })
97 |
98 | /-- Add a hom `f : _ ⟶ Y`, ensuring that it starts at vertex `src`.
99 | If an edge for `f` starting at `src` already exists in the diagram,
100 | that edge is reused.
101 | Otherwise a new edge with a new target is created.
102 | Returns the target vertex. -/
103 | def addHomFrom (f Y : Expr) (src : Nat) : m Nat := do
104 | let es := (← get).edges.getD f []
105 | for (s, t) in es do
106 | if s == src then
107 | return t
108 | modifyGet fun { vertices, edges, freshVertId } =>
109 | let tgt := freshVertId
110 | (tgt, {
111 | vertices := vertices.insert tgt Y
112 | edges := edges.insert f ((src, tgt) :: es)
113 | freshVertId := freshVertId + 1
114 | })
115 |
116 | /-- Add a hom `f`, ensuring its endpoints are `src` and `tgt`.
117 | If an edge for `f` with these endpoints already exists in the diagram,
118 | that edge is reused.
119 | Otherwise a new edge is created. -/
120 | -- TODO: the current approach means that f ≫ g = f ≫ h merges f
121 | -- but g ≫ f = h ≫ f does not merge f. It should be symmetric instead!
122 | def addHomFromTo (f : Expr) (src tgt : Nat) : m Unit := do
123 | let es := (← get).edges.getD f []
124 | for (s, t) in es do
125 | if s == src && t == tgt then
126 | return
127 | modify fun st => { st with edges := st.edges.insert f ((src, tgt) :: es) }
128 |
129 | def addEq [MonadLift MetaM m] (eq : Expr) : m Unit := do
130 | let some (_, lhs, rhs) := eq.eq? | (throwError "no diagram" : MetaM Unit)
131 | let (X, ((l, Y) :: ls)) ← splitHomComps lhs | (throwError "no diagram" : MetaM Unit)
132 | let (_, ((r, Z) :: rs)) ← splitHomComps rhs | (throwError "no diagram" : MetaM Unit)
133 | let mut (src, tgt) ← addHom l X Y
134 | for (l, Y) in ls do
135 | tgt ← addHomFrom l Y tgt
136 | let lTgt := tgt
137 | tgt ← addHomFrom r Z src
138 | for h : i in [:rs.length-1] do
139 | let (r, Z) := rs[i]'(by have := h.upper; dsimp +zetaDelta at this; omega)
140 | tgt ← addHomFrom r Z tgt
141 | if !rs.isEmpty then
142 | let (r, _) := rs[rs.length - 1]!
143 | addHomFromTo r tgt lTgt
144 |
145 | open Jsx in
146 | def mkLabel (e : Expr) : MetaM (Nat × Nat × Html) := do
147 | let fmt ← withOptions (·.setNat `pp.deepTerms.threshold 1)
148 | (toString <$> ppExpr e)
149 | let w := min (15 + fmt.length * 6) 100
150 | let h := max 20 (20 * (1 + fmt.length / 15))
151 | let x: Int := -w/2
152 | let y: Int := -h/2
153 | return (w, h,
154 |
161 |
162 | {.text fmt}
163 |
164 | )
165 |
166 | open Jsx in
167 | def toHtml [MonadLift MetaM m] : m Html := do
168 | let st ← get
169 | let mut maxLabelRadius := 0.0
170 | let mut vertices := #[]
171 | for (vId, v) in st.vertices do
172 | let (w, h, label) ← mkLabel v
173 | maxLabelRadius := max maxLabelRadius (Float.sqrt <| (w.toFloat/2)^2 + (h.toFloat/2)^2)
174 | vertices := vertices.push {
175 | id := toString vId
176 | boundingShape := .rect w.toFloat h.toFloat
177 | label
178 | }
179 | let mut edges := #[]
180 | for (f, l) in st.edges do
181 | let (w, h, label) ← mkLabel f
182 | maxLabelRadius := max maxLabelRadius (Float.sqrt <| (w.toFloat/2)^2 + (h.toFloat/2)^2)
183 | for (s, t) in l do
184 | edges := edges.push {
185 | source := toString s
186 | target := toString t
187 | attrs := #[("className", "dim")]
188 | label? := some label
189 | details? := some
190 |
191 |
192 | :
193 |
194 |
195 |
196 | }
197 | return
208 |
209 | open Jsx in
210 | @[expr_presenter]
211 | def commutativeDiagramPresenter : ExprPresenter where
212 | userName := "Commutative diagram"
213 | layoutKind := .block
214 | present type := do
215 | let type ← instantiateMVars type
216 | let x : StateT DiagState MetaM Html := do
217 | addEq type
218 | toHtml
219 | x.run' {}
220 |
221 | -- Show the widget in downstream modules.
222 | show_panel_widgets [GoalTypePanel]
223 |
--------------------------------------------------------------------------------
/Poly/deprecated/ForMathlib.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2024 Wojciech Nawrocki. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Wojciech Nawrocki
5 | -/
6 |
7 | import Mathlib.CategoryTheory.Adjunction.Over
8 | import Mathlib.CategoryTheory.ChosenFiniteProducts
9 |
10 | /-! Lemmas that should possibly be in mathlib.
11 | Do *not* introduce new definitions here. -/
12 |
13 | /-! ## Over categories -/
14 |
15 | namespace CategoryTheory.Over
16 |
17 | variable {C : Type*} [Category C]
18 |
19 | /-- This is useful when `homMk (· ≫ ·)` appears under `Functor.map` or a natural equivalence. -/
20 | lemma homMk_comp {B : C} {U V W : Over B} (f : U.left ⟶ V.left) (g : V.left ⟶ W.left) (fg_comp f_comp g_comp) :
21 | homMk (f ≫ g) fg_comp = homMk (V := V) f f_comp ≫ homMk (U := V) g g_comp := by
22 | ext; simp
23 |
24 | @[simp]
25 | lemma left_homMk {B : C} {U V : Over B} (f : U ⟶ V) (h) :
26 | homMk f.left h = f := by
27 | rfl
28 |
29 | end CategoryTheory.Over
30 |
31 | /-! ## ChosenFiniteProducts.ofFiniteProducts
32 |
33 | Simplify monoidal structure coming from `HasFiniteProducts` into `prod.foo`.
34 | See https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Cartesian.20closed.20Monoidal.20categories.2E
35 | -/
36 |
37 | namespace CategoryTheory.ChosenFiniteProducts
38 | open Limits MonoidalCategory
39 |
40 | variable {C : Type*} [Category C] [HasFiniteProducts C]
41 |
42 | attribute [local instance] ChosenFiniteProducts.ofFiniteProducts
43 |
44 | @[simp]
45 | theorem ofFiniteProducts_fst (X Y : C) : fst X Y = prod.fst := by
46 | rfl
47 |
48 | @[simp]
49 | theorem ofFiniteProducts_snd (X Y : C) : snd X Y = prod.snd := by
50 | rfl
51 |
52 | @[simp]
53 | theorem ofFiniteProducts_whiskerLeft {Y Z : C} (X : C) (f : Y ⟶ Z) :
54 | X ◁ f = prod.map (𝟙 X) f := by
55 | ext <;> simp [↓whiskerLeft_fst, ↓whiskerLeft_snd]
56 |
57 | @[simp]
58 | theorem ofFiniteProducts_whiskerRight {X Y : C} (Z : C) (f : X ⟶ Y) :
59 | f ▷ Z = prod.map f (𝟙 Z) := by
60 | ext <;> simp [↓whiskerRight_fst, ↓whiskerRight_snd]
61 |
62 | namespace CategoryTheory.ChosenFiniteProducts
63 |
--------------------------------------------------------------------------------
/Poly/deprecated/LCCC.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2024 Sina Hazratpour. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Sina Hazratpour
5 | -/
6 |
7 | import Mathlib.CategoryTheory.Category.Basic
8 | -- import Mathlib.CategoryTheory.EpiMono
9 | import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
10 | import Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits
11 | import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
12 | -- import Mathlib.CategoryTheory.Monoidal.OfHasFiniteProducts
13 | import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts
14 | import Mathlib.CategoryTheory.Adjunction.Limits
15 | import Mathlib.CategoryTheory.Adjunction.Mates
16 | import Mathlib.CategoryTheory.Closed.Monoidal
17 | import Mathlib.CategoryTheory.Closed.Cartesian
18 | import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
19 | -- import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts
20 | import Mathlib.CategoryTheory.Adjunction.Basic
21 | import Mathlib.CategoryTheory.Limits.Constructions.Over.Basic
22 |
23 | -- Likely too many imports!
24 |
25 |
26 | /-!
27 | # Locally cartesian closed categories
28 |
29 | -/
30 |
31 |
32 | noncomputable section
33 |
34 | open CategoryTheory Category Limits Functor Adjunction
35 |
36 | variable {C : Type*}[Category C]
37 |
38 | def hasPullbackOverAdj [HasPullbacks C] {X Y : C} (f : X ⟶ Y) : Over.map f ⊣ baseChange f :=
39 | Adjunction.mkOfHomEquiv {
40 | homEquiv := fun x y ↦ {
41 | toFun := fun u ↦ {
42 | left := by
43 | simp
44 | fapply pullback.lift
45 | · exact u.left
46 | · exact x.hom
47 | · aesop_cat
48 | right := by
49 | apply eqToHom
50 | aesop
51 | w := by simp}
52 | invFun := fun v ↦ {
53 | left := by
54 | simp at*
55 | exact v.left ≫ pullback.fst
56 | right := by
57 | apply eqToHom
58 | aesop
59 | w := by
60 | simp
61 | rw [pullback.condition]
62 | rw [← Category.assoc]
63 | apply eq_whisker
64 | simpa using v.w}
65 | left_inv := by aesop_cat
66 | right_inv := fun v ↦ Over.OverMorphism.ext (by
67 | simp
68 | apply pullback.hom_ext
69 | · aesop_cat
70 | · rw [pullback.lift_snd]
71 | have vtriangle := v.w
72 | simp at vtriangle
73 | exact vtriangle.symm)}
74 | homEquiv_naturality_left_symm := by aesop_cat
75 | homEquiv_naturality_right := by aesop_cat}
76 |
77 | /-
78 | There are several equivalent definitions of locally
79 | cartesian closed categories.
80 |
81 | 1. A locally cartesian closed category is a category C such that all
82 | the slices C/I are cartesian closed categories.
83 |
84 | 2. Equivalently, a locally cartesian closed category `C` is a category with pullbacks and terminal object such that each base change functor has a right adjoint, called the pushforward functor.
85 |
86 | In this file we prove the equivalence of these conditions.
87 | -/
88 |
89 | attribute [local instance] monoidalOfHasFiniteProducts
90 |
91 |
92 | variable {C : Type} [Category C] [HasTerminal C] [HasBinaryProducts C]
93 |
94 | #check MonoidalCategory
95 | #print CartesianClosed
96 |
97 | #check monoidalOfHasFiniteProducts
98 |
99 | #synth (MonoidalCategory C)
100 |
101 | example : MonoidalCategory C := by apply monoidalOfHasFiniteProducts
102 |
103 | #check MonoidalClosed
104 |
105 | variable (C : Type*) [Category C] [HasFiniteProducts C] [HasPullbacks C]
106 |
107 | #check Comma
108 |
109 | #check Over
110 |
111 | #check CategoryTheory.Limits.pullback
112 |
113 | #check baseChange
114 |
115 |
116 | #check IsLeftAdjoint
117 |
118 |
119 | #check Over
120 |
121 |
122 | class LocallyCartesianClosed' where
123 | pushforward {X Y : C} (f : X ⟶ Y) : IsLeftAdjoint (baseChange f) := by infer_instance
124 |
125 | class LocallyCartesianClosed where
126 | pushforward {X Y : C} (f : X ⟶ Y) : Over X ⥤ Over Y
127 | adj (f : X ⟶ Y) : baseChange f ⊣ pushforward f := by infer_instance
128 |
129 | namespace LocallyCartesianClosed
130 |
131 | example [HasFiniteLimits C] : HasFiniteProducts C := by infer_instance
132 |
133 | set_option trace.Meta.synthInstance.instances true in
134 | example [HasFiniteWidePullbacks C] {I : C} : HasFiniteLimits (Over I ) := by infer_instance
135 |
136 | #check Over.hasFiniteLimits
137 |
138 | example [LocallyCartesianClosed C] [HasFiniteWidePullbacks C] : HasFiniteLimits (Over (terminal C)) := by infer_instance
139 |
140 | #check Adjunction
141 |
142 | def cartesianClosedOfOver [LocallyCartesianClosed C] [HasFiniteWidePullbacks C]
143 | {I : C} : CartesianClosed (Over I) where
144 | closed := fun f => {
145 | rightAdj := baseChange f.hom ⋙ pushforward f.hom
146 | adj := by
147 | apply ofNatIsoLeft
148 | · apply Adjunction.comp
149 | · exact (LocallyCartesianClosed.adj f.hom)
150 | · exact (hasPullbackOverAdj f.hom)
151 | · apply NatIso.ofComponents
152 | · sorry
153 | · sorry
154 | }
155 |
156 | end LocallyCartesianClosed
157 |
158 | #check LocallyCartesianClosed
159 |
160 | -- Every locally cartesian closed category is cartesian closed.
161 |
162 | namespace LocallyCartesianClosed
163 |
164 | variable {C : Type*} [Category C] [HasTerminal C] [HasFiniteProducts C] [HasPullbacks C]
165 |
166 |
167 | example [LocallyCartesianClosed C] : CartesianClosed C where
168 | closed X := {
169 | rightAdj := sorry
170 | adj := sorry
171 | }
172 |
173 |
174 |
175 | end LocallyCartesianClosed
176 |
177 |
178 |
179 |
180 |
181 | -- The slices of a locally cartesian closed category are locally cartesian closed.
182 |
183 | #check Over.iteratedSliceEquiv
184 |
185 |
186 |
187 | #check CartesianClosed
188 |
189 | -- class LCCC where
190 | -- slice : ∀ I : C, CartesianClosed (Over I)
191 |
--------------------------------------------------------------------------------
/Poly/deprecated/LCCC/BeckChevalley.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2024 Emily Riehl. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Emily Riehl, Sina Hazratpour
5 | -/
6 |
7 | import Poly.Exponentiable
8 |
9 | /-!
10 | # Beck-Chevalley natural transformations and natural isomorphisms
11 | -/
12 |
13 | noncomputable section
14 | namespace CategoryTheory
15 |
16 | open Category Functor Adjunction Limits NatTrans
17 |
18 | universe v u
19 |
20 | namespace Over
21 | variable {C : Type u} [Category.{v} C]
22 |
23 | section BeckChevalleyTransformations
24 |
25 | theorem mapSquare_eq {W X Y Z : C}
26 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
27 | (w : f ≫ g = h ≫ k) :
28 | Over.map f ⋙ Over.map g = Over.map h ⋙ Over.map k := by
29 | rw [← mapComp_eq, w, mapComp_eq]
30 |
31 | /-- The Beck Chevalley transformations are iterated mates of this isomorphism.-/
32 | def mapSquareIso {W X Y Z : C}
33 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
34 | (w : f ≫ g = h ≫ k) :
35 | Over.map f ⋙ Over.map g ≅ Over.map h ⋙ Over.map k :=
36 | eqToIso (mapSquare_eq f g h k w)
37 |
38 | -- Is this better or worse?
39 | def mapSquareIso' {W X Y Z : C}
40 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
41 | (w : f ≫ g = h ≫ k) :
42 | Over.map f ⋙ Over.map g ≅ Over.map h ⋙ Over.map k := by
43 | rw [mapSquare_eq]
44 | exact w
45 |
46 | /-- The Beck-Chevalley natural transformation. -/
47 | def pullbackBeckChevalleyNatTrans [HasPullbacks C] {W X Y Z : C}
48 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
49 | (w : f ≫ g = h ≫ k) :
50 | pullback h ⋙ Over.map f ⟶ Over.map k ⋙ pullback g :=
51 | (mateEquiv (mapPullbackAdj h) (mapPullbackAdj g)) ((mapSquareIso f g h k w).hom)
52 |
53 | def pullbackBeckChevalleyOfMap [HasPullbacks C] {X Y : C}
54 | (f : X ⟶ Y) : pullback f ⋙ forget X ⟶ forget Y := by
55 | have := (mapForgetIso f).inv
56 | rw [← Functor.comp_id (forget X)] at this
57 | exact (mateEquiv (mapPullbackAdj f) (Adjunction.id)) (this)
58 |
59 | /-- The conjugate isomorphism between the pullbacks along a commutative square. -/
60 | def pullbackSquareIso [HasPullbacks C] {W X Y Z : C}
61 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
62 | (w : f ≫ g = h ≫ k) :
63 | pullback k ⋙ pullback h ≅ pullback g ⋙ pullback f :=
64 | conjugateIsoEquiv ((mapPullbackAdj h).comp (mapPullbackAdj k)) ((mapPullbackAdj f).comp
65 | (mapPullbackAdj g)) (mapSquareIso f g h k w)
66 |
67 | /-- The Beck-Chevalley natural transformations in a square of pullbacks and pushforwards.-/
68 | def pushforwardBeckChevalleyNatTrans [HasPullbacks C] {W X Y Z : C}
69 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
70 | (w : f ≫ g = h ≫ k) (gexp : CartesianExponentiable g) (hexp : CartesianExponentiable h)
71 | : gexp.functor ⋙ pullback k ⟶ pullback f ⋙ hexp.functor :=
72 | conjugateEquiv ((mapPullbackAdj k).comp gexp.adj) (hexp.adj.comp (mapPullbackAdj f))
73 | (pullbackBeckChevalleyNatTrans f g h k w)
74 |
75 | /-- The conjugate isomorphism between the pushforwards along a commutative square. -/
76 | def pushforwardSquareIso [HasPullbacks C] {W X Y Z : C}
77 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
78 | (w : f ≫ g = h ≫ k) (fexp : CartesianExponentiable f)
79 | (gexp : CartesianExponentiable g) (hexp : CartesianExponentiable h)
80 | (kexp : CartesianExponentiable k) :
81 | fexp.functor ⋙ gexp.functor ≅ hexp.functor ⋙ kexp.functor :=
82 | conjugateIsoEquiv (gexp.adj.comp fexp.adj) (kexp.adj.comp hexp.adj) (pullbackSquareIso f g h k w)
83 |
84 | end BeckChevalleyTransformations
85 |
86 | end Over
87 |
88 | section BeckChevalleyIsos
89 |
90 | variable {C : Type u} [Category.{v} C]
91 |
92 | open IsPullback Over
93 |
94 | /-- Calculating the counit components of mapAdjunction. -/
95 | theorem mapPullbackAdj.counit.app_pullback.fst [HasPullbacks C] {X Y : C} (f : X ⟶ Y) (y : Over Y) :
96 | ((mapPullbackAdj f).counit.app y).left = pullback.fst _ _ := by simp
97 |
98 | def pullbackNatTrans.app.map [HasPullbacks C] {W X Y Z : C}
99 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
100 | (w : f ≫ g = h ≫ k) (y : Over Y) :
101 | (forget X).obj ((pullback h ⋙ map f).obj y) ⟶ (forget X).obj ((map k ⋙ pullback g).obj y) :=
102 | pullback.map y.hom h (y.hom ≫ k) g (𝟙 y.left) f k (Eq.symm (id_comp (y.hom ≫ k))) w.symm
103 |
104 | theorem pullbackBeckChevalleyComponent_pullbackMap [HasPullbacks C] {W X Y Z : C}
105 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
106 | (w : f ≫ g = h ≫ k) (y : Over Y) :
107 | (forget X).map ((pullbackBeckChevalleyNatTrans f g h k w).app y) =
108 | pullbackNatTrans.app.map f g h k w y := by
109 | dsimp
110 | ext <;> simp [pullbackNatTrans.app.map, pullbackBeckChevalleyNatTrans, mapSquareIso]
111 |
112 | -- NB: I seem to have symmetry of HasPullback but not IsPullback
113 | -- SH: yes, we do have that: it is given by the function `.flip`
114 | theorem pullbackNatTrans_of_IsPullback_component_is_iso [HasPullbacks C] {W X Y Z : C}
115 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
116 | (pb : IsPullback f h g k)
117 | (y : Over Y) :
118 | IsIso ((forget X).map ((pullbackBeckChevalleyNatTrans f g h k pb.w).app y)) := by
119 | rw [pullbackBeckChevalleyComponent_pullbackMap f g h k pb.w y]
120 | have P := pasteHorizIsPullback rfl (isLimit pb.flip) (pullbackIsPullback y.hom h)
121 | have Q := pullbackIsPullback (y.hom ≫ k) g
122 | let conemap :
123 | (PullbackCone.mk _ _
124 | (show pullback.fst y.hom h ≫ y.hom ≫ k = (pullback.snd y.hom h ≫ f) ≫ g by
125 | simp [reassoc_of% pullback.condition (f := y.hom) (g := h), pb.w])) ⟶
126 | (PullbackCone.mk
127 | (pullback.fst (y.hom ≫ k) g) (pullback.snd _ _) pullback.condition) := {
128 | hom := pullbackNatTrans.app.map f g h k pb.w y
129 | w := by
130 | rintro (_|(left|right)) <;>
131 | · unfold pullbackNatTrans.app.map
132 | simp
133 | }
134 | haveI mapiso := IsLimit.hom_isIso P Q conemap
135 | exact ((Cones.forget _).map_isIso conemap)
136 |
137 | /-- The pullback Beck-Chevalley natural transformation of a pullback square is an isomorphism. -/
138 | instance pullbackBeckChevalleyNatTrans_of_IsPullback_is_iso [HasPullbacks C] {W X Y Z : C}
139 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z) (pb : IsPullback f h g k) :
140 | IsIso (pullbackBeckChevalleyNatTrans f g h k pb.w) := by
141 | apply (config := { allowSynthFailures:= true}) NatIso.isIso_of_isIso_app
142 | intro y
143 | have := pullbackNatTrans_of_IsPullback_component_is_iso f g h k pb y
144 | apply (forget_reflects_iso (X := X)).reflects
145 | ((pullbackBeckChevalleyNatTrans f g h k pb.w).app y)
146 |
147 | /-- The pushforward Beck-Chevalley natural transformation of a pullback square is an isomorphism. -/
148 | instance pushforwardBeckChevalleyNatTrans_of_IsPullback_is_iso [HasPullbacks C] {W X Y Z : C}
149 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
150 | (pb : IsPullback f h g k)
151 | (gexp : CartesianExponentiable g) (hexp : CartesianExponentiable h) :
152 | IsIso (pushforwardBeckChevalleyNatTrans f g h k pb.w gexp hexp) := by
153 | have := pullbackBeckChevalleyNatTrans_of_IsPullback_is_iso f g h k pb
154 | apply conjugateEquiv_iso
155 |
156 | /-- The pushforward Beck-Chevalley natural transformation of a pullback square is an isomorphism. -/
157 | instance pushforwardBeckChevalleyNatTrans_of_isPullback_isIso [HasPullbacks C] {W X Y Z : C}
158 | (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z)
159 | (pb : IsPullback f h g k)
160 | (gexp : CartesianExponentiable g) (hexp : CartesianExponentiable h) :
161 | IsIso (pushforwardBeckChevalleyNatTrans f g h k pb.w gexp hexp) := by
162 | have := pullbackBeckChevalleyNatTrans_of_IsPullback_is_iso f g h k pb
163 | apply conjugateEquiv_iso
164 |
165 | end BeckChevalleyIsos
166 |
--------------------------------------------------------------------------------
/Poly/deprecated/LCCC/Presheaf.lean:
--------------------------------------------------------------------------------
1 | import Mathlib.CategoryTheory.Closed.Types
2 | import Mathlib.CategoryTheory.Limits.Constructions.Over.Basic
3 |
4 | /-!
5 | The category of presheaves on a (small) cat C is an LCCC:
6 | (1) the category of presheaves on a (small) cat C is a CCC.
7 | (2) the category of elements of a presheaf P is the comma category (yoneda, P)
8 | (3) the slice of presheaves over P is presheaves on (yoneda, P).
9 | (4) every slice is a CCC by (1).
10 | (5) use the results in the file on LCCCs to infer that presheaves is LCC.
11 | -/
12 |
13 | namespace CategoryTheory
14 |
15 | universe u v w
16 |
17 | open Category Limits Functor Adjunction Over Opposite Equivalence Presheaf
18 |
19 | /-!
20 | # 1. Presheaves are a CCC
21 | The category of presheaves on a small category is cartesian closed
22 | -/
23 |
24 | noncomputable section
25 |
26 | @[simp]
27 | abbrev Psh (C : Type u) [Category.{v} C] : Type (max u (v + 1)) := Cᵒᵖ ⥤ Type v
28 |
29 | /-- `Psh C` is cartesian closed when `C` is small
30 | (has hom-types and objects in the same universe). -/
31 | def diagCCC {C : Type u} [Category.{u} C] : CartesianClosed (Psh C) :=
32 | inferInstance
33 |
34 | def presheafCCC {C : Type u} [SmallCategory C] : CartesianClosed (Psh C) :=
35 | diagCCC
36 |
37 | /-!
38 | # 2. The category of elements
39 | The category of elements of a *contravariant* functor P : Cᵒᵖ ⥤ Type is the opposite of the
40 | category of elements of P regarded as a covariant functor P : Cᵒᵖ ⥤ Type. Thus an object of
41 | `(Elements P)ᵒᵖ` is a pair `(X : C, x : P.obj X)` and a morphism `(X, x) ⟶ (Y, y)` is a
42 | morphism `f : X ⟶ Y` in `C` for which `P.map f` takes `y` back to `x`.
43 | We have an equivalence (Elements P)ᵒᵖ ≌ (yoneda, P).
44 | In MathLib the comma category is called the ``costructured arrow category''.
45 | -/
46 |
47 | namespace CategoryOfElements
48 |
49 |
50 | def equivPsh {C : Type u} {D : Type v} [Category.{w} C] [Category.{w} D] (e : C ≌ D) : Psh C ≌ Psh D := by
51 | apply congrLeft e.op
52 |
53 | variable {C : Type u} [Category.{v} C]
54 |
55 | def presheafElementsOpIsPshCostructuredArrow (P : Psh C) : Psh (Elements P)ᵒᵖ ≌ Psh (CostructuredArrow yoneda P) :=
56 | equivPsh (costructuredArrowYonedaEquivalence P)
57 |
58 | /-!
59 | # 3. The slice category of presheaves
60 | The slice category (Psh C)/P is called the "over category" in MathLib and written "Over P".
61 | -/
62 |
63 | def overPshIsPshElementsOp {P : Psh C} : Over P ≌ Psh ((Elements P)ᵒᵖ) :=
64 | Equivalence.trans (overEquivPresheafCostructuredArrow P) (symm <| equivPsh (costructuredArrowYonedaEquivalence P))
65 |
66 | /-!
67 | # 4. The slice category Psh(C)/P is a CCC
68 | We transfer the CCC structure across the equivalence (Psh C)/P ≃ Psh((Elements P)ᵒᵖ)
69 | using the following:
70 | def cartesianClosedOfEquiv (e : C ≌ D) [CartesianClosed C] : CartesianClosed D :=
71 | MonoidalClosed.ofEquiv (e.inverse.toMonoidalFunctorOfHasFiniteProducts) e.symm.toAdjunction
72 | -/
73 |
74 | attribute [local instance] ChosenFiniteProducts.ofFiniteProducts
75 |
76 | def presheafOverCCC {C : Type u} [Category.{max u v} C] (P : Psh C) : CartesianClosed (Over P) :=
77 | cartesianClosedOfEquiv overPshIsPshElementsOp.symm
78 |
79 | def allPresheafOverCCC {C : Type u} [Category.{max u v} C] : Π (P : Psh C), CartesianClosed (Over P) :=
80 | fun P => (presheafOverCCC P)
81 |
82 | end CategoryOfElements
83 |
84 | /-!
85 | # 5. Presheaves is an LCCC
86 | Use results in the file on locally cartesian closed categories.
87 | -/
88 |
89 | /-!
90 | # Some references
91 |
92 | 1. Wellfounded trees and dependent polynomial functors.Gambino, Nicola; Hyland, Martin. Types for proofs and programs. International workshop, TYPES 2003, Torino, Italy, 2003. Revised selected papers.. Springer Berlin, 2004. p. 210-225.
93 |
94 | 2. Tamara Von Glehn. Polynomials and models of type theory. PhD thesis, University of Cambridge, 2015.
95 |
96 | 3. Joachim Kock. Data types with symmetries and polynomial functors over groupoids. Electronic Notes in Theoretical Computer Science, 286:351–365, 2012. Proceedings of the 28th Conference on the Mathematical Foundations of Programming Semantics (MFPS XXVIII).
97 |
98 | 4. Jean-Yves Girard. Normal functors, power series and λ-calculus. Ann. Pure Appl. Logic, 37(2):129–177, 1988. doi:10.1016/0168-0072(88)90025-5.
99 |
100 | 5. David Gepner, Rune Haugseng, and Joachim Kock. 8-Operads as analytic monads. Interna- tional Mathematics Research Notices, 2021.
101 |
102 | 6. Nicola Gambino and Joachim Kock. Polynomial functors and polynomial monads. Mathematical Proceedings of the Cambridge Philosophical Society, 154(1):153–192, 2013.
103 |
104 | 7. Marcelo Fiore, Nicola Gambino, Martin Hyland, and Glynn Winskel. The cartesian closed bicategory of generalised species of structures. J. Lond. Math. Soc. (2), 77(1):203–220, 2008.
105 |
106 | 8. M. Fiore, N. Gambino, M. Hyland, and G. Winskel. Relative pseudomonads, Kleisli bicategories, and substitution monoidal structures. Selecta Mathematica, 24(3):2791–2830, 2018.
107 |
108 | 9. Steve Awodey and Clive Newstead. Polynomial pseudomonads and dependent type theory, 2018.
109 |
110 | 10. Steve Awodey, Natural models of homotopy type theory, Mathematical Structures in Computer Science, 28 2 (2016) 241-286, arXiv:1406.3219.
111 |
112 | -/
113 |
--------------------------------------------------------------------------------
/Poly/deprecated/LCCC/Presheaf_test.lean:
--------------------------------------------------------------------------------
1 | /-
2 | The category of presheaves on a (small) cat C is an LCCC:
3 | (1) the category of presheaves on a (small) cat C is a CCC.
4 | (2) the category of elements of a presheaf P is the comma category (yoneda, P)
5 | (3) the slice of presheaves over P is presheaves on (yoneda, P).
6 | (4) every slice is a CCC by (1).
7 | (5) use the results in the file on LCCCs to infer that presheaves is LCC.
8 | -/
9 |
10 | import Mathlib.CategoryTheory.Closed.Types
11 | import Mathlib.CategoryTheory.Limits.Constructions.Over.Basic
12 | import Mathlib.CategoryTheory.Limits.Presheaf
13 |
14 | /- the rest of these are apparently dependent on the above -/
15 | --import Mathlib.CategoryTheory.Yoneda
16 | --import Mathlib.CategoryTheory.Category.Basic
17 | --import Mathlib.CategoryTheory.Closed.Monoidal
18 | --import Mathlib.CategoryTheory.Closed.Cartesian
19 | --import Mathlib.CategoryTheory.Adjunction.Mates
20 | --import Mathlib.CategoryTheory.Adjunction.Over
21 | --import Mathlib.CategoryTheory.Opposites
22 | --import Mathlib.CategoryTheory.Elements
23 | --import Mathlib.CategoryTheory.Equivalence
24 | --import Mathlib.CategoryTheory.Comma.Presheaf
25 | --import Mathlib.CategoryTheory.Closed.Cartesian
26 |
27 | namespace CategoryTheory
28 |
29 | universe u v w
30 |
31 | variable {C : Type u} [Category.{v} C]
32 |
33 | open Category Limits Functor Adjunction Over Opposite Equivalence Presheaf
34 |
35 | /-!
36 | # 1. Presheaves are a CCC
37 | The category of presheaves on a small category is cartesian closed
38 | -/
39 |
40 | noncomputable section
41 |
42 | variable (C)
43 |
44 | @[simp]
45 | abbrev Psh := Cᵒᵖ ⥤ Type w
46 | #print Psh
47 | variable {C}
48 |
49 | #check SmallCategory
50 |
51 | set_option pp.mvars true
52 |
53 | open Lean Elab Term Meta Command
54 | elab "#synth'" term:term : command => do
55 | withoutModifyingEnv <| runTermElabM fun _ => Term.withDeclName `_synth_cmd do
56 | let inst ← Term.elabTerm term none
57 | Term.synthesizeSyntheticMVarsNoPostponing
58 | let inst ← instantiateMVars inst
59 | let val ← synthInstance inst
60 | let val ← Term.levelMVarToParam (← instantiateMVars val)
61 | logInfo val
62 | pure ()
63 | set_option trace.Meta.synthInstance true
64 | #synth LargeCategory (Type w)
65 | #synth' LargeCategory (Psh C) -- how to print instances?
66 |
67 | set_option pp.universes true
68 | #synth' SmallCategory (Psh C)
69 |
70 | #check fun F G : Psh.{u,v,w} C => F ⟶ G
71 | instance : CartesianClosed (Psh C) := by
72 | infer_instance
73 |
74 | def diagCCC : CartesianClosed (Psh C) :=
75 | CartesianClosed.mk _
76 | (fun F => by
77 | letI := FunctorCategory.prodPreservesColimits F
78 | have := isLeftAdjoint_of_preservesColimits (prod.functor.obj F)
79 | exact Exponentiable.mk _ _ (Adjunction.ofIsLeftAdjoint (prod.functor.obj F)))
80 |
81 | def presheafCCC {C : Type v₁} [SmallCategory C] : CartesianClosed (Psh C) :=
82 | diagCCC
83 |
84 | /-!
85 | # 2. The category of elements
86 | The category of elements of a *contravariant* functor P : Cᵒᵖ ⥤ Type is the opposite of the category of elements of P regarded as a covariant functor P : Cᵒᵖ ⥤ Type. Thus an object of `(Elements P)ᵒᵖ` is a pair `(X : C, x : P.obj X)` and a morphism `(X, x) ⟶ (Y, y)` is a morphism `f : X ⟶ Y` in `C` for which `P.map f` takes `y` back to `x`.
87 | We have an equivalence (Elements P)ᵒᵖ ≌ (yoneda, P).
88 | In MathLib the comma category is called the ``costructured arrow category''.
89 | -/
90 |
91 | namespace CategoryOfElements
92 |
93 | def equivPsh {C D : Type*} [Category C] [Category D] (e : C ≌ D) :
94 | (Psh C ≌ Psh D) := by
95 | apply congrLeft e.op
96 |
97 | def presheafElementsOpIsPshCostructuredArrow (P : Psh C) : Psh (Elements P)ᵒᵖ ≌ Psh (CostructuredArrow yoneda P) :=
98 | equivPsh (costructuredArrowYonedaEquivalence P)
99 |
100 | /-!
101 | # 3. The slice category of presheaves
102 | The slice category (Psh C)/P is called the "over category" in MathLib and written "Over P".
103 | -/
104 |
105 | def overPshIsPshElementsOp {P : Psh.{u,v,max v w} C} : Over P ≌ Psh ((Elements P)ᵒᵖ) :=
106 | Equivalence.trans (overEquivPresheafCostructuredArrow P) (symm <| equivPsh (costructuredArrowYonedaEquivalence P))
107 |
108 | /-!
109 | # 4. The slice category Psh(C)/P is a CCC
110 | We transfer the CCC structure across the equivalence (Psh C)/P ≃ Psh((Elements P)ᵒᵖ) using the following:
111 | def cartesianClosedOfEquiv (e : C ≌ D) [CartesianClosed C] : CartesianClosed D := MonoidalClosed.ofEquiv (e.inverse.toMonoidalFunctorOfHasFiniteProducts) e.symm.toAdjunction
112 | -/
113 |
114 | def presheafOverCCC (P : Psh C) : CartesianClosed (Over P) :=
115 | cartesianClosedOfEquiv overPshIsPshElementsOp.symm
116 |
117 | def allPresheafOverCCC : Π (P : Psh C), CartesianClosed (Over P) :=
118 | fun P => (presheafOverCCC P)
119 |
120 | end CategoryOfElements
121 | /-!
122 | # 5. Presheaves is an LCCC
123 | Use results in the file on locally cartesian closed categories.
124 | -/
125 |
126 | /-!
127 | # Some references
128 |
129 | 1. Wellfounded trees and dependent polynomial functors.Gambino, Nicola; Hyland, Martin. Types for proofs and programs. International workshop, TYPES 2003, Torino, Italy, 2003. Revised selected papers.. Springer Berlin, 2004. p. 210-225.
130 |
131 | 2. Tamara Von Glehn. Polynomials and models of type theory. PhD thesis, University of Cambridge, 2015.
132 |
133 | 3. Joachim Kock. Data types with symmetries and polynomial functors over groupoids. Electronic Notes in Theoretical Computer Science, 286:351–365, 2012. Proceedings of the 28th Conference on the Mathematical Foundations of Programming Semantics (MFPS XXVIII).
134 |
135 | 4. Jean-Yves Girard. Normal functors, power series and λ-calculus. Ann. Pure Appl. Logic, 37(2):129–177, 1988. doi:10.1016/0168-0072(88)90025-5.
136 |
137 | 5. David Gepner, Rune Haugseng, and Joachim Kock. 8-Operads as analytic monads. Interna- tional Mathematics Research Notices, 2021.
138 |
139 | 6. Nicola Gambino and Joachim Kock. Polynomial functors and polynomial monads. Mathematical Proceedings of the Cambridge Philosophical Society, 154(1):153–192, 2013.
140 |
141 | 7. Marcelo Fiore, Nicola Gambino, Martin Hyland, and Glynn Winskel. The cartesian closed bicategory of generalised species of structures. J. Lond. Math. Soc. (2), 77(1):203–220, 2008.
142 |
143 | 8. M. Fiore, N. Gambino, M. Hyland, and G. Winskel. Relative pseudomonads, Kleisli bicategories, and substitution monoidal structures. Selecta Mathematica, 24(3):2791–2830, 2018.
144 |
145 | 9. Steve Awodey and Clive Newstead. Polynomial pseudomonads and dependent type theory, 2018.
146 |
147 | 10. Steve Awodey, Natural models of homotopy type theory, Mathematical Structures in Computer Science, 28 2 (2016) 241-286, arXiv:1406.3219.
148 |
149 | -/
150 |
--------------------------------------------------------------------------------
/Poly/deprecated/LawvereTheory.lean:
--------------------------------------------------------------------------------
1 | -- (Tambara) The skeleton of the category `T` whose objects are finite sets and whose morphisms are the finite polynomials is the Lawvere theory of commutative semirings.
2 | -- D. Tambara, On multiplicative transfer, Comm. Alg. 21 (1993), 1393–1420.
3 |
--------------------------------------------------------------------------------
/Poly/deprecated/Slice.lean:
--------------------------------------------------------------------------------
1 | /-
2 | Copyright (c) 2024 Emily Riehl. All rights reserved.
3 | Released under Apache 2.0 license as described in the file LICENSE.
4 | Authors: Emily Riehl
5 | -/
6 |
7 | import Mathlib.CategoryTheory.Functor.Basic
8 |
9 | /-!
10 | # Slice categories from scratch
11 | -/
12 |
13 | namespace CategoryTheory
14 |
15 | open Category Functor
16 |
17 | universe v u
18 |
19 | variable {C D : Type u} [Category.{v} C][Category.{v} D]
20 |
21 | theorem LeftIdFunctor (F : C ⥤ D) : (𝟭 C ⋙ F) = F := by
22 | dsimp [Functor.comp]
23 |
24 | theorem RightIdFunctor (F : C ⥤ D) : (F ⋙ 𝟭 D) = F := by
25 | dsimp [Functor.comp]
26 |
27 | -- ER: What does structure mean?
28 | structure Slice (X : C) : Type max u v where
29 | dom : C
30 | hom : dom ⟶ X
31 |
32 | -- Satisfying the inhabited linter -- ER: What is this?
33 | instance Slice.inhabited [Inhabited C] : Inhabited (Slice (C := C) default) where
34 | default :=
35 | { dom := default
36 | hom := 𝟙 default }
37 |
38 | -- Generates SliceMorphism.ext; see a test below
39 | @[ext]
40 | structure SliceMorphism {X : C}(f g : Slice X) where
41 | dom : f.dom ⟶ g.dom
42 | w : dom ≫ g.hom = f.hom := by aesop_cat -- What is this?
43 |
44 | instance sliceCategory (X : C) : Category (Slice X) where
45 | Hom f g := SliceMorphism f g
46 | id f := {
47 | dom := 𝟙 f.dom
48 | }
49 | comp {f g h : Slice X} u v := {
50 | dom := u.dom ≫ v.dom
51 | w := by rw [assoc, v.w, u.w]
52 | }
53 |
54 | -- Test of SliceMorphism.ext
55 | theorem test {X : C} {f g : Slice X} {u v : f ⟶ g}
56 | (h : u.dom = v.dom) : u = v := by
57 | apply SliceMorphism.ext
58 | exact h
59 |
60 | @[simps]
61 | def project (X : C) : (Slice X) ⥤ C where
62 | obj f := f.dom
63 | map u := u.dom
64 |
65 | def compFunctor {X Y : C} (f : X ⟶ Y) : (Slice X) ⥤ (Slice Y) where
66 | obj x := {
67 | dom := x.dom
68 | hom := x.hom ≫ f
69 | }
70 | map {x x' : Slice X} u := {
71 | dom := u.dom
72 | w := by rw [← assoc, u.w]
73 | }
74 |
75 | theorem compFunctorial.comp {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) :
76 | compFunctor f ⋙ compFunctor g = compFunctor (f ≫ g) := by
77 | dsimp [sliceCategory, Functor.comp, compFunctor]
78 | congr! 4
79 | · rw [assoc]
80 | · subst_vars
81 | congr! 3 <;> rw [assoc]
82 |
83 | -- show ({obj := {..}, ..} : Comma _ _ ⥤ Comma _ _ ) = {..}
84 | -- congr 2
85 | -- rfl
86 |
87 | -- theorem Over.postComp.square {W X Y Z : C}
88 | -- (f : W ⟶ X) (g : X ⟶ Z) (h : W ⟶ Y) (k : Y ⟶ Z) (w : f ≫ g = h ≫ k) :
89 | -- Over.map f ⋙ Over.map g = Over.map h ⋙ Over.map k := by
90 | -- sorry
91 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://opensource.org/licenses/Apache-2.0)
2 | [](https://sinhp.github.io/groupoid_model_in_lean4/docs/Poly/UvPoly.html)
3 | [](https://sinhp.github.io/groupoid_model_in_lean4/blueprint/sect0005.html)
4 |
5 | [Proofs Verified with Lean4 (leanprover/lean4:v4.18.0-rc1)](https://github.com/sinhp/LeanHomotopyFrobenius/blob/master/lean-toolchain)
6 |
7 | # Lean4 Formalization Of Polynomial Functors
8 |
9 | This repository is a [Lean 4](https://github.com/leanprover/lean4) formalization of the theory of Polynomial Functors. Polynomial Functors categorify polynomial functions.
10 |
11 | We use this repository as a dependency in the [HoTTLean](https://github.com/sinhp/groupoid_model_in_lean4) project.
12 |
13 | ## Content (under development)
14 |
15 | As part of this formalization, we also formalize locally cartesian closed categories in Lean4.
16 |
17 | - [x] Locally cartesian closed categories
18 | - [x] The Beck-Chevalley condition in LCCC
19 | - [x] LCCC structure on types
20 | - [x] LCCC structure on presheaves of types
21 |
22 | - [ ] Univariate Polynomial Functors
23 | - [x] Definition of univariate polynomial functors
24 | - [x] The construction of associated polynomial functors
25 | - [x] Monomials
26 | - [x] Linear polynomials
27 | - [x] Sums of polynomials
28 | - [ ] Products of polynomials
29 | - [x] Composition of polynomials
30 | - [x] The classifying property of polynomial functors
31 | - [x] The monoidal category `C [X]` of univariate polynomial functors
32 | - [ ] Cartesian closedness of a category of polynomial functors
33 |
34 | - [ ] Multivariate Polynomial Functors
35 | - [x] Definition of multivariate polynomial functors
36 | - [x] The construction of associated polynomial functors
37 | - [x] Monomials
38 | - [x] Linear polynomials
39 | - [ ] Symmetric polynomials
40 | - [ ] Sums of polynomials
41 | - [ ] Products of polynomials
42 | - [x] Composition of polynomials
43 | - [ ] The classifying property of polynomial functors
44 | - [ ] The bicategory of multivariate polynomial functors
45 | - [ ] The double category of polynomial functors
46 | - [ ] Differentiation
47 |
48 | - [ ] Induction, Well-foundedtrees, Transfinite Induction
49 |
50 | - [ ] Polynomial functors and the semantics of linear logic
51 | - [ ] A relational presentation of polynomial functors
52 | - [ ] The differential calculus of polynomials
53 |
54 | - [ ] Polynomial functors and generalized combinatorial species
55 |
56 | ## Acknowledgment
57 |
58 | The work was started during the Trimester Program "Prospects of formal mathematics" at the Hausdorff Institute (HIM) in Bonn.
59 |
60 | ### Resources
61 |
62 | #### Main references used in the formalization
63 |
64 | > - [Wellfounded Trees and Dependent Polynomial Functors, Nicola Gambino⋆ and Martin Hyland](https://www.dpmms.cam.ac.uk/~martin/Research/Publications/2004/gh04.pdf)
65 | > - [Tutorial on Polynomial Functors and Type Theory, Steve Awodey](https://www.cmu.edu/dietrich/philosophy/hott/slides/polytutorial.pdf)
66 | > - [Polynomial functors and polynomial monads, Nicola Gambino and Joachim Kock](https://arxiv.org/abs/0906.4931)
67 | > - [Notes on Locally Cartesian Closed Categories, Sina Hazratpour](https://sinhp.github.io/files/CT/notes_on_lcccs.pdf)
68 | > - [Notes on Polynomial Functors, Joachim Kock](https://mat.uab.cat/~kock/cat/polynomial.pdf)
69 |
70 | #### Additional references on polynomial functors
71 |
72 | > Nicola Gambino, Martin Hyland. Wellfounded trees and dependent polynomial functors. Types for proofs and programs. International workshop, TYPES 2003, Torino, Italy, 2003. Revised selected papers. Springer Berlin, 2004. p. 210-225.
73 |
74 | > Nicola Gambino and Joachim Kock. Polynomial functors and polynomial monads. Mathematical Proceedings of the Cambridge Philosophical Society, 154(1):153–192, 2013.
75 |
76 | > Joachim Kock. Data types with symmetries and polynomial functors over groupoids. Electronic Notes in Theoretical Computer Science, 286:351–365, 2012. Proceedings of the 28th Conference on the Mathematical Foundations of Programming Semantics (MFPS XXVIII).
77 |
78 | > Paul-André Melliès. Template games and differential linear logic. Proceedings of the 34th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS'19.
79 |
80 | > Marcelo Fiore, Nicola Gambino, Martin Hyland, and Glynn Winskel. The cartesian closed bicategory of generalised species of structures. J. Lond. Math. Soc. (2), 77(1):203–220, 2008.
81 |
82 | > Tamara Von Glehn. Polynomials and models of type theory. PhD thesis, University of Cambridge, 2015.
83 |
84 | > E. Finster, S. Mimram, M. Lucas, T. Seiller. A Cartesian Bicategory of Polynomial Functors in Homotopy Type Theory, MFPS 2021. https://arxiv.org/pdf/2112.14050.
85 |
86 | > Jean-Yves Girard. Normal functors, power series and λ-calculus. Ann. Pure Appl. Logic, 37(2):129–177, 1988. doi:10.1016/0168-0072(88)90025-5.
87 |
88 | > Mark Weber (2015): Polynomials in categories with pullbacks. Theory and applications of categories 30(16), pp. 533–598.
89 |
90 | > David Gepner, Rune Haugseng, and Joachim Kock. 8-Operads as analytic monads. International Mathematics Research Notices, 2021.
91 |
92 | > Steve Awodey and Clive Newstead. Polynomial pseudomonads and dependent type theory, 2018.
93 |
94 | > Steve Awodey, Natural models of homotopy type theory, Mathematical Structures in Computer Science, 28 2 (2016) 241-286, arXiv:1406.3219.
95 |
96 | > Sean K. Moss and Tamara von Glehn. Dialectica models of type theory, LICS 2018.
97 |
98 | > Thorsten Altenkirch, Neil Ghani, Peter Hancock, Conor McBride, Peter Morris. Indexed containers. Journal of Functional Programming 25, 2015.
99 |
100 | > Jakob Vidmar (2018): Polynomial functors and W-types for groupoids. Ph.D. thesis, University of Leeds.
101 |
--------------------------------------------------------------------------------
/blueprint/src/Packages/bussproofs.py:
--------------------------------------------------------------------------------
1 | from plasTeX import VerbatimEnvironment
2 |
3 | def ProcessOptions(options, document):
4 | document.config['images']['scales'].setdefault('prooftree', 1.5)
5 |
6 | class prooftree(VerbatimEnvironment):
7 | pass
8 |
--------------------------------------------------------------------------------
/blueprint/src/Templates/prooftree.jinja2:
--------------------------------------------------------------------------------
1 |
3 | {% if obj.renderer.vectorImager.enabled %}
4 |

5 | {% else %}
6 |

7 | {% endif %}
8 |
9 |
--------------------------------------------------------------------------------
/blueprint/src/blueprint.sty:
--------------------------------------------------------------------------------
1 | \DeclareOption*{}
2 | \ProcessOptions
--------------------------------------------------------------------------------
/blueprint/src/chapter/all.tex:
--------------------------------------------------------------------------------
1 | % This file collects all the blueprint chapters.
2 | % It is not supposed to be built standalone:
3 | % see web.tex and print.tex instead.
4 |
5 | \title{Polynomial Functors in Lean4}
6 | \author{Sina Hazratpour}
7 |
8 | \begin{document}
9 | \maketitle
10 |
11 | \chapter{Locally Cartesian Closed Categories}
12 | \input{chapter/lccc}
13 | \chapter{Univaiate Polynomial Functors}
14 | \input{chapter/uvpoly}
15 | \chapter{Multivariate Polynomial Functors}
16 | \input{chapter/mvpoly}
17 |
18 | % \bibliography{refs.bib}{}
19 | % \bibliographystyle{alpha}
20 |
21 | \end{document}
22 |
--------------------------------------------------------------------------------
/blueprint/src/chapter/lccc.tex:
--------------------------------------------------------------------------------
1 | \begin{definition}[exponentiable morphism]
2 | \label{defn:exponentiable-morphism}
3 | \lean{CategoryTheory.ExponentiableMorphism}
4 | \leanok
5 | Suppose $\catC$ is a category with pullbacks.
6 | A morphism $f \colon A \to B$ in $\catC$ is \textbf{exponentiable} if the pullback functor
7 | $f^* \colon \catC / B \to \catC / A$ has a right adjoint $f_*$.
8 | Since $f^*$ always has a left adjoint $f_!$, given by post-composition with $f$, an
9 | exponentiable morphism $f$ gives rise to an adjoint triple
10 | \begin{center}\begin{tikzcd}
11 | & {\catC / B} \\
12 | \\
13 | {} & {\catC / A}
14 | \arrow[""{name=0, anchor=center, inner sep=0}, "{f_*}", bend left, shift left=5, from=1-2, to=3-2]
15 | \arrow[""{name=1, anchor=center, inner sep=0}, "{f_!}"', bend right, shift right=5, from=1-2, to=3-2]
16 | \arrow[""{name=2, anchor=center, inner sep=0}, "{f^*}"{description}, from=3-2, to=1-2]
17 | \arrow["\dashv"{anchor=center}, draw=none, from=1, to=2]
18 | \arrow["\dashv"{anchor=center}, draw=none, from=2, to=0]
19 | \end{tikzcd}\end{center}
20 | \end{definition}
21 |
22 | \begin{definition}[pushforward functor]
23 | \label{rmk:pushforward}
24 | \lean{CategoryTheory.ExponentiableMorphism.pushforward}
25 | \leanok
26 | Let $f \colon A \to B$ be an exponentiable morphism in a category $\catC$ with pullbacks.
27 | We call the right adjoint $f_*$ of the pullback functor $f^*$ the \textbf{pushforward} functor
28 | along $f$.
29 | \end{definition}
30 |
31 | \begin{theorem}[exponentiable morphisms are exponentiable objects of the slices]\label{thm:exponentiable-mor-exponentiable-obj}
32 | \lean{CategoryTheory.ExponentiableMorphism.OverMkHom}
33 | \leanok
34 | \uses{defn:exponentiable-morphism}
35 | A morphism $f \colon A \to B$ in a category $\catC$ with pullbacks is exponentiable if and only if
36 | it is an exponentiable object, regarded as an object of the slice $\catC / B$.
37 | \end{theorem}
38 |
39 |
40 | \begin{definition}[Locally cartesian closed categories]\label{defn:LCCC}
41 | \lean{CategoryTheory.LocallyCartesianClosed} \leanok
42 | A category with pullbacks is \textbf{locally cartesian closed} if
43 | is a category $\catC$ with a terminal object $1$ and with all slices $\catC / A$ cartesian closed.
44 | \end{definition}
45 |
--------------------------------------------------------------------------------
/blueprint/src/chapter/mvpoly.tex:
--------------------------------------------------------------------------------
1 | Let $\catC$ be category with pullbacks and terminal object.
2 |
3 | \begin{definition}[multivariable polynomial functor]\label{defn:Polynomial}
4 | \lean{CategoryTheory.MvPoly} \leanok
5 | A \textbf{polynomial} in $\catC$ from $I$ to $O$ is a triple $(i,p,o)$ where
6 | $i$, $p$ and $o$ are morphisms in $\catC$ forming the diagram
7 | $$\polyspan IEBJipo.$$
8 | The object $I$ is the object of input variables and the object $O$ is the object of output
9 | variables. The morphism $p$ encodes the arities/exponents.
10 | \end{definition}
11 |
12 |
13 |
14 |
15 |
16 | \begin{definition}[extension of polynomial functors]
17 | \label{defn:extension}
18 | \lean{CategoryTheory.MvPoly.functor} \leanok
19 | The \textbf{extension} of a polynomial $\polyspan IBAJipo$ is the functor
20 | $\upP = o_! \, f_* \, i^* \colon \catC / I \to \catC/ O$. Internally, we can define $\upP$ by
21 | $$\upP \seqbn{X_i}{i \in I} = \seqbn{\sum_{b \in B_j} \prod_{e \in E_b} X_{s(b)}}{j \in J}$$
22 | A \textbf{polynomial functor} is a functor that is naturally isomorphic to the extension of a polynomial.
23 | \end{definition}
24 |
--------------------------------------------------------------------------------
/blueprint/src/chapter/uvpoly.tex:
--------------------------------------------------------------------------------
1 | In this section we develop some of the definitions
2 | and lemmas related to polynomial endofunctors that we will use
3 | in the rest of the notes.
4 |
5 | \medskip
6 |
7 | \begin{definition}[Polynomial endofunctor]
8 | \label{defn:UvPoly}
9 | \lean{CategoryTheory.UvPoly} \leanok
10 | Let $\catC$ be a locally Cartesian closed category
11 | (in our case, presheaves on the category of contexts).
12 | This means for each morphism $t : B \to A$ we have an adjoint triple
13 | % https://q.uiver.app/#q=WzAsMyxbMCwyXSxbMSwyLCJcXGNhdEMgLyBBIl0sWzEsMCwiXFxjYXRDIC8gQiJdLFsyLDEsInRfKiIsMCx7Im9mZnNldCI6LTV9XSxbMiwxLCJ0XyEiLDIseyJvZmZzZXQiOjV9XSxbMSwyLCJ0XioiLDFdLFs1LDMsIiIsMix7ImxldmVsIjoxLCJzdHlsZSI6eyJuYW1lIjoiYWRqdW5jdGlvbiJ9fV0sWzQsNSwiIiwyLHsibGV2ZWwiOjEsInN0eWxlIjp7Im5hbWUiOiJhZGp1bmN0aW9uIn19XV0=
14 | \begin{center}\begin{tikzcd}
15 | & {\catC / B} \\
16 | \\
17 | {} & {\catC / A}
18 | \arrow[""{name=0, anchor=center, inner sep=0}, "{t_*}", bend left, shift left=5, from=1-2, to=3-2]
19 | \arrow[""{name=1, anchor=center, inner sep=0}, "{t_!}"', bend right, shift right=5, from=1-2, to=3-2]
20 | \arrow[""{name=2, anchor=center, inner sep=0}, "{t^*}"{description}, from=3-2, to=1-2]
21 | \arrow["\dashv"{anchor=center}, draw=none, from=1, to=2]
22 | \arrow["\dashv"{anchor=center}, draw=none, from=2, to=0]
23 | \end{tikzcd}\end{center}
24 | where $t^{*}$ is pullback, and $t_{!}$ is composition with $t$.
25 |
26 | Let $t : B \to A$ be a morphism in $\catC$.
27 | Then define $\Poly{t} : \catC \to \catC$ be the composition
28 | \[
29 | \Poly{t} := A_{!} \circ t_{*} \circ B^{*}
30 | \quad \quad \quad
31 | \]
32 | % https://q.uiver.app/#q=WzAsNCxbMCwwLCJcXGNhdEMiXSxbMSwwLCJcXGNhdEMgLyBCIl0sWzIsMCwiXFxjYXRDIC8gQSJdLFszLDAsIlxcY2F0QyJdLFswLDEsIkJeKiJdLFsxLDIsInRfKiJdLFsyLDMsIkFfISJdXQ==
33 | \begin{center}\begin{tikzcd}
34 | \catC & {\catC / B} & {\catC / A} & \catC
35 | \arrow["{B^*}", from=1-1, to=1-2]
36 | \arrow["{t_*}", from=1-2, to=1-3]
37 | \arrow["{A_!}", from=1-3, to=1-4]
38 | \end{tikzcd}\end{center}
39 | \end{definition}
40 |
--------------------------------------------------------------------------------
/blueprint/src/content.tex:
--------------------------------------------------------------------------------
1 | % In this file you should put the actual content of the blueprint.
2 | % It will be used both by the web and the print version.
3 | % It should *not* include the \begin{document}
4 | %
5 | % If you want to split the blueprint content into several files then
6 | % the current file can be a simple sequence of \input. Otherwise It
7 | % can start with a \section or \chapter for instance.
--------------------------------------------------------------------------------
/blueprint/src/extra_styles.css:
--------------------------------------------------------------------------------
1 | /* This file contains CSS tweaks for this blueprint.
2 | * As an example, we included CSS rules that put
3 | * a vertical line on the left of theorem statements
4 | * and proofs.
5 | * */
6 |
7 | div.theorem_thmcontent {
8 | border-left: .15rem solid black;
9 | }
10 |
11 | div.proposition_thmcontent {
12 | border-left: .15rem solid black;
13 | }
14 |
15 | div.lemma_thmcontent {
16 | border-left: .1rem solid black;
17 | }
18 |
19 | div.corollary_thmcontent {
20 | border-left: .1rem solid black;
21 | }
22 |
23 | div.proof_content {
24 | border-left: .08rem solid grey;
25 | }
26 |
--------------------------------------------------------------------------------
/blueprint/src/latexmkrc:
--------------------------------------------------------------------------------
1 | # This file configures the latexmk command you can use to compile
2 | # the pdf version of the blueprint
3 | $pdf_mode = 1;
4 | $pdflatex = 'xelatex -synctex=1';
5 | @default_files = ('print.tex');
--------------------------------------------------------------------------------
/blueprint/src/macros/common.tex:
--------------------------------------------------------------------------------
1 | % In this file you should put all LaTeX macros and settings to be used both by
2 | % the pdf version and the web version.
3 | % This should be most of your macros.
4 |
5 | % The theorem-like environments defined below are those that appear by default
6 | % in the dependency graph. See the README of leanblueprint if you need help to
7 | % customize this.
8 | % The configuration below use the theorem counter for all those environments
9 | % (this is what the [theorem] arguments mean) and never resets it.
10 | % If you want for instance to number them within chapters then you can add
11 | % [chapter] at the end of the next line.
12 |
13 | %%%%%%% THEOREMS %%%%%%%%%
14 | \newtheorem{theorem}{Theorem}[section]
15 | \newtheorem*{theorem*}{Theorem}
16 | \newtheorem{prop}[theorem]{Proposition}
17 | \newtheorem{obs}[theorem]{Observation}
18 | \newtheorem{lemma}[theorem]{Lemma}
19 | \newtheorem{cor}[theorem]{Corollary}
20 | \newtheorem{applemma}{Lemma}[section]
21 |
22 | \theoremstyle{definition}
23 | \newtheorem{definition}[theorem]{Definition}
24 |
25 | \theoremstyle{remark}
26 | \newtheorem{rmk}[theorem]{Remark}
27 | \newtheorem*{eg}{Example}
28 | \newtheorem{ex}{Exercise}
29 | \newtheorem*{remark*}{Remark}
30 | \newtheorem*{remarks*}{Remarks}
31 | \newtheorem*{notation*}{Notation}
32 | \newtheorem*{convention*}{Convention}
33 |
34 | \newenvironment{comment}{\begin{quote} \em Comment. }{\end{quote}}
35 |
36 | %%%%%%% Relations
37 |
38 | \newcommand{\defeq}{=_{\mathrm{def}}}
39 | \newcommand{\iso}{\cong}
40 | \newcommand{\equi}{\simeq}
41 | \newcommand{\retequi}{\unlhd}
42 | \newcommand{\op}{\mathrm{op}}
43 | \newcommand{\Nat}{\mathbb{N}}
44 | % \newcommand{\co}{\colon}
45 | \newcommand{\st}{\,|\,}
46 |
47 |
48 | %%% Morphisms
49 |
50 | \newcommand{\id}{\mathsf{id}}
51 | \newcommand{\yo}{\mathsf{y}}
52 | \newcommand{\Arr}{\mathsf{Arr}}
53 | \newcommand{\CartArr}{\mathsf{CartArr}}
54 | \newcommand{\unit}{\, \mathsf{unit} \, }
55 | \newcommand{\counit}{\, \mathsf{counit} \, }
56 |
57 | %%%% Objects
58 |
59 | \newcommand{\tcat}{\mathbf}
60 | \newcommand{\catC}{\mathbb{C}}
61 | \newcommand{\pshC}{\psh{\catC}}
62 | \newcommand{\psh}[1]{\mathbf{Psh}(#1)} %% consider renaming to \Psh
63 | \newcommand{\PSH}[1]{\mathbf{PSH}(#1)}
64 | \newcommand{\set}{\tcat{set}}
65 | \newcommand{\Set}{\tcat{Set}}
66 | \newcommand{\SET}{\tcat{SET}}
67 | \newcommand{\cat}{\tcat{cat}}
68 | \newcommand{\ptcat}{\tcat{cat}_\bullet}
69 | \newcommand{\Cat}{\tcat{Cat}}
70 | \newcommand{\ptCat}{\tcat{Cat}_\bullet}
71 | \newcommand{\grpd}{\tcat{grpd}}
72 | \newcommand{\Grpd}{\tcat{Grpd}}
73 | \newcommand{\ptgrpd}{\tcat{grpd}_\bullet}
74 | \newcommand{\ptGrpd}{\tcat{Grpd}_\bullet}
75 | \newcommand{\Pshgrpd}{\mathbf{Psh}(\grpd)}
76 | \newcommand{\PshCat}{\mathbf{Psh}(\Cat)}
77 |
78 | \newcommand{\terminal}{\bullet}
79 | \newcommand{\Two}{\bullet+\bullet}
80 |
81 | %%% Polynomials
82 | \newcommand{\polyspan}[7]{#1 \xleftarrow{#5} #2 \xrightarrow{#6} #3 \xrightarrow{#7} #4}
83 | \newcommand{\PolyComp}{\lhd}
84 | \newcommand{\upP}{\mathrm{P}}
85 | \newcommand{\Poly}[1]{P_{#1}}
86 | \newcommand{\Star}[1]{{#1}^{\star}}
87 |
88 |
89 | %%%% Syntax
90 |
91 | \newcommand{\Type}{\mathsf{Ty}}
92 | \newcommand{\Term}{\mathsf{Tm}}
93 | \newcommand{\tp}{\mathsf{tp}}
94 | \newcommand{\disp}[1]{\mathsf{disp}_{#1}}
95 | \newcommand{\var}{\mathsf{var}}
96 | \newcommand{\Prop}{\mathsf{Prop}}
97 | \newcommand{\U}{\mathsf{U}}
98 | \newcommand{\E}{\mathsf{E}}
99 | \newcommand{\El}{\mathsf{El}}
100 | \newcommand{\pair}{\mathsf{pair}}
101 | \newcommand{\Id}{\mathsf{Id}}
102 | \newcommand{\refl}{\mathsf{refl}}
103 | \newcommand{\J}{\mathsf{J}}
104 | \newcommand{\fst}{\mathsf{fst}}
105 | \newcommand{\snd}{\mathsf{snd}}
106 | \newcommand{\ev}[2]{\mathsf{ev}_{#1} \, #2}
107 | \newcommand{\dom}{\mathsf{dom}}
108 | \newcommand{\cod}{\mathsf{cod}}
109 | \newcommand{\Exp}{\mathsf{Exp}}
110 | \newcommand{\fun}{\mathsf{fun}}
111 | \newcommand{\name}[1]{\ulcorner #1 \urcorner}
112 |
113 | \newcommand{\Fib}{\mathsf{Fib}}
114 | \newcommand{\lift}[2]{\mathsf{lift} \, #1 \, #2}
115 | \newcommand{\fiber}{\mathsf{fiber}}
116 | \newcommand{\Interval}{\mathbb{I}}
117 | \newcommand{\Lift}[2]{\mathsf{L}_{#1}^{#2}}
118 |
119 | %%%% Interpretation
120 |
121 | \newcommand{\doublesquarelbracket}{[\![}
122 | \newcommand{\doublesquarerbracket}{]\!]}
123 | \newcommand{\IntpCtx}[1]{\doublesquarelbracket #1 \doublesquarerbracket}
124 | \newcommand{\IntpType}[1]{\doublesquarelbracket #1 \doublesquarerbracket}
125 | \newcommand{\IntpTerm}[1]{\doublesquarelbracket #1 \doublesquarerbracket}
126 |
127 | % % Greek
128 | \newcommand{\al}{\alpha}
129 | \newcommand{\be}{\beta}
130 | \newcommand{\ga}{\gamma}
131 | \newcommand{\de}{\delta}
132 | \newcommand{\ep}{\varepsilon}
133 | \newcommand{\io}{\iota}
134 | \newcommand{\ka}{\kappa}
135 | \newcommand{\la}{\lambda}
136 | \newcommand{\om}{\omega}
137 | \newcommand{\si}{\sigma}
138 |
139 | \newcommand{\Ga}{\Gamma}
140 | \newcommand{\De}{\Delta}
141 | \newcommand{\Th}{\Theta}
142 | \newcommand{\La}{\Lambda}
143 | \newcommand{\Si}{\Sigma}
144 | \newcommand{\Om}{\Omega}
145 |
146 | % % Families
147 | \newcommand{\setbn}[2]{\left\{\left. #1 \ \middle\rvert\ #2 \right.\right\}}
148 | \newcommand{\seqbn}[2]{\left(\left. #1 \ \middle\rvert\ #2 \right.\right)}
149 | \newcommand{\sqseqbn}[2]{\left[\left. #1 \ \middle\rvert\ #2 \right.\right]}
150 | \newcommand{\append}{\mathbin{^\frown}}
151 |
152 |
153 | % % Misc
154 | % \newenvironment{bprooftree}
155 | % {\leavevmode\hbox\bgroup}
156 | % {\DisplayProof\egroup}
157 |
--------------------------------------------------------------------------------
/blueprint/src/macros/print.tex:
--------------------------------------------------------------------------------
1 | % In this file you should put macros to be used only by
2 | % the printed version. Of course they should have a corresponding
3 | % version in macros/web.tex.
4 | % Typically the printed version could have more fancy decorations.
5 | % This should be a very short file.
6 | %
7 | % This file starts with dummy macros that ensure the pdf
8 | % compiler will ignore macros provided by plasTeX that make
9 | % sense only for the web version, such as dependency graph
10 | % macros.
11 |
12 |
13 | % Dummy macros that make sense only for web version.
14 | \newcommand{\lean}[1]{}
15 | \newcommand{\discussion}[1]{}
16 | \newcommand{\leanok}{}
17 | \newcommand{\mathlibok}{}
18 | \newcommand{\notready}{}
19 | % Make sure that arguments of \uses and \proves are real labels, by using invisible refs:
20 | % latex prints a warning if the label is not defined, but nothing is shown in the pdf file.
21 | % It uses LaTeX3 programming, this is why we use the expl3 package.
22 | \ExplSyntaxOn
23 | \NewDocumentCommand{\uses}{m}
24 | {\clist_map_inline:nn{#1}{\vphantom{\ref{##1}}}%
25 | \ignorespaces}
26 | \NewDocumentCommand{\proves}{m}
27 | {\clist_map_inline:nn{#1}{\vphantom{\ref{##1}}}%
28 | \ignorespaces}
29 | \ExplSyntaxOff
--------------------------------------------------------------------------------
/blueprint/src/macros/web.tex:
--------------------------------------------------------------------------------
1 | % In this file you should put macros to be used only by
2 | % the web version. Of course they should have a corresponding
3 | % version in macros/print.tex.
4 | % Typically the printed version could have more fancy decorations.
5 | % This will probably be a very short file.
--------------------------------------------------------------------------------
/blueprint/src/plastex.cfg:
--------------------------------------------------------------------------------
1 | [general]
2 | renderer=HTML5
3 | copy-theme-extras=yes
4 | plugins=plastexdepgraph plastexshowmore leanblueprint
5 |
6 | [document]
7 | toc-depth=3
8 | toc-non-files=True
9 |
10 | [files]
11 | directory=../web/
12 | split-level= 0
13 |
14 | [html5]
15 | localtoc-level=0
16 | extra-css=extra_styles.css
17 | mathjax-dollars=False
--------------------------------------------------------------------------------
/blueprint/src/print.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinhp/Poly/0f1a598e622d2e329da1d7e4f9de8d5dc21141de/blueprint/src/print.pdf
--------------------------------------------------------------------------------
/blueprint/src/print.tex:
--------------------------------------------------------------------------------
1 | % This file makes a printable version of the blueprint
2 | % It should include all the \usepackage needed for the pdf version.
3 | % The template version assume you want to use a modern TeX compiler
4 | % such as xeLaTeX or luaLaTeX including support for unicode
5 | % and Latin Modern Math font with standard bugfixes applied.
6 | % It also uses expl3 in order to support macros related to the dependency graph.
7 | % It also includes standard AMS packages (and their improved version
8 | % mathtools) as well as support for links with a sober decoration
9 | % (no ugly rectangles around links).
10 | % It is otherwise a very minimal preamble (you should probably at least
11 | % add cleveref and tikz-cd).
12 |
13 | \documentclass[a4paper]{report}
14 |
15 | \usepackage{geometry}
16 |
17 | \usepackage{expl3}
18 |
19 | \usepackage{amssymb, amsthm, mathtools}
20 | \usepackage[unicode,colorlinks=true,linkcolor=blue,urlcolor=magenta, citecolor=blue]{hyperref}
21 |
22 | \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math}
23 |
24 | \usepackage{amsmath,stmaryrd,enumerate,a4,array}
25 | \usepackage{geometry}
26 | \usepackage{url}
27 | \usepackage[cmtip,all]{xy}
28 | \usepackage{subcaption}
29 | \usepackage{cleveref}
30 | \numberwithin{equation}{section}
31 | \usepackage[parfill]{parskip}
32 | \usepackage{tikz, tikz-cd, float} % Commutative Diagrams
33 | % \usepackage{bussproofs}
34 | \usepackage{graphics}
35 |
36 | \input{macros/common}
37 | \input{macros/print}
38 |
39 | \title{Polynomial Functors in Lean 4}
40 | \author{Sina Hazratpour}
41 |
42 | \input{chapter/all}
43 |
--------------------------------------------------------------------------------
/blueprint/src/refs.bib:
--------------------------------------------------------------------------------
1 | @misc{awodey2023hofmannstreicheruniverses,
2 | title={On Hofmann-Streicher universes},
3 | author={Steve Awodey},
4 | year={2023},
5 | eprint={2205.10917},
6 | archivePrefix={arXiv},
7 | primaryClass={math.CT},
8 | url={https://arxiv.org/abs/2205.10917},
9 | }
10 |
11 | @incollection {hofmannstreicher1996,
12 | AUTHOR = {Hofmann, Martin and Streicher, Thomas},
13 | TITLE = {The groupoid interpretation of type theory},
14 | BOOKTITLE = {Twenty-five years of constructive type theory
15 | ({V}enice, 1995)},
16 | SERIES = {Oxford Logic Guides},
17 | VOLUME = {36},
18 | PAGES = {83--111},
19 | PUBLISHER = {Oxford Univ. Press},
20 | ADDRESS = {New York},
21 | YEAR = {1998},
22 | MRCLASS = {03B15 (68N15 68Q55)},
23 | MRNUMBER = {1686862},
24 | }
25 |
26 | @misc{joyalnlabmodelstructuresoncat,
27 | author = {André Joyal},
28 | title = {Model structures on Cat},
29 | howpublished = {\url{https://ncatlab.org/joyalscatlab/published/Model+structures+on+Cat}},
30 | }
31 |
32 | @misc{awodey2017naturalmodelshomotopytype,
33 | title={Natural models of homotopy type theory},
34 | author={Steve Awodey},
35 | year={2017},
36 | eprint={1406.3219},
37 | archivePrefix={arXiv},
38 | primaryClass={math.CT},
39 | url={https://arxiv.org/abs/1406.3219},
40 | }
41 |
42 | @misc{streicher1995ExtensionalConceptsInIntensionalTypeTheory,
43 | title={Extensional concepts in intensional type theory},
44 | author={Martin Hofmann},
45 | year={1995},
46 | url={https://www2.mathematik.tu-darmstadt.de/~streicher/HabilStreicher.pdf},
47 | }
48 |
--------------------------------------------------------------------------------
/blueprint/src/web.paux:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinhp/Poly/0f1a598e622d2e329da1d7e4f9de8d5dc21141de/blueprint/src/web.paux
--------------------------------------------------------------------------------
/blueprint/src/web.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinhp/Poly/0f1a598e622d2e329da1d7e4f9de8d5dc21141de/blueprint/src/web.pdf
--------------------------------------------------------------------------------
/blueprint/src/web.tex:
--------------------------------------------------------------------------------
1 | % This file makes a web version of the blueprint
2 | % It should include all the \usepackage needed for this version.
3 | % The template includes standard AMS packages.
4 | % It is otherwise a very minimal preamble (you should probably at least
5 | % add cleveref and tikz-cd).
6 |
7 | \documentclass{report}
8 |
9 | \usepackage{amssymb, amsthm, amsmath}
10 | \usepackage{hyperref}
11 | \usepackage[showmore, dep_graph]{blueprint}
12 | \usepackage{tikz-cd}
13 | % \usepackage{bussproofs}
14 |
15 | \input{macros/common}
16 | \input{macros/web}
17 |
18 | \home{https://sinhp.github.io/Poly}
19 | \github{https://github.com/sinhp/Poly}
20 | \dochome{https://sinhp.github.io/Poly/docs}
21 |
22 | \input{chapter/all}
23 |
--------------------------------------------------------------------------------
/blueprint/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
12 |
13 |
14 |
15 | Polynomial Functors in Lean4
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
Polynomial Functors in Lean4
52 |
53 | Sina Hazratpour
54 |
55 |
56 |
57 |
58 |
71 |
72 |
73 |
74 |
75 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/blueprint/web/js/expatlib.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinhp/Poly/0f1a598e622d2e329da1d7e4f9de8d5dc21141de/blueprint/web/js/expatlib.wasm
--------------------------------------------------------------------------------
/blueprint/web/js/graphvizlib.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinhp/Poly/0f1a598e622d2e329da1d7e4f9de8d5dc21141de/blueprint/web/js/graphvizlib.wasm
--------------------------------------------------------------------------------
/blueprint/web/js/js.cookie.min.js:
--------------------------------------------------------------------------------
1 | /*! js-cookie v3.0.1 | MIT */
2 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t'
10 | };
11 |
12 | $("#toc-toggle").click(function() {
13 | $("nav.toc").toggle()
14 | });
15 |
16 | $("nav.toc").on("click", "span.expand-toc",
17 | function() {
18 | $(this).siblings("ul").slideToggle('fast');
19 |
20 | if ($(this).html() == "▼") {
21 | $(this).html("▶");
22 | } else {
23 | $(this).html("▼");
24 | };
25 |
26 | })
27 |
28 |
29 | $("div.proof_content p:last").append('□')
30 |
31 | $("div.proof_heading").click(
32 | function() {
33 | var expand_span = $(this).children('span.expand-proof');
34 | if ($(expand_span).html() == "▼") {
35 | $(expand_span).html("▶");
36 | } else {
37 | $(expand_span).html("▼");
38 | };
39 |
40 | $(this).siblings("div.proof_content").slideToggle()
41 | })
42 |
43 | $("a.proof").click(
44 | function() {
45 | var ref= $(this).attr('href').split('#')[1];
46 | var proof = $('#'+ref)
47 | proof.show()
48 | proof.children('.proof_content').each(
49 | function() {
50 | var proof_content = $(this)
51 | proof_content.show().addClass('hilite')
52 | setTimeout(function(){
53 | proof_content.removeClass('hilite')
54 | }, 1000);
55 | })
56 | var expand_icon = proof.find('svg.expand-proof');
57 | expand_icon.replaceWith(icon('cross', 'expand-proof'));
58 | })
59 |
60 |
61 | $("button.modal").click(
62 | function() {
63 | $(this).next("div.modal-container").css('display', 'flex');
64 | })
65 | $("button.closebtn").click(
66 | function() {
67 | $(this).parent().parent().parent().hide();
68 | })
69 | });
70 |
--------------------------------------------------------------------------------
/blueprint/web/js/showmore.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | showmore_update = function(showmore_level) {
3 | Cookies.set('showmore_level', showmore_level, { expires : 10, SameSite: "Lax" });
4 | console.log('update', showmore_level);
5 | switch(showmore_level) {
6 | case 0:
7 | $("svg#showmore-minus").hide();
8 | $("figure").hide();
9 | $("svg#showmore-plus").show();
10 | $("div.main-text > p").each(
11 | function(){
12 | $(this).hide();
13 | });
14 | $("div.proof_wrapper").each(
15 | function(){
16 | $(this).hide();
17 | });
18 | $("footer").hide();
19 | break;
20 | case 1:
21 | $("svg#showmore-minus").show();
22 | $("figure").show();
23 | $("div.proof_wrapper").each(
24 | function(){
25 | $(this).show();
26 | });
27 | $("svg#showmore-plus").show();
28 | $("div.main-text > p").each(
29 | function(){
30 | $(this).show();
31 | });
32 | $("div.proof_content").each(
33 | function(){
34 | $(this).hide();
35 | });
36 | $("span.expand-proof").html("▶");
37 | $("footer").show();
38 | break;
39 | case 2:
40 | $("svg#showmore-minus").show();
41 | $("svg#showmore-plus").hide();
42 | $("div.main-text > p").each(
43 | function(){
44 | $(this).show();
45 | });
46 | $("div.proof_wrapper").each(
47 | function(){
48 | $(this).show();
49 | });
50 | $("div.proof_content").each(
51 | function(){
52 | $(this).show();
53 | });
54 | $("span.expand-proof").html("▼");
55 | }
56 | };
57 |
58 | cookie_level = function(){
59 | var showmore_level = parseInt(Cookies.get('showmore_level'));
60 |
61 | if (isNaN(showmore_level)) {
62 | return 1;
63 | } else {
64 | return showmore_level;
65 | }
66 | };
67 | showmore_update(cookie_level());
68 |
69 | $("svg#showmore-minus").click(
70 | function() {
71 | var showmore_level = cookie_level();
72 | console.log('click ', showmore_level);
73 | if (showmore_level > 0) {
74 | showmore_level -= 1;
75 | showmore_update(showmore_level);
76 | }
77 | })
78 |
79 | $("svg#showmore-plus").click(
80 | function() {
81 | var showmore_level = cookie_level();
82 | console.log('click ', showmore_level);
83 | if (showmore_level < 2) {
84 | showmore_level += 1;
85 | showmore_update(showmore_level);
86 | }
87 | })
88 | })
89 |
--------------------------------------------------------------------------------
/blueprint/web/js/svgxuse.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * @copyright Copyright (c) 2016 IcoMoon.io
3 | * @license Licensed under MIT license
4 | * See https://github.com/Keyamoon/svgxuse
5 | * @version 1.1.20
6 | */
7 | /*jslint browser: true */
8 | /*global XDomainRequest, MutationObserver, window */
9 | (function () {
10 | 'use strict';
11 | if (window && window.addEventListener) {
12 | var cache = Object.create(null); // holds xhr objects to prevent multiple requests
13 | var checkUseElems;
14 | var tid; // timeout id
15 | var debouncedCheck = function () {
16 | clearTimeout(tid);
17 | tid = setTimeout(checkUseElems, 100);
18 | };
19 | var unobserveChanges = function () {
20 | return;
21 | };
22 | var observeChanges = function () {
23 | var observer;
24 | window.addEventListener('resize', debouncedCheck, false);
25 | window.addEventListener('orientationchange', debouncedCheck, false);
26 | if (window.MutationObserver) {
27 | observer = new MutationObserver(debouncedCheck);
28 | observer.observe(document.documentElement, {
29 | childList: true,
30 | subtree: true,
31 | attributes: true
32 | });
33 | unobserveChanges = function () {
34 | try {
35 | observer.disconnect();
36 | window.removeEventListener('resize', debouncedCheck, false);
37 | window.removeEventListener('orientationchange', debouncedCheck, false);
38 | } catch (ignore) {}
39 | };
40 | } else {
41 | document.documentElement.addEventListener('DOMSubtreeModified', debouncedCheck, false);
42 | unobserveChanges = function () {
43 | document.documentElement.removeEventListener('DOMSubtreeModified', debouncedCheck, false);
44 | window.removeEventListener('resize', debouncedCheck, false);
45 | window.removeEventListener('orientationchange', debouncedCheck, false);
46 | };
47 | }
48 | };
49 | var createRequest = function (url) {
50 | // In IE 9, cross domain requests can only be sent using XDomainRequest.
51 | // XDomainRequest would fail if CORS headers are not set.
52 | // Therefore, XDomainRequest should only be used with cross domain requests.
53 | function getHostname(href) {
54 | var a = document.createElement('a');
55 | a.href = href;
56 | return a.hostname;
57 | }
58 | var Request;
59 | var hname = location.hostname;
60 | var hname2;
61 | if (window.XMLHttpRequest) {
62 | Request = new XMLHttpRequest();
63 | hname2 = getHostname(url);
64 | if (Request.withCredentials === undefined && hname2 !== '' && hname2 !== hname) {
65 | Request = XDomainRequest || undefined;
66 | } else {
67 | Request = XMLHttpRequest;
68 | }
69 | }
70 | return Request;
71 | };
72 | var xlinkNS = 'http://www.w3.org/1999/xlink';
73 | checkUseElems = function () {
74 | var base;
75 | var bcr;
76 | var fallback = ''; // optional fallback URL in case no base path to SVG file was given and no symbol definition was found.
77 | var hash;
78 | var i;
79 | var inProgressCount = 0;
80 | var isHidden;
81 | var Request;
82 | var url;
83 | var uses;
84 | var xhr;
85 | function observeIfDone() {
86 | // If done with making changes, start watching for chagnes in DOM again
87 | inProgressCount -= 1;
88 | if (inProgressCount === 0) { // if all xhrs were resolved
89 | unobserveChanges(); // make sure to remove old handlers
90 | observeChanges(); // watch for changes to DOM
91 | }
92 | }
93 | function attrUpdateFunc(spec) {
94 | return function () {
95 | if (cache[spec.base] !== true) {
96 | spec.useEl.setAttributeNS(xlinkNS, 'xlink:href', '#' + spec.hash);
97 | }
98 | };
99 | }
100 | function onloadFunc(xhr) {
101 | return function () {
102 | var body = document.body;
103 | var x = document.createElement('x');
104 | var svg;
105 | xhr.onload = null;
106 | x.innerHTML = xhr.responseText;
107 | svg = x.getElementsByTagName('svg')[0];
108 | if (svg) {
109 | svg.setAttribute('aria-hidden', 'true');
110 | svg.style.position = 'absolute';
111 | svg.style.width = 0;
112 | svg.style.height = 0;
113 | svg.style.overflow = 'hidden';
114 | body.insertBefore(svg, body.firstChild);
115 | }
116 | observeIfDone();
117 | };
118 | }
119 | function onErrorTimeout(xhr) {
120 | return function () {
121 | xhr.onerror = null;
122 | xhr.ontimeout = null;
123 | observeIfDone();
124 | };
125 | }
126 | unobserveChanges(); // stop watching for changes to DOM
127 | // find all use elements
128 | uses = document.getElementsByTagName('use');
129 | for (i = 0; i < uses.length; i += 1) {
130 | try {
131 | bcr = uses[i].getBoundingClientRect();
132 | } catch (ignore) {
133 | // failed to get bounding rectangle of the use element
134 | bcr = false;
135 | }
136 | url = uses[i].getAttributeNS(xlinkNS, 'href').split('#');
137 | base = url[0];
138 | hash = url[1];
139 | isHidden = bcr && bcr.left === 0 && bcr.right === 0 && bcr.top === 0 && bcr.bottom === 0;
140 | if (bcr && bcr.width === 0 && bcr.height === 0 && !isHidden) {
141 | // the use element is empty
142 | // if there is a reference to an external SVG, try to fetch it
143 | // use the optional fallback URL if there is no reference to an external SVG
144 | if (fallback && !base.length && hash && !document.getElementById(hash)) {
145 | base = fallback;
146 | }
147 | if (base.length) {
148 | // schedule updating xlink:href
149 | xhr = cache[base];
150 | if (xhr !== true) {
151 | // true signifies that prepending the SVG was not required
152 | setTimeout(attrUpdateFunc({
153 | useEl: uses[i],
154 | base: base,
155 | hash: hash
156 | }), 0);
157 | }
158 | if (xhr === undefined) {
159 | Request = createRequest(base);
160 | if (Request !== undefined) {
161 | xhr = new Request();
162 | cache[base] = xhr;
163 | xhr.onload = onloadFunc(xhr);
164 | xhr.onerror = onErrorTimeout(xhr);
165 | xhr.ontimeout = onErrorTimeout(xhr);
166 | xhr.open('GET', base);
167 | xhr.send();
168 | inProgressCount += 1;
169 | }
170 | }
171 | }
172 | } else {
173 | if (!isHidden) {
174 | if (cache[base] === undefined) {
175 | // remember this URL if the use element was not empty and no request was sent
176 | cache[base] = true;
177 | } else if (cache[base].onload) {
178 | // if it turns out that prepending the SVG is not necessary,
179 | // abort the in-progress xhr.
180 | cache[base].abort();
181 | delete cache[base].onload;
182 | cache[base] = true;
183 | }
184 | } else if (base.length && cache[base]) {
185 | attrUpdateFunc({
186 | useEl: uses[i],
187 | base: base,
188 | hash: hash
189 | })();
190 | }
191 | }
192 | }
193 | uses = '';
194 | inProgressCount += 1;
195 | observeIfDone();
196 | };
197 | // The load event fires when all resources have finished loading, which allows detecting whether SVG use elements are empty.
198 | window.addEventListener('load', function winLoad() {
199 | window.removeEventListener('load', winLoad, false); // to prevent memory leaks
200 | tid = setTimeout(checkUseElems, 0);
201 | }, false);
202 | }
203 | }());
204 |
--------------------------------------------------------------------------------
/blueprint/web/styles/amsthm.css:
--------------------------------------------------------------------------------
1 |
2 | span[class$='_thmlabel']
3 | {
4 | margin-left: .5rem;
5 | }
6 |
7 | div.theorem-style-plain div[class$='_thmheading'] {
8 | font-style: normal;
9 | font-weight: bold;
10 |
11 | }
12 | div.theorem-style-plain span[class$='_thmlabel']::after
13 | {
14 | content: '.';
15 | }
16 | div.theorem-style-plain div[class$='_thmcontent'] {
17 | font-style: italic;
18 | font-weight: normal;
19 |
20 | }
21 |
22 | div.theorem-style-definition div[class$='_thmheading'] {
23 | font-style: normal;
24 | font-weight: bold;
25 |
26 | }
27 | div.theorem-style-definition span[class$='_thmlabel']::after
28 | {
29 | content: '.';
30 | }
31 | div.theorem-style-remark div[class$='_thmheading'] {
32 | font-style: normal;
33 | font-weight: bold;
34 |
35 | }
36 | div.theorem-style-remark span[class$='_thmlabel']::after
37 | {
38 | content: '.';
39 | }
--------------------------------------------------------------------------------
/blueprint/web/styles/blueprint.css:
--------------------------------------------------------------------------------
1 | a.github_link {
2 | font-weight: normal;
3 | font-size: 90%;
4 | text-decoration: none;
5 | color: inherit;
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/blueprint/web/styles/dep_graph.css:
--------------------------------------------------------------------------------
1 | header {
2 | height: 3rem;
3 | justify-content: center;
4 | display: flex;
5 | }
6 |
7 | header a {
8 | margin-right: auto;
9 | text-decoration: none;
10 | color: inherit;
11 | }
12 |
13 | header a:visited {
14 | color: inherit;
15 | }
16 |
17 | header h1 {
18 | position: absolute;
19 | }
20 |
21 | div#graph {
22 | width: 100%;
23 | height: 90vh;
24 | resize: both;
25 | overflow: hidden; }
26 |
27 |
28 | div#statements {
29 | display: none;
30 | position: absolute;
31 | bottom: 0;
32 | width: 100%;
33 | background-color: #e8e8e8; /* FIXME: use sass */
34 | }
35 |
36 | #Legend span.title {
37 | font-size: 150%;
38 | font-weight: bold;
39 | display: flex;
40 | margin-right: 2rem;
41 | cursor: pointer;
42 | }
43 |
44 | #Legend dl {
45 | position: absolute;
46 | top: 6rem;
47 | left:1.5rem;
48 | font-size: 120%;
49 | display: none;
50 | max-width: 30%;
51 | background: white
52 | }
53 |
54 | #Legend div.btn {
55 | margin-left: .5rem;
56 | margin-top: .1rem;
57 | }
58 |
59 | #Legend dt {
60 | font-weight: bold;
61 | }
62 |
63 | #Legend dt::after {
64 | content: ":";
65 | }
66 |
67 | #Legend dd {
68 | margin-left: .5rem;
69 | margin-right: 1rem;
70 | display: inline;
71 | }
72 |
73 |
74 | div.bar {
75 | display: block;
76 | width: 22px;
77 | height: 3px;
78 | border-radius: 1px;
79 | margin-top: 2px;
80 | margin-bot: 2px;
81 | background: black;
82 | }
83 |
84 |
85 | button.dep-closebtn
86 | {
87 | position: absolute;
88 | top: 1rem;
89 | right: 1rem;
90 | font-size: 100%;
91 | font-weight: bold;
92 |
93 | background: Transparent;
94 | border: none;
95 |
96 | text-decoration: none;
97 |
98 | /* color: #fff;*/
99 | cursor: pointer;
100 | }
101 |
102 | div.dep-modal-container {
103 | position: fixed;
104 | z-index: $modal-z-index;
105 | top: 0;
106 | left: 0;
107 |
108 | display: none;
109 |
110 | width: 90vw;
111 | margin-top: 4rem;
112 | margin-left: 5vw;
113 | margin-right: 5vw;
114 | }
115 | div.dep-modal-content {
116 | font-weight: normal;
117 |
118 | overflow: auto;
119 |
120 | margin: auto;
121 |
122 | vertical-align: middle;
123 |
124 | border: 1px solid #497da5; /* FIXME use sass, compare main modals */
125 | border-radius: 5px;
126 | background-color: white;
127 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, .2), 0 6px 20px 0 rgba(0, 0, 0, .19);
128 | padding: .5rem 1rem .2rem 1rem;
129 | }
130 |
131 | div.dep-modal-content a {
132 | color: inherit;
133 | text-decoration: none;
134 | }
135 |
136 | div.thm_icons .icon {
137 | width: .7rem;
138 | height: .7rem;
139 | }
140 |
141 | a.latex_link, a.lean_link, a.issue_link {
142 | font-weight: normal;
143 | font-size: 90%;
144 | font-style: italic;
145 | }
146 |
147 | a.latex_link {
148 | padding-left: 1rem;
149 | }
150 |
151 | a.lean_link, a.issue_link {
152 | padding-left: .5rem;
153 | }
154 |
155 |
156 | /* Tooltip container */
157 | .tooltip {
158 | font-weight: normal;
159 | margin-left: .5rem;
160 | position: relative;
161 | display: inline-block;
162 | }
163 |
164 | /* Tooltip text */
165 | .tooltip .tooltip_list {
166 | visibility: hidden;
167 | text-align: center;
168 | border-radius: 6px;
169 |
170 | position: absolute;
171 | z-index: 1;
172 | top: 100%;
173 | }
174 |
175 | ul.tooltip_list {
176 | list-style-type: none;
177 | padding-left: 0;
178 | border: 1px solid #497da5; /* FIXME use sass, compare main modals */
179 | border-radius: 5px;
180 | background-color: white;
181 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, .2), 0 6px 20px 0 rgba(0, 0, 0, .19);
182 | }
183 |
184 | ul.tooltip_list li {
185 | padding: .1rem .5rem;
186 | }
187 |
188 | /* Show the tooltip text when you mouse over the tooltip container */
189 | .tooltip:hover .tooltip_list {
190 | visibility: visible;
191 | }
192 |
193 | .node {
194 | cursor: pointer;
195 | }
196 |
--------------------------------------------------------------------------------
/blueprint/web/styles/extra_styles.css:
--------------------------------------------------------------------------------
1 | /* This file contains CSS tweaks for this blueprint.
2 | * As an example, we included CSS rules that put
3 | * a vertical line on the left of theorem statements
4 | * and proofs.
5 | * */
6 |
7 | div.theorem_thmcontent {
8 | border-left: .15rem solid black;
9 | }
10 |
11 | div.proposition_thmcontent {
12 | border-left: .15rem solid black;
13 | }
14 |
15 | div.lemma_thmcontent {
16 | border-left: .1rem solid black;
17 | }
18 |
19 | div.corollary_thmcontent {
20 | border-left: .1rem solid black;
21 | }
22 |
23 | div.proof_content {
24 | border-left: .08rem solid grey;
25 | }
26 |
--------------------------------------------------------------------------------
/blueprint/web/styles/showmore.css:
--------------------------------------------------------------------------------
1 | p.hidden {
2 | display: none;
3 | }
4 |
5 | svg.showmore {
6 | font-size: 150%;
7 | margin: auto;
8 | min-width: 2rem;
9 | text-decoration: none;
10 | text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.8);
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/blueprint/web/styles/theme-blue.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{font:inherit;font-size:100%;margin:0;padding:0;border:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1;overflow-x:hidden;background:#f4f4f4}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-spacing:0;border-collapse:collapse}.clear:after{font-size:0;display:block;visibility:hidden;clear:both;height:0;content:" "}.clear{display:inline-block}* html .clear{height:1%}.clear{display:block}*{box-sizing:border-box}hr{clear:both;border:none;outline:none}em{font-style:italic}a{text-decoration:underline}ul{list-style:disc}ol{list-style:decimal}ol,ul{font-size:14px;padding:0 0 0 33px}ol li,ul li{margin:0}blockquote{padding:0 15px 0 40px}table{font-size:13px;width:100%;margin:20px 0;background:#fff}table th{font-size:16px;font-weight:700}table tr td{padding:7px}::selection{color:#fff;background:#000}::-moz-selection{color:#fff;background:#000}body{height:100vh;margin:0;flex-direction:column;color:#0a0a14;background-color:#e8e8e8}body,div.wrapper{display:flex;overflow:hidden}div.wrapper{flex-grow:1}div.content-wrapper{max-width:75ch}@media (min-width:1024px){div.content-wrapper{margin-left:auto;margin-right:auto}}div.content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;padding:.5rem;margin-bottom:2.5rem}@media (min-width:1024px){div.content{padding:1rem;margin-bottom:0}}div.centered{display:flex;flex-direction:column;flex-wrap:wrap;align-items:center;justify-content:space-around;min-width:100%;margin:0 auto}div.flushleft,div.raggedright{display:flex;justify-content:flex-start}div.flushright,div.raggedbottom,div.raggedleft{display:flex;justify-content:flex-end}div.raggedbottom{flex-direction:column}div.content{line-height:1.4rem}div.content>p{margin:2.1rem 0}li>p{margin:.28rem 0}.icon{display:inline-block;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1rem;height:1rem;stroke-width:0;stroke:currentColor;fill:currentColor}h1,h2,h3,h4,h5,h6{font-family:Lucida Grande,Arial,Helvetica,sans-serif}h1{font-size:2rem;line-height:2rem;margin:1rem 0}h1,h2{color:#0f2f48}h2{font-size:1.5rem;margin:.8rem 0}h3,h4{margin:.67rem 0;color:#0f2f48}h3,h4,p{font-size:1rem}p{margin:.5rem 0}.titlepage{text-align:center}.titlepage h1{font-weight:400}b,strong{font-weight:700}dfn{font-style:italic}code,kbd,pre,samp{font-family:monospace,serif;font-size:1rem}pre{white-space:pre-wrap}q{quotes:"“" "”" "‘" "’"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5rem}sub{bottom:-.25rem}.mdseries,.textmf{font-weight:400}.bfseries,.textbf{font-weight:700}.rmfamily,.textrm{font-family:serif}.sffamily,.textsf{font-family:sans-serif}.texttt,.ttfamily{font-family:monospace}.textup,.upshape{text-transform:uppercase}.itshape,.textit{font-style:italic}.slshape,.textsl{font-style:oblique}.scshape,.textsc{font-variant:small-caps}small.tiny{font-size:x-small}small.scriptsize{font-size:smaller}small.footnotesize,small.small{font-size:small}.normalsize{font-size:normal}big.large{font-size:large}big.xlarge,big.xxlarge{font-size:x-large}big.huge,big.xhuge{font-size:xx-large}.rm{font-family:serif;font-style:normal;font-weight:400}.cal,.it{font-style:italic}.cal,.it,.sl{font-family:serif;font-weight:400}.sl{font-style:oblique}.bf{font-family:serif;font-weight:700}.bf,.tt{font-style:normal}.tt{font-family:monospace;font-weight:400}.underbar{text-decoration:underline}.fbox,.framebox{border:1px solid #000;padding:1px 3px}.quotation p,.quote p,.verse p{margin-top:0;margin-bottom:.5em}hr{color:#000}dd{margin-left:3rem}dd p{padding:0;margin:0 0 1rem}ul.breadcrumbs{margin:0;padding:0;list-style:none;font-size:small}ul.breadcrumbs li{display:inline}ul.breadcrumbs a{text-decoration:none;color:#396282}li.crumb:after{content:" / "}div.equation{display:flex;align-items:center;margin:1rem}div.equation span.equation_label{margin-right:1rem}div.equation span.equation_label:before{content:"("}div.equation span.equation_label:after{content:")"}div.equation div.equation_content{margin:auto}figure{display:flex;flex-direction:column;vertical-align:bottom;overflow:auto}figure img{display:block;margin:0 auto}figcaption{display:block;text-align:center;margin-bottom:.1rem}span.caption_ref,span.caption_title,span.subcaption{font-weight:700}span.caption_ref:after{content:":"}span.subref:after{content:")"}footer#footnotes{clear:both;padding-top:1rem;padding-left:1rem;border-color:gray;border-top:1px solid}footer#footnotes h1{font-size:1.5rem;margin:0;margin-bottom:.5rem;color:#000}a.footnote{text-decoration:none}a.footnote sup:after{content:"]"}a.footnote sup:before{content:"["}body>header{background:linear-gradient(180deg,#6696bb 0,#396282);color:#fff;text-shadow:1px 2px 0 rgba(0,0,0,.8);display:flex;align-items:center;padding:.5rem}svg#toc-toggle{width:1.125rem;height:1.125rem;margin-right:.5rem}h1#doc_title{color:#fff;font-size:1.5rem;margin:auto}#doc_title a,#doc_title a:visited{text-decoration:none;color:#fff}.theindex li{list-style-type:none}nav.index-groups{margin-bottom:1rem}a[class^=index-group]{text-decoration:none}a.index-group:after{content:" |"}section.theindex{display:flex;flex-direction:row;flex-wrap:wrap;margin-top:1rem}section.theindex h2{min-width:100%;margin:1rem 0 .5rem}ul.index-column{min-width:100%}@media (min-width:1024px){ul.index-column{min-width:auto}}nav.prev_up_next a.index{font-size:small;padding-left:.5rem;padding-right:.5rem}dl.description dt{font-weight:700}table.list{margin-left:15px;margin-top:1em;margin-bottom:1em}table.list td{padding-right:5px}div.displaymath{overflow:auto}a.eqref:before{content:"("}a.eqref:after{content:")"}nav.prev_up_next{position:fixed;z-index:1;right:0;bottom:0;display:flex;height:2.5rem;background:linear-gradient(180deg,#6696bb 0,#396282)}nav.prev_up_next a{font-size:150%;margin:auto;padding:.5rem 1rem;text-decoration:none;color:#fff;text-shadow:1px 2px 0 rgba(0,0,0,.8)}hspace,vspace{margin:0;padding:0}div.bigskip{margin-bottom:4rem}div.medskip{margin:0;padding:0;margin-bottom:2rem}div.bigskip{margin:0;padding:0;margin-bottom:1rem}.tabular{border-collapse:collapse;color:#0a0a14;background-color:#e8e8e8;width:auto}.tabular td,.tabular th{vertical-align:baseline;text-align:left;padding:.3em .6em;empty-cells:show}td p:first-child,th p:first-child{margin-top:0;margin-bottom:0}td p,th p{margin-top:1em;margin-bottom:0}@keyframes a{0%{background-color:#c2c2c2}to{background-color:#e8e8e8}}div[class$=_thmwrapper]{margin-top:1rem}div[class$=_thmwrapper]:target{animation:a 1s ease}div[class$=_thmheading]{display:flex;font-weight:700;line-height:150%}span[class$=_thmtitle]:before{content:"("}span[class$=_thmtitle]:after{content:")"}div[class$=_thmcontent]{font-weight:400;margin-left:1rem;padding-top:.14rem;padding-left:1rem}span[class$=_thmlabel]{margin-left:.5rem;margin-right:.5rem}div[class$=proof_heading]{font-weight:700;line-height:120%;cursor:pointer}div.proof_content{font-weight:400;margin-left:1rem;padding-top:.5rem;padding-left:1rem}span.expand-proof{font-size:80%}div.hilite{animation:a 1s ease}span.qed{float:right}button.modal{border:none;text-align:center;text-decoration:none;background:transparent;cursor:pointer;padding:0}div.modal-container{position:fixed;z-index:2;top:0;left:0;display:none;width:100%;height:100%}div.modal-content{font-weight:400;overflow:auto;margin:auto;vertical-align:middle;border:1px solid #497da5;border-radius:5px;background-color:#fff;box-shadow:0 4px 8px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19)}div.modal-content header{position:relative;background:linear-gradient(180deg,#6696bb 0,#396282);color:#fff;text-shadow:1px 2px 0 rgba(0,0,0,.8);display:flex;flex-direction:row;min-height:1rem;min-width:100%;text-align:center;vertical-align:middle;padding:0 .5rem;justify-content:space-between}div.modal-content header button.closebtn{font-size:120%;font-weight:700;background:Transparent;border:none;margin:auto 0;padding-right:.3rem;text-decoration:none;color:#fff;cursor:pointer}div.modal-content header h1{font-size:120%;margin:auto 0;padding:.2rem;color:#fff}div.modal-content a{text-decoration:none}div.modal-content ul{padding:1rem;list-style:none}div.modal-content li{padding-left:.5rem}a.icon{text-decoration:none;color:#0a0a14;border:none;background-color:Transparent}div[class$=_thmheading]:hover div.thm_header_hidden_extras{display:inline-block}div.thm_header_hidden_extras{display:none}ul.quizz{display:flex;flex-direction:column;list-style:circle!important}ul.quizz li{display:flex;padding:.5rem;flex-direction:row;min-width:100%;min-height:3rem;flex-grow:1;align-items:center;justify-content:space-between}ul.quizz li.active-qright{background-color:green}ul.quizz li.active-qwrong{background-color:red}ul.quizz svg.icon{display:none;padding-right:.5rem;width:2rem;height:2rem}.tikzcd{overflow:auto}.tikzcd,.tikzpicture{display:block;margin:.5rem auto}.local_toc ul{padding-left:1rem;list-style:none}.local_toc ul a{text-decoration:none;color:#0a0a14}.local_toc ul li{padding:.2rem 0}nav.toc{flex-shrink:0;display:none;width:100%;overflow-x:hidden;overflow-y:auto;flex-direction:column;margin-right:1rem;padding:0;padding-right:1rem;transition:left .5s ease;background-color:#6696bb;border-right:none}@media (min-width:1024px){nav.toc{display:flex;max-width:25ch}}nav.active{width:100%}.toc ul{min-width:100%;padding-left:0;list-style:none}.toc ul a{display:inline-block;max-width:90%;padding-top:.5rem;padding-right:.5rem;padding-bottom:.5rem;transition:all .1s ease;text-align:left;text-decoration:none;font-size:1.125rem;color:#fff;text-shadow:2px 2px 2px rgba(0,0,0,.8);flex-grow:1}.toc ul a:hover{transition:all .2s ease;background:#497da5}.toc ul li{display:flex;min-width:100%;align-items:center;flex-wrap:wrap;justify-content:space-between;background-color:#6696bb}.toc ul li.current{background-color:#89aecb;font-weight:400}.sub-toc-0 a{padding-left:.8rem}.sub-toc-1 a{padding-left:1.6rem}.sub-toc-2 a{padding-left:2.4rem}.sub-toc-3 a{padding-left:3.2rem}.sub-toc-4 a{padding-left:4rem}ul.sub-toc-1,ul.sub-toc-2,ul.sub-toc-3,ul.sub-toc-4{display:none}span.expand-toc{min-width:.7rem;width:.8rem;height:.8rem;padding:0;padding-right:.5rem;font-size:125%}span.expand-toc,svg.close-toc{cursor:pointer;text-align:center;color:#fff;background-color:Transparent}svg.close-toc{min-width:1.3rem;min-height:1.3rem;margin:.5rem;margin-left:auto;display:none}nav.active svg.close-toc{display:inline-block}ul.active{display:block}code.verb{font-family:monospace;font-style:normal;font-weight:400}pre.verbatim{margin:1rem 2rem;background-color:#dbdbdb;padding:.5rem}
--------------------------------------------------------------------------------
/blueprint/web/styles/theme-green.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{font:inherit;font-size:100%;margin:0;padding:0;border:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1;overflow-x:hidden;background:#f4f4f4}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-spacing:0;border-collapse:collapse}.clear:after{font-size:0;display:block;visibility:hidden;clear:both;height:0;content:" "}.clear{display:inline-block}* html .clear{height:1%}.clear{display:block}*{box-sizing:border-box}hr{clear:both;border:none;outline:none}em{font-style:italic}a{text-decoration:underline}ul{list-style:disc}ol{list-style:decimal}ol,ul{font-size:14px;padding:0 0 0 33px}ol li,ul li{margin:0}blockquote{padding:0 15px 0 40px}table{font-size:13px;width:100%;margin:20px 0;background:#fff}table th{font-size:16px;font-weight:700}table tr td{padding:7px}::selection{color:#fff;background:#000}::-moz-selection{color:#fff;background:#000}body{height:100vh;margin:0;flex-direction:column;color:#000;background-color:#fff}body,div.wrapper{display:flex;overflow:hidden}div.wrapper{flex-grow:1}div.content-wrapper{max-width:75ch}@media (min-width:1024px){div.content-wrapper{margin-left:auto;margin-right:auto}}div.content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;padding:.5rem;margin-bottom:2.5rem}@media (min-width:1024px){div.content{padding:1rem;margin-bottom:0}}div.centered{display:flex;flex-direction:column;flex-wrap:wrap;align-items:center;justify-content:space-around;min-width:100%;margin:0 auto}div.flushleft,div.raggedright{display:flex;justify-content:flex-start}div.flushright,div.raggedbottom,div.raggedleft{display:flex;justify-content:flex-end}div.raggedbottom{flex-direction:column}div.content{line-height:1.4rem}div.content>p{margin:2.1rem 0}li>p{margin:.28rem 0}.icon{display:inline-block;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1rem;height:1rem;stroke-width:0;stroke:currentColor;fill:currentColor}h1,h2,h3,h4,h5,h6{font-family:Lucida Grande,Arial,Helvetica,sans-serif}h1{font-size:2rem;line-height:2rem;margin:1rem 0}h1,h2{color:#000}h2{font-size:1.5rem;margin:.8rem 0}h3,h4{margin:.67rem 0;color:#000}h3,h4,p{font-size:1rem}p{margin:.5rem 0}.titlepage{text-align:center}.titlepage h1{font-weight:400}b,strong{font-weight:700}dfn{font-style:italic}code,kbd,pre,samp{font-family:monospace,serif;font-size:1rem}pre{white-space:pre-wrap}q{quotes:"“" "”" "‘" "’"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5rem}sub{bottom:-.25rem}.mdseries,.textmf{font-weight:400}.bfseries,.textbf{font-weight:700}.rmfamily,.textrm{font-family:serif}.sffamily,.textsf{font-family:sans-serif}.texttt,.ttfamily{font-family:monospace}.textup,.upshape{text-transform:uppercase}.itshape,.textit{font-style:italic}.slshape,.textsl{font-style:oblique}.scshape,.textsc{font-variant:small-caps}small.tiny{font-size:x-small}small.scriptsize{font-size:smaller}small.footnotesize,small.small{font-size:small}.normalsize{font-size:normal}big.large{font-size:large}big.xlarge,big.xxlarge{font-size:x-large}big.huge,big.xhuge{font-size:xx-large}.rm{font-family:serif;font-style:normal;font-weight:400}.cal,.it{font-style:italic}.cal,.it,.sl{font-family:serif;font-weight:400}.sl{font-style:oblique}.bf{font-family:serif;font-weight:700}.bf,.tt{font-style:normal}.tt{font-family:monospace;font-weight:400}.underbar{text-decoration:underline}.fbox,.framebox{border:1px solid #000;padding:1px 3px}.quotation p,.quote p,.verse p{margin-top:0;margin-bottom:.5em}hr{color:#000}dd{margin-left:3rem}dd p{padding:0;margin:0 0 1rem}ul.breadcrumbs{margin:0;padding:0;list-style:none;font-size:small}ul.breadcrumbs li{display:inline}ul.breadcrumbs a{text-decoration:none;color:#4d7326}li.crumb:after{content:" / "}div.equation{display:flex;align-items:center;margin:1rem}div.equation span.equation_label{margin-right:1rem}div.equation span.equation_label:before{content:"("}div.equation span.equation_label:after{content:")"}div.equation div.equation_content{margin:auto}figure{display:flex;flex-direction:column;vertical-align:bottom;overflow:auto}figure img{display:block;margin:0 auto}figcaption{display:block;text-align:center;margin-bottom:.1rem}span.caption_ref,span.caption_title,span.subcaption{font-weight:700}span.caption_ref:after{content:":"}span.subref:after{content:")"}footer#footnotes{clear:both;padding-top:1rem;padding-left:1rem;border-color:gray;border-top:1px solid}footer#footnotes h1{font-size:1.5rem;margin:0;margin-bottom:.5rem;color:#000}a.footnote{text-decoration:none}a.footnote sup:after{content:"]"}a.footnote sup:before{content:"["}body>header{background:linear-gradient(180deg,#80bf40 0,#4d7326);color:#ffc;text-shadow:1px 2px 0 rgba(0,0,0,.8);display:flex;align-items:center;padding:.5rem}svg#toc-toggle{width:1.125rem;height:1.125rem;margin-right:.5rem}h1#doc_title{color:#ffc;font-size:1.5rem;margin:auto}#doc_title a,#doc_title a:visited{text-decoration:none;color:#ffc}.theindex li{list-style-type:none}nav.index-groups{margin-bottom:1rem}a[class^=index-group]{text-decoration:none}a.index-group:after{content:" |"}section.theindex{display:flex;flex-direction:row;flex-wrap:wrap;margin-top:1rem}section.theindex h2{min-width:100%;margin:1rem 0 .5rem}ul.index-column{min-width:100%}@media (min-width:1024px){ul.index-column{min-width:auto}}nav.prev_up_next a.index{font-size:small;padding-left:.5rem;padding-right:.5rem}dl.description dt{font-weight:700}table.list{margin-left:15px;margin-top:1em;margin-bottom:1em}table.list td{padding-right:5px}div.displaymath{overflow:auto}a.eqref:before{content:"("}a.eqref:after{content:")"}nav.prev_up_next{position:fixed;z-index:1;right:0;bottom:0;display:flex;height:2.5rem;background:linear-gradient(180deg,#80bf40 0,#4d7326)}nav.prev_up_next a{font-size:150%;margin:auto;padding:.5rem 1rem;text-decoration:none;color:#fff;text-shadow:1px 2px 0 rgba(0,0,0,.8)}hspace,vspace{margin:0;padding:0}div.bigskip{margin-bottom:4rem}div.medskip{margin:0;padding:0;margin-bottom:2rem}div.bigskip{margin:0;padding:0;margin-bottom:1rem}.tabular{border-collapse:collapse;color:#000;background-color:#fff;width:auto}.tabular td,.tabular th{vertical-align:baseline;text-align:left;padding:.3em .6em;empty-cells:show}td p:first-child,th p:first-child{margin-top:0;margin-bottom:0}td p,th p{margin-top:1em;margin-bottom:0}@keyframes a{0%{background-color:#d9d9d9}to{background-color:#fff}}div[class$=_thmwrapper]{margin-top:1rem}div[class$=_thmwrapper]:target{animation:a 1s ease}div[class$=_thmheading]{display:flex;font-weight:700;line-height:150%}span[class$=_thmtitle]:before{content:"("}span[class$=_thmtitle]:after{content:")"}div[class$=_thmcontent]{font-weight:400;margin-left:1rem;padding-top:.14rem;padding-left:1rem}span[class$=_thmlabel]{margin-left:.5rem;margin-right:.5rem}div[class$=proof_heading]{font-weight:700;line-height:120%;cursor:pointer}div.proof_content{font-weight:400;margin-left:1rem;padding-top:.5rem;padding-left:1rem}span.expand-proof{font-size:80%}div.hilite{animation:a 1s ease}span.qed{float:right}button.modal{border:none;text-align:center;text-decoration:none;background:transparent;cursor:pointer;padding:0}div.modal-container{position:fixed;z-index:2;top:0;left:0;display:none;width:100%;height:100%}div.modal-content{font-weight:400;overflow:auto;margin:auto;vertical-align:middle;border:1px solid #693;border-radius:5px;background-color:#fff;box-shadow:0 4px 8px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19)}div.modal-content header{position:relative;background:linear-gradient(180deg,#80bf40 0,#4d7326);color:#ffc;text-shadow:1px 2px 0 rgba(0,0,0,.8);display:flex;flex-direction:row;min-height:1rem;min-width:100%;text-align:center;vertical-align:middle;padding:0 .5rem;justify-content:space-between}div.modal-content header button.closebtn{font-size:120%;font-weight:700;background:Transparent;border:none;margin:auto 0;padding-right:.3rem;text-decoration:none;color:#ffc;cursor:pointer}div.modal-content header h1{font-size:120%;margin:auto 0;padding:.2rem;color:#fff}div.modal-content a{text-decoration:none}div.modal-content ul{padding:1rem;list-style:none}div.modal-content li{padding-left:.5rem}a.icon{text-decoration:none;color:#000;border:none;background-color:Transparent}div[class$=_thmheading]:hover div.thm_header_hidden_extras{display:inline-block}div.thm_header_hidden_extras{display:none}ul.quizz{display:flex;flex-direction:column;list-style:circle!important}ul.quizz li{display:flex;padding:.5rem;flex-direction:row;min-width:100%;min-height:3rem;flex-grow:1;align-items:center;justify-content:space-between}ul.quizz li.active-qright{background-color:green}ul.quizz li.active-qwrong{background-color:red}ul.quizz svg.icon{display:none;padding-right:.5rem;width:2rem;height:2rem}.tikzcd{overflow:auto}.tikzcd,.tikzpicture{display:block;margin:.5rem auto}.local_toc ul{padding-left:1rem;list-style:none}.local_toc ul a{text-decoration:none;color:#000}.local_toc ul li{padding:.2rem 0}nav.toc{flex-shrink:0;display:none;width:100%;overflow-x:hidden;overflow-y:auto;flex-direction:column;margin-right:1rem;padding:0;padding-right:1rem;transition:left .5s ease;background-color:#80bf40;border-right:none}@media (min-width:1024px){nav.toc{display:flex;max-width:25ch}}nav.active{width:100%}.toc ul{min-width:100%;padding-left:0;list-style:none}.toc ul a{display:inline-block;max-width:90%;padding-top:.5rem;padding-right:.5rem;padding-bottom:.5rem;transition:all .1s ease;text-align:left;text-decoration:none;font-size:1.125rem;color:#fff;text-shadow:2px 2px 2px rgba(0,0,0,.8);flex-grow:1}.toc ul a:hover{transition:all .2s ease;background:#693}.toc ul li{display:flex;min-width:100%;align-items:center;flex-wrap:wrap;justify-content:space-between;background-color:#80bf40}.toc ul li.current{background-color:#9c6;font-weight:400}.sub-toc-0 a{padding-left:.8rem}.sub-toc-1 a{padding-left:1.6rem}.sub-toc-2 a{padding-left:2.4rem}.sub-toc-3 a{padding-left:3.2rem}.sub-toc-4 a{padding-left:4rem}ul.sub-toc-1,ul.sub-toc-2,ul.sub-toc-3,ul.sub-toc-4{display:none}span.expand-toc{min-width:.7rem;width:.8rem;height:.8rem;padding:0;padding-right:.5rem;font-size:125%}span.expand-toc,svg.close-toc{cursor:pointer;text-align:center;color:#fff;background-color:Transparent}svg.close-toc{min-width:1.3rem;min-height:1.3rem;margin:.5rem;margin-left:auto;display:none}nav.active svg.close-toc{display:inline-block}ul.active{display:block}code.verb{font-family:monospace;font-style:normal;font-weight:400}pre.verbatim{margin:1rem 2rem;background-color:#f2f2f2;padding:.5rem}
--------------------------------------------------------------------------------
/blueprint/web/styles/theme-white.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{font:inherit;font-size:100%;margin:0;padding:0;border:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1;overflow-x:hidden;background:#f4f4f4}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-spacing:0;border-collapse:collapse}.clear:after{font-size:0;display:block;visibility:hidden;clear:both;height:0;content:" "}.clear{display:inline-block}* html .clear{height:1%}.clear{display:block}*{box-sizing:border-box}hr{clear:both;border:none;outline:none}em{font-style:italic}a{text-decoration:underline}ul{list-style:disc}ol{list-style:decimal}ol,ul{font-size:14px;padding:0 0 0 33px}ol li,ul li{margin:0}blockquote{padding:0 15px 0 40px}table{font-size:13px;width:100%;margin:20px 0;background:#fff}table th{font-size:16px;font-weight:700}table tr td{padding:7px}::selection{color:#fff;background:#000}::-moz-selection{color:#fff;background:#000}body{height:100vh;margin:0;flex-direction:column;color:#24292e;background-color:#fff}body,div.wrapper{display:flex;overflow:hidden}div.wrapper{flex-grow:1}div.content-wrapper{max-width:75ch}@media (min-width:1024px){div.content-wrapper{margin-left:auto;margin-right:auto}}div.content{flex-grow:1;display:flex;flex-direction:column;overflow:auto;padding:.5rem;margin-bottom:2.5rem}@media (min-width:1024px){div.content{padding:1rem;margin-bottom:0}}div.centered{display:flex;flex-direction:column;flex-wrap:wrap;align-items:center;justify-content:space-around;min-width:100%;margin:0 auto}div.flushleft,div.raggedright{display:flex;justify-content:flex-start}div.flushright,div.raggedbottom,div.raggedleft{display:flex;justify-content:flex-end}div.raggedbottom{flex-direction:column}div.content{line-height:1.4rem}div.content>p{margin:2.1rem 0}li>p{margin:.28rem 0}.icon{display:inline-block;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1rem;height:1rem;stroke-width:0;stroke:currentColor;fill:currentColor}h1,h2,h3,h4,h5,h6{font-family:Lucida Grande,Arial,Helvetica,sans-serif}h1{font-size:2rem;line-height:2rem;margin:1rem 0}h1,h2{color:#24292e}h2{font-size:1.5rem;margin:.8rem 0}h3,h4{margin:.67rem 0;color:#24292e}h3,h4,p{font-size:1rem}p{margin:.5rem 0}.titlepage{text-align:center}.titlepage h1{font-weight:400}b,strong{font-weight:700}dfn{font-style:italic}code,kbd,pre,samp{font-family:monospace,serif;font-size:1rem}pre{white-space:pre-wrap}q{quotes:"“" "”" "‘" "’"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5rem}sub{bottom:-.25rem}.mdseries,.textmf{font-weight:400}.bfseries,.textbf{font-weight:700}.rmfamily,.textrm{font-family:serif}.sffamily,.textsf{font-family:sans-serif}.texttt,.ttfamily{font-family:monospace}.textup,.upshape{text-transform:uppercase}.itshape,.textit{font-style:italic}.slshape,.textsl{font-style:oblique}.scshape,.textsc{font-variant:small-caps}small.tiny{font-size:x-small}small.scriptsize{font-size:smaller}small.footnotesize,small.small{font-size:small}.normalsize{font-size:normal}big.large{font-size:large}big.xlarge,big.xxlarge{font-size:x-large}big.huge,big.xhuge{font-size:xx-large}.rm{font-family:serif;font-style:normal;font-weight:400}.cal,.it{font-style:italic}.cal,.it,.sl{font-family:serif;font-weight:400}.sl{font-style:oblique}.bf{font-family:serif;font-weight:700}.bf,.tt{font-style:normal}.tt{font-family:monospace;font-weight:400}.underbar{text-decoration:underline}.fbox,.framebox{border:1px solid #000;padding:1px 3px}.quotation p,.quote p,.verse p{margin-top:0;margin-bottom:.5em}hr{color:#000}dd{margin-left:3rem}dd p{padding:0;margin:0 0 1rem}ul.breadcrumbs{margin:0;padding:0;list-style:none;font-size:small}ul.breadcrumbs li{display:inline}ul.breadcrumbs a{text-decoration:none;color:#3a434b}li.crumb:after{content:" / "}div.equation{display:flex;align-items:center;margin:1rem}div.equation span.equation_label{margin-right:1rem}div.equation span.equation_label:before{content:"("}div.equation span.equation_label:after{content:")"}div.equation div.equation_content{margin:auto}figure{display:flex;flex-direction:column;vertical-align:bottom;overflow:auto}figure img{display:block;margin:0 auto}figcaption{display:block;text-align:center;margin-bottom:.1rem}span.caption_ref,span.caption_title,span.subcaption{font-weight:700}span.caption_ref:after{content:":"}span.subref:after{content:")"}footer#footnotes{clear:both;padding-top:1rem;padding-left:1rem;border-color:gray;border-top:1px solid}footer#footnotes h1{font-size:1.5rem;margin:0;margin-bottom:.5rem;color:#000}a.footnote{text-decoration:none}a.footnote sup:after{content:"]"}a.footnote sup:before{content:"["}body>header{background:#f2f2f2;color:#24292e;text-shadow:none;display:flex;align-items:center;padding:.5rem}svg#toc-toggle{width:1.125rem;height:1.125rem;margin-right:.5rem}h1#doc_title{color:#24292e;font-size:1.5rem;margin:auto}#doc_title a,#doc_title a:visited{text-decoration:none;color:#24292e}.theindex li{list-style-type:none}nav.index-groups{margin-bottom:1rem}a[class^=index-group]{text-decoration:none}a.index-group:after{content:" |"}section.theindex{display:flex;flex-direction:row;flex-wrap:wrap;margin-top:1rem}section.theindex h2{min-width:100%;margin:1rem 0 .5rem}ul.index-column{min-width:100%}@media (min-width:1024px){ul.index-column{min-width:auto}}nav.prev_up_next a.index{font-size:small;padding-left:.5rem;padding-right:.5rem}dl.description dt{font-weight:700}table.list{margin-left:15px;margin-top:1em;margin-bottom:1em}table.list td{padding-right:5px}div.displaymath{overflow:auto}a.eqref:before{content:"("}a.eqref:after{content:")"}nav.prev_up_next{position:fixed;z-index:1;right:0;bottom:0;display:flex;height:2.5rem;background:#f2f2f2}nav.prev_up_next a{font-size:150%;margin:auto;padding:.5rem 1rem;text-decoration:none;color:#24292e;text-shadow:none}hspace,vspace{margin:0;padding:0}div.bigskip{margin-bottom:4rem}div.medskip{margin:0;padding:0;margin-bottom:2rem}div.bigskip{margin:0;padding:0;margin-bottom:1rem}.tabular{border-collapse:collapse;color:#24292e;background-color:#fff;width:auto}.tabular td,.tabular th{vertical-align:baseline;text-align:left;padding:.3em .6em;empty-cells:show}td p:first-child,th p:first-child{margin-top:0;margin-bottom:0}td p,th p{margin-top:1em;margin-bottom:0}@keyframes a{0%{background-color:#d9d9d9}to{background-color:#fff}}div[class$=_thmwrapper]{margin-top:1rem}div[class$=_thmwrapper]:target{animation:a 1s ease}div[class$=_thmheading]{display:flex;font-weight:700;line-height:150%}span[class$=_thmtitle]:before{content:"("}span[class$=_thmtitle]:after{content:")"}div[class$=_thmcontent]{font-weight:400;margin-left:1rem;padding-top:.14rem;padding-left:1rem}span[class$=_thmlabel]{margin-left:.5rem;margin-right:.5rem}div[class$=proof_heading]{font-weight:700;line-height:120%;cursor:pointer}div.proof_content{font-weight:400;margin-left:1rem;padding-top:.5rem;padding-left:1rem}span.expand-proof{font-size:80%}div.hilite{animation:a 1s ease}span.qed{float:right}button.modal{border:none;text-align:center;text-decoration:none;background:transparent;cursor:pointer;padding:0}div.modal-container{position:fixed;z-index:2;top:0;left:0;display:none;width:100%;height:100%}div.modal-content{font-weight:400;overflow:auto;margin:auto;vertical-align:middle;border:1px solid #e6e6e6;border-radius:5px;background-color:#fff;box-shadow:0 4px 8px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19)}div.modal-content header{position:relative;background:#f2f2f2;color:#24292e;text-shadow:none;display:flex;flex-direction:row;min-height:1rem;min-width:100%;text-align:center;vertical-align:middle;padding:0 .5rem;justify-content:space-between}div.modal-content header button.closebtn{font-size:120%;font-weight:700;background:Transparent;border:none;margin:auto 0;padding-right:.3rem;text-decoration:none;color:#24292e;cursor:pointer}div.modal-content header h1{font-size:120%;margin:auto 0;padding:.2rem;color:#464f59}div.modal-content a{text-decoration:none}div.modal-content ul{padding:1rem;list-style:none}div.modal-content li{padding-left:.5rem}a.icon{text-decoration:none;color:#24292e;border:none;background-color:Transparent}div[class$=_thmheading]:hover div.thm_header_hidden_extras{display:inline-block}div.thm_header_hidden_extras{display:none}ul.quizz{display:flex;flex-direction:column;list-style:circle!important}ul.quizz li{display:flex;padding:.5rem;flex-direction:row;min-width:100%;min-height:3rem;flex-grow:1;align-items:center;justify-content:space-between}ul.quizz li.active-qright{background-color:green}ul.quizz li.active-qwrong{background-color:red}ul.quizz svg.icon{display:none;padding-right:.5rem;width:2rem;height:2rem}.tikzcd{overflow:auto}.tikzcd,.tikzpicture{display:block;margin:.5rem auto}.local_toc ul{padding-left:1rem;list-style:none}.local_toc ul a{text-decoration:none;color:#24292e}.local_toc ul li{padding:.2rem 0}nav.toc{flex-shrink:0;display:none;width:100%;overflow-x:hidden;overflow-y:auto;flex-direction:column;margin-right:1rem;padding:0;padding-right:1rem;transition:left .5s ease;background-color:#fff;border-right:1px solid #f2f2f2}@media (min-width:1024px){nav.toc{display:flex;max-width:25ch}}nav.active{width:100%}.toc ul{min-width:100%;padding-left:0;list-style:none}.toc ul a{display:inline-block;max-width:90%;padding-top:.5rem;padding-right:.5rem;padding-bottom:.5rem;transition:all .1s ease;text-align:left;text-decoration:none;font-size:1.125rem;color:#464f59;text-shadow:none;flex-grow:1}.toc ul a:hover{transition:all .2s ease;background:#e6e6e6}.toc ul li{display:flex;min-width:100%;align-items:center;flex-wrap:wrap;justify-content:space-between;background-color:#fff}.toc ul li.current{background-color:#fff;font-weight:700}.sub-toc-0 a{padding-left:.8rem}.sub-toc-1 a{padding-left:1.6rem}.sub-toc-2 a{padding-left:2.4rem}.sub-toc-3 a{padding-left:3.2rem}.sub-toc-4 a{padding-left:4rem}ul.sub-toc-1,ul.sub-toc-2,ul.sub-toc-3,ul.sub-toc-4{display:none}span.expand-toc{min-width:.7rem;width:.8rem;height:.8rem;padding:0;padding-right:.5rem;color:#5c6976;font-size:125%}span.expand-toc,svg.close-toc{cursor:pointer;text-align:center;background-color:Transparent}svg.close-toc{min-width:1.3rem;min-height:1.3rem;margin:.5rem;margin-left:auto;color:#464f59;display:none}nav.active svg.close-toc{display:inline-block}ul.active{display:block}code.verb{font-family:monospace;font-style:normal;font-weight:400}pre.verbatim{margin:1rem 2rem;background-color:#f2f2f2;padding:.5rem}
--------------------------------------------------------------------------------
/home_page/404.html:
--------------------------------------------------------------------------------
1 | ---
2 | permalink: /404.html
3 | layout: default
4 | ---
5 |
6 |
19 |
20 |
21 |
404
22 |
23 |
Page not found :(
24 |
The requested page could not be found.
25 |
--------------------------------------------------------------------------------
/home_page/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 |
3 | # To upgrade, run `bundle update github-pages`.
4 | gem "github-pages", group: :jekyll_plugins
5 | # If you have any plugins, put them here!
6 | group :jekyll_plugins do
7 | #gem "jekyll-feed", "~> 0.12"
8 | end
9 |
10 | # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
11 | # and associated library.
12 | platforms :mingw, :x64_mingw, :mswin, :jruby do
13 | gem "tzinfo", "~> 1.2"
14 | gem "tzinfo-data"
15 | end
16 |
17 | # Performance-booster for watching directories on Windows.
18 | gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
19 |
20 | # Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
21 | # do not have a Java counterpart.
22 | gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
23 |
24 | # Used for locally serving the website.
25 | gem "webrick", "~> 1.7"
--------------------------------------------------------------------------------
/home_page/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | activesupport (6.0.5)
5 | concurrent-ruby (~> 1.0, >= 1.0.2)
6 | i18n (>= 0.7, < 2)
7 | minitest (~> 5.1)
8 | tzinfo (~> 1.1)
9 | zeitwerk (~> 2.2, >= 2.2.2)
10 | addressable (2.8.0)
11 | public_suffix (>= 2.0.2, < 5.0)
12 | coffee-script (2.4.1)
13 | coffee-script-source
14 | execjs
15 | coffee-script-source (1.11.1)
16 | colorator (1.1.0)
17 | commonmarker (0.23.4)
18 | concurrent-ruby (1.1.10)
19 | dnsruby (1.61.9)
20 | simpleidn (~> 0.1)
21 | em-websocket (0.5.3)
22 | eventmachine (>= 0.12.9)
23 | http_parser.rb (~> 0)
24 | ethon (0.15.0)
25 | ffi (>= 1.15.0)
26 | eventmachine (1.2.7)
27 | execjs (2.8.1)
28 | faraday (1.10.0)
29 | faraday-em_http (~> 1.0)
30 | faraday-em_synchrony (~> 1.0)
31 | faraday-excon (~> 1.1)
32 | faraday-httpclient (~> 1.0)
33 | faraday-multipart (~> 1.0)
34 | faraday-net_http (~> 1.0)
35 | faraday-net_http_persistent (~> 1.0)
36 | faraday-patron (~> 1.0)
37 | faraday-rack (~> 1.0)
38 | faraday-retry (~> 1.0)
39 | ruby2_keywords (>= 0.0.4)
40 | faraday-em_http (1.0.0)
41 | faraday-em_synchrony (1.0.0)
42 | faraday-excon (1.1.0)
43 | faraday-httpclient (1.0.1)
44 | faraday-multipart (1.0.3)
45 | multipart-post (>= 1.2, < 3)
46 | faraday-net_http (1.0.1)
47 | faraday-net_http_persistent (1.2.0)
48 | faraday-patron (1.0.0)
49 | faraday-rack (1.0.0)
50 | faraday-retry (1.0.3)
51 | ffi (1.15.5)
52 | forwardable-extended (2.6.0)
53 | gemoji (3.0.1)
54 | github-pages (226)
55 | github-pages-health-check (= 1.17.9)
56 | jekyll (= 3.9.2)
57 | jekyll-avatar (= 0.7.0)
58 | jekyll-coffeescript (= 1.1.1)
59 | jekyll-commonmark-ghpages (= 0.2.0)
60 | jekyll-default-layout (= 0.1.4)
61 | jekyll-feed (= 0.15.1)
62 | jekyll-gist (= 1.5.0)
63 | jekyll-github-metadata (= 2.13.0)
64 | jekyll-include-cache (= 0.2.1)
65 | jekyll-mentions (= 1.6.0)
66 | jekyll-optional-front-matter (= 0.3.2)
67 | jekyll-paginate (= 1.1.0)
68 | jekyll-readme-index (= 0.3.0)
69 | jekyll-redirect-from (= 0.16.0)
70 | jekyll-relative-links (= 0.6.1)
71 | jekyll-remote-theme (= 0.4.3)
72 | jekyll-sass-converter (= 1.5.2)
73 | jekyll-seo-tag (= 2.8.0)
74 | jekyll-sitemap (= 1.4.0)
75 | jekyll-swiss (= 1.0.0)
76 | jekyll-theme-architect (= 0.2.0)
77 | jekyll-theme-cayman (= 0.2.0)
78 | jekyll-theme-dinky (= 0.2.0)
79 | jekyll-theme-hacker (= 0.2.0)
80 | jekyll-theme-leap-day (= 0.2.0)
81 | jekyll-theme-merlot (= 0.2.0)
82 | jekyll-theme-midnight (= 0.2.0)
83 | jekyll-theme-minimal (= 0.2.0)
84 | jekyll-theme-modernist (= 0.2.0)
85 | jekyll-theme-primer (= 0.6.0)
86 | jekyll-theme-slate (= 0.2.0)
87 | jekyll-theme-tactile (= 0.2.0)
88 | jekyll-theme-time-machine (= 0.2.0)
89 | jekyll-titles-from-headings (= 0.5.3)
90 | jemoji (= 0.12.0)
91 | kramdown (= 2.3.2)
92 | kramdown-parser-gfm (= 1.1.0)
93 | liquid (= 4.0.3)
94 | mercenary (~> 0.3)
95 | minima (= 2.5.1)
96 | nokogiri (>= 1.13.4, < 2.0)
97 | rouge (= 3.26.0)
98 | terminal-table (~> 1.4)
99 | github-pages-health-check (1.17.9)
100 | addressable (~> 2.3)
101 | dnsruby (~> 1.60)
102 | octokit (~> 4.0)
103 | public_suffix (>= 3.0, < 5.0)
104 | typhoeus (~> 1.3)
105 | html-pipeline (2.14.1)
106 | activesupport (>= 2)
107 | nokogiri (>= 1.4)
108 | http_parser.rb (0.8.0)
109 | i18n (0.9.5)
110 | concurrent-ruby (~> 1.0)
111 | jekyll (3.9.2)
112 | addressable (~> 2.4)
113 | colorator (~> 1.0)
114 | em-websocket (~> 0.5)
115 | i18n (~> 0.7)
116 | jekyll-sass-converter (~> 1.0)
117 | jekyll-watch (~> 2.0)
118 | kramdown (>= 1.17, < 3)
119 | liquid (~> 4.0)
120 | mercenary (~> 0.3.3)
121 | pathutil (~> 0.9)
122 | rouge (>= 1.7, < 4)
123 | safe_yaml (~> 1.0)
124 | jekyll-avatar (0.7.0)
125 | jekyll (>= 3.0, < 5.0)
126 | jekyll-coffeescript (1.1.1)
127 | coffee-script (~> 2.2)
128 | coffee-script-source (~> 1.11.1)
129 | jekyll-commonmark (1.4.0)
130 | commonmarker (~> 0.22)
131 | jekyll-commonmark-ghpages (0.2.0)
132 | commonmarker (~> 0.23.4)
133 | jekyll (~> 3.9.0)
134 | jekyll-commonmark (~> 1.4.0)
135 | rouge (>= 2.0, < 4.0)
136 | jekyll-default-layout (0.1.4)
137 | jekyll (~> 3.0)
138 | jekyll-feed (0.15.1)
139 | jekyll (>= 3.7, < 5.0)
140 | jekyll-gist (1.5.0)
141 | octokit (~> 4.2)
142 | jekyll-github-metadata (2.13.0)
143 | jekyll (>= 3.4, < 5.0)
144 | octokit (~> 4.0, != 4.4.0)
145 | jekyll-include-cache (0.2.1)
146 | jekyll (>= 3.7, < 5.0)
147 | jekyll-mentions (1.6.0)
148 | html-pipeline (~> 2.3)
149 | jekyll (>= 3.7, < 5.0)
150 | jekyll-optional-front-matter (0.3.2)
151 | jekyll (>= 3.0, < 5.0)
152 | jekyll-paginate (1.1.0)
153 | jekyll-readme-index (0.3.0)
154 | jekyll (>= 3.0, < 5.0)
155 | jekyll-redirect-from (0.16.0)
156 | jekyll (>= 3.3, < 5.0)
157 | jekyll-relative-links (0.6.1)
158 | jekyll (>= 3.3, < 5.0)
159 | jekyll-remote-theme (0.4.3)
160 | addressable (~> 2.0)
161 | jekyll (>= 3.5, < 5.0)
162 | jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0)
163 | rubyzip (>= 1.3.0, < 3.0)
164 | jekyll-sass-converter (1.5.2)
165 | sass (~> 3.4)
166 | jekyll-seo-tag (2.8.0)
167 | jekyll (>= 3.8, < 5.0)
168 | jekyll-sitemap (1.4.0)
169 | jekyll (>= 3.7, < 5.0)
170 | jekyll-swiss (1.0.0)
171 | jekyll-theme-architect (0.2.0)
172 | jekyll (> 3.5, < 5.0)
173 | jekyll-seo-tag (~> 2.0)
174 | jekyll-theme-cayman (0.2.0)
175 | jekyll (> 3.5, < 5.0)
176 | jekyll-seo-tag (~> 2.0)
177 | jekyll-theme-dinky (0.2.0)
178 | jekyll (> 3.5, < 5.0)
179 | jekyll-seo-tag (~> 2.0)
180 | jekyll-theme-hacker (0.2.0)
181 | jekyll (> 3.5, < 5.0)
182 | jekyll-seo-tag (~> 2.0)
183 | jekyll-theme-leap-day (0.2.0)
184 | jekyll (> 3.5, < 5.0)
185 | jekyll-seo-tag (~> 2.0)
186 | jekyll-theme-merlot (0.2.0)
187 | jekyll (> 3.5, < 5.0)
188 | jekyll-seo-tag (~> 2.0)
189 | jekyll-theme-midnight (0.2.0)
190 | jekyll (> 3.5, < 5.0)
191 | jekyll-seo-tag (~> 2.0)
192 | jekyll-theme-minimal (0.2.0)
193 | jekyll (> 3.5, < 5.0)
194 | jekyll-seo-tag (~> 2.0)
195 | jekyll-theme-modernist (0.2.0)
196 | jekyll (> 3.5, < 5.0)
197 | jekyll-seo-tag (~> 2.0)
198 | jekyll-theme-primer (0.6.0)
199 | jekyll (> 3.5, < 5.0)
200 | jekyll-github-metadata (~> 2.9)
201 | jekyll-seo-tag (~> 2.0)
202 | jekyll-theme-slate (0.2.0)
203 | jekyll (> 3.5, < 5.0)
204 | jekyll-seo-tag (~> 2.0)
205 | jekyll-theme-tactile (0.2.0)
206 | jekyll (> 3.5, < 5.0)
207 | jekyll-seo-tag (~> 2.0)
208 | jekyll-theme-time-machine (0.2.0)
209 | jekyll (> 3.5, < 5.0)
210 | jekyll-seo-tag (~> 2.0)
211 | jekyll-titles-from-headings (0.5.3)
212 | jekyll (>= 3.3, < 5.0)
213 | jekyll-watch (2.2.1)
214 | listen (~> 3.0)
215 | jemoji (0.12.0)
216 | gemoji (~> 3.0)
217 | html-pipeline (~> 2.2)
218 | jekyll (>= 3.0, < 5.0)
219 | kramdown (2.3.2)
220 | rexml
221 | kramdown-parser-gfm (1.1.0)
222 | kramdown (~> 2.0)
223 | liquid (4.0.3)
224 | listen (3.7.1)
225 | rb-fsevent (~> 0.10, >= 0.10.3)
226 | rb-inotify (~> 0.9, >= 0.9.10)
227 | mercenary (0.3.6)
228 | minima (2.5.1)
229 | jekyll (>= 3.5, < 5.0)
230 | jekyll-feed (~> 0.9)
231 | jekyll-seo-tag (~> 2.1)
232 | minitest (5.15.0)
233 | multipart-post (2.1.1)
234 | nokogiri (1.13.6-x86_64-linux)
235 | racc (~> 1.4)
236 | octokit (4.22.0)
237 | faraday (>= 0.9)
238 | sawyer (~> 0.8.0, >= 0.5.3)
239 | pathutil (0.16.2)
240 | forwardable-extended (~> 2.6)
241 | public_suffix (4.0.7)
242 | racc (1.6.0)
243 | rb-fsevent (0.11.1)
244 | rb-inotify (0.10.1)
245 | ffi (~> 1.0)
246 | rexml (3.2.5)
247 | rouge (3.26.0)
248 | ruby2_keywords (0.0.5)
249 | rubyzip (2.3.2)
250 | safe_yaml (1.0.5)
251 | sass (3.7.4)
252 | sass-listen (~> 4.0.0)
253 | sass-listen (4.0.0)
254 | rb-fsevent (~> 0.9, >= 0.9.4)
255 | rb-inotify (~> 0.9, >= 0.9.7)
256 | sawyer (0.8.2)
257 | addressable (>= 2.3.5)
258 | faraday (> 0.8, < 2.0)
259 | simpleidn (0.2.1)
260 | unf (~> 0.1.4)
261 | terminal-table (1.8.0)
262 | unicode-display_width (~> 1.1, >= 1.1.1)
263 | thread_safe (0.3.6)
264 | typhoeus (1.4.0)
265 | ethon (>= 0.9.0)
266 | tzinfo (1.2.9)
267 | thread_safe (~> 0.1)
268 | unf (0.1.4)
269 | unf_ext
270 | unf_ext (0.0.8.1)
271 | unicode-display_width (1.8.0)
272 | webrick (1.7.0)
273 | zeitwerk (2.5.4)
274 |
275 | PLATFORMS
276 | x86_64-linux
277 |
278 | DEPENDENCIES
279 | github-pages
280 | http_parser.rb (~> 0.6.0)
281 | tzinfo (~> 1.2)
282 | tzinfo-data
283 | wdm (~> 0.1.1)
284 | webrick (~> 1.7)
285 |
286 | BUNDLED WITH
287 | 2.3.14
--------------------------------------------------------------------------------
/home_page/_config.yml:
--------------------------------------------------------------------------------
1 | # Welcome to Jekyll!
2 | #
3 | # This config file is meant for settings that affect your whole blog, values
4 | # which you are expected to set up once and rarely edit after that. If you find
5 | # yourself editing this file very often, consider using Jekyll's data files
6 | # feature for the data you need to update frequently.
7 | #
8 | # For technical reasons, this file is *NOT* reloaded automatically when you use
9 | # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10 | #
11 | # If you need help with YAML syntax, here are some quick references for you:
12 | # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
13 | # https://learnxinyminutes.com/docs/yaml/
14 | #
15 | # Site settings
16 | # These are used to personalize your new site. If you look in the HTML files,
17 | # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
18 | # You can create any custom variable you would like, and they will be accessible
19 | # in the templates via {{ site.myvariable }}.
20 |
21 | title: Polynomial Functors in Lean 4
22 | #email: your-email@example.com
23 | description: by Sina Hazratpour
24 | baseurl: "" # the subpath of your site, e.g. /blog
25 | url: "https://sinhp.github.io/Poly" # the base hostname & protocol for your site, e.g. http://example.com
26 | twitter_username:
27 | github_username: sinhp
28 | repository: sinhp/Poly
29 |
30 | # Build settings
31 | remote_theme: pages-themes/cayman@v0.2.0
32 | plugins:
33 | - jekyll-remote-theme
--------------------------------------------------------------------------------
/home_page/_include/mathjax.html:
--------------------------------------------------------------------------------
1 |
2 | {% if page.usemathjax %}
3 |
4 |
13 |
14 |
17 | {% endif %}
--------------------------------------------------------------------------------
/home_page/_layouts/default.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {% seo %}
8 |
9 |
11 |
12 |
13 |
14 | {% if jekyll.environment == "production" %}
15 |
17 | {% else %}
18 |
19 | {% endif %}
20 | {% include head-custom.html %}
21 |
22 |
23 |
24 | Skip to the content.
25 |
26 |
36 |
37 |
38 | {{ content }}
39 |
40 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/home_page/assets/css/style.scss:
--------------------------------------------------------------------------------
1 | ---
2 | ---
3 |
4 | /* In this file you can add css rules overriding rules defined by your Jekyll theme. */
5 |
6 | /* Import the CSS from the specified theme */
7 | @import "{{ site.theme }}";
8 |
9 | /* Put your rules below this line */
--------------------------------------------------------------------------------
/home_page/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | # Feel free to add content and custom Front Matter to this file.
3 | # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
4 |
5 | # layout: home
6 | usemathjax: true
7 | ---
8 |
9 | Useful links:
10 |
11 | * [Zulip chat for Lean](https://leanprover.zulipchat.com/) for coordination
12 | * [Blueprint]({{ site.url }}/blueprint/)
13 | * [Blueprint as pdf]({{ site.url }}/blueprint.pdf)
14 | * [Dependency graph]({{ site.url }}/blueprint/dep_graph_document.html)
15 | * [Doc pages for this repository]({{ site.url }}/docs/)
16 |
--------------------------------------------------------------------------------
/lake-manifest.json:
--------------------------------------------------------------------------------
1 | {"version": "1.1.0",
2 | "packagesDir": ".lake/packages",
3 | "packages":
4 | [{"url": "https://github.com/leanprover/doc-gen4",
5 | "type": "git",
6 | "subDir": null,
7 | "scope": "",
8 | "rev": "b3fb998509f92a040e362f8a06f8ee2825ec8c10",
9 | "name": "«doc-gen4»",
10 | "manifestFile": "lake-manifest.json",
11 | "inputRev": "main",
12 | "inherited": false,
13 | "configFile": "lakefile.lean"},
14 | {"url": "https://github.com/PatrickMassot/checkdecls.git",
15 | "type": "git",
16 | "subDir": null,
17 | "scope": "",
18 | "rev": "75d7aea6c81efeb68701164edaaa9116f06b91ba",
19 | "name": "checkdecls",
20 | "manifestFile": "lake-manifest.json",
21 | "inputRev": null,
22 | "inherited": false,
23 | "configFile": "lakefile.lean"},
24 | {"url": "https://github.com/Vtec234/lean4-seq",
25 | "type": "git",
26 | "subDir": null,
27 | "scope": "",
28 | "rev": "b6b76a5d7cc1c8b11c52f12a7bd90c460b7cba5a",
29 | "name": "seq",
30 | "manifestFile": "lake-manifest.json",
31 | "inputRev": null,
32 | "inherited": false,
33 | "configFile": "lakefile.lean"},
34 | {"url": "https://github.com/leanprover-community/mathlib4.git",
35 | "type": "git",
36 | "subDir": null,
37 | "scope": "",
38 | "rev": "fbe595fc740ee7a1789c6e6ebefa322e054a41c0",
39 | "name": "mathlib",
40 | "manifestFile": "lake-manifest.json",
41 | "inputRev": null,
42 | "inherited": false,
43 | "configFile": "lakefile.lean"},
44 | {"url": "https://github.com/mhuisi/lean4-cli",
45 | "type": "git",
46 | "subDir": null,
47 | "scope": "",
48 | "rev": "dd423cf2b153b5b14cb017ee4beae788565a3925",
49 | "name": "Cli",
50 | "manifestFile": "lake-manifest.json",
51 | "inputRev": "main",
52 | "inherited": true,
53 | "configFile": "lakefile.toml"},
54 | {"url": "https://github.com/jcommelin/lean4-unicode-basic",
55 | "type": "git",
56 | "subDir": null,
57 | "scope": "",
58 | "rev": "458e2d3feda3999490987eabee57b8bb88b1949c",
59 | "name": "UnicodeBasic",
60 | "manifestFile": "lake-manifest.json",
61 | "inputRev": "bump_to_v4.18.0-rc1",
62 | "inherited": true,
63 | "configFile": "lakefile.lean"},
64 | {"url": "https://github.com/dupuisf/BibtexQuery",
65 | "type": "git",
66 | "subDir": null,
67 | "scope": "",
68 | "rev": "c07de335d35ed6b118e084ec48cffc39b40d29d2",
69 | "name": "BibtexQuery",
70 | "manifestFile": "lake-manifest.json",
71 | "inputRev": "master",
72 | "inherited": true,
73 | "configFile": "lakefile.toml"},
74 | {"url": "https://github.com/acmepjz/md4lean",
75 | "type": "git",
76 | "subDir": null,
77 | "scope": "",
78 | "rev": "7cf25ec0edf7a72830379ee227eefdaa96c48cfb",
79 | "name": "MD4Lean",
80 | "manifestFile": "lake-manifest.json",
81 | "inputRev": "main",
82 | "inherited": true,
83 | "configFile": "lakefile.lean"},
84 | {"url": "https://github.com/leanprover-community/plausible",
85 | "type": "git",
86 | "subDir": null,
87 | "scope": "leanprover-community",
88 | "rev": "ebfb31672ab0a5b6d00a018ff67d2ec51ed66f3a",
89 | "name": "plausible",
90 | "manifestFile": "lake-manifest.json",
91 | "inputRev": "main",
92 | "inherited": true,
93 | "configFile": "lakefile.toml"},
94 | {"url": "https://github.com/leanprover-community/LeanSearchClient",
95 | "type": "git",
96 | "subDir": null,
97 | "scope": "leanprover-community",
98 | "rev": "ba020ed434b9c5877eb62ff072a28f5ec56eb871",
99 | "name": "LeanSearchClient",
100 | "manifestFile": "lake-manifest.json",
101 | "inputRev": "main",
102 | "inherited": true,
103 | "configFile": "lakefile.toml"},
104 | {"url": "https://github.com/leanprover-community/import-graph",
105 | "type": "git",
106 | "subDir": null,
107 | "scope": "leanprover-community",
108 | "rev": "c96401869916619b86e2e54dbb8e8488bd6dd19c",
109 | "name": "importGraph",
110 | "manifestFile": "lake-manifest.json",
111 | "inputRev": "main",
112 | "inherited": true,
113 | "configFile": "lakefile.toml"},
114 | {"url": "https://github.com/leanprover-community/ProofWidgets4",
115 | "type": "git",
116 | "subDir": null,
117 | "scope": "leanprover-community",
118 | "rev": "a602d13aca2913724c7d47b2d7df0353620c4ee8",
119 | "name": "proofwidgets",
120 | "manifestFile": "lake-manifest.json",
121 | "inputRev": "v0.0.53",
122 | "inherited": true,
123 | "configFile": "lakefile.lean"},
124 | {"url": "https://github.com/leanprover-community/aesop",
125 | "type": "git",
126 | "subDir": null,
127 | "scope": "leanprover-community",
128 | "rev": "ec060e0e10c685be8af65f288e23d026c9fde245",
129 | "name": "aesop",
130 | "manifestFile": "lake-manifest.json",
131 | "inputRev": "master",
132 | "inherited": true,
133 | "configFile": "lakefile.toml"},
134 | {"url": "https://github.com/leanprover-community/quote4",
135 | "type": "git",
136 | "subDir": null,
137 | "scope": "leanprover-community",
138 | "rev": "d892d7a88ad0ccf748fb8e651308ccd13426ba73",
139 | "name": "Qq",
140 | "manifestFile": "lake-manifest.json",
141 | "inputRev": "master",
142 | "inherited": true,
143 | "configFile": "lakefile.toml"},
144 | {"url": "https://github.com/leanprover-community/batteries",
145 | "type": "git",
146 | "subDir": null,
147 | "scope": "leanprover-community",
148 | "rev": "f2fb9809751c4646c68c329b14f7d229a93176fd",
149 | "name": "batteries",
150 | "manifestFile": "lake-manifest.json",
151 | "inputRev": "main",
152 | "inherited": true,
153 | "configFile": "lakefile.toml"}],
154 | "name": "Poly",
155 | "lakeDir": ".lake"}
156 |
--------------------------------------------------------------------------------
/lakefile.lean:
--------------------------------------------------------------------------------
1 | import Lake
2 | open Lake DSL
3 |
4 | package «Poly» where
5 | -- Settings applied to both builds and interactive editing
6 | leanOptions := #[
7 | ⟨`pp.unicode.fun, true⟩ -- pretty-prints `fun a ↦ b`
8 | ]
9 | -- add any additional package configuration options here
10 |
11 | require mathlib from git
12 | "https://github.com/leanprover-community/mathlib4.git"
13 |
14 | require seq from git "https://github.com/Vtec234/lean4-seq"
15 |
16 | @[default_target]
17 | lean_lib «Poly» where
18 | -- add any library configuration options here
19 |
20 | require checkdecls from git "https://github.com/PatrickMassot/checkdecls.git"
21 |
22 | meta if get_config? env = some "dev" then
23 | require «doc-gen4» from git
24 | "https://github.com/leanprover/doc-gen4" @ "main"
--------------------------------------------------------------------------------
/lean-toolchain:
--------------------------------------------------------------------------------
1 | leanprover/lean4:v4.18.0-rc1
--------------------------------------------------------------------------------