the1lab / 1lab

A formalised, cross-linked reference resource for mathematics done in Homotopy Type Theory
https://1lab.dev
GNU Affero General Public License v3.0
334 stars 63 forks source link

Flat records for limits/colimits #417

Open TOTBWF opened 1 month ago

TOTBWF commented 1 month ago

Description

This PR flattens out Binary-products et. al into flat records to get better printing.

Currently, this is a draft to get API feedback!

Checklist

Before submitting a merge request, please check the items below:

If your change affects many files without adding substantial content, and you don't want your name to appear on those pages (for example, treewide refactorings or reformattings), start the commit message and PR title with chore:.

Lavenza commented 1 month ago

Pull request preview

ncfavier commented 1 month ago

Could we have a test/reproducer for the printing issues with, say, binary products?

TOTBWF commented 1 month ago

I think @plt-amy had a good real world example in https://gist.github.com/plt-amy/9f1efaaef2fe15baf4965be21e60994b, we could use the code that generated the nightmare for that

ncfavier commented 1 month ago

I guess things like δ-natural can serve as test cases. Without this PR the goal is

is-product.⟨ Product.has-is-product (all-products y y) , id ⟩
      id
      ∘ f
      ≡
      is-product.⟨ Product.has-is-product (all-products y y) ,
      f ∘ Product.π₁ (all-products x x) ⟩
      (f ∘ Product.π₂ (all-products x x))
      ∘ is-product.⟨ Product.has-is-product (all-products x x) , id ⟩ id

With this PR it becomes ⟨ id , id ⟩ ∘ f ≡ ⟨ f ∘ π₁ , f ∘ π₂ ⟩ ∘ ⟨ id , id ⟩. Much better!