Git Product home page Git Product logo

1lab's Introduction

Hi there πŸ‘‹

I'm AmΓ©lia (acceptable nicknames: Amy, Lia, Ame; acceptable pronouns: they/them), a Brazilian mathematician working independently on homotopy type theory and formalised category theory. I'm also a software engineer @obsidiansystems, where I work on making the web better with Haskell.

  • πŸ”­ I work on the 1Lab (source), a formalised, cross-linked, explorable reference resource for cubical methods in homotopy type theory, featuring almost twenty thousand lines each of prose and of code. In addition to the mathematics, the project serves as an experiment for bringing Agda publishing on the web to 21st-century standards.
  • βͺ I worked on the type checker for the Amulet programming language, where I independently re-implemented many of GHC's trickier type system features, including (but not limited to) GADTs, type families, type classes with functional dependencies, and "quick look" impredicative polymorphism.
  • πŸ’¬ Ask me about synthetic homotopy-coherent mathematics, synthetic homotopy theory, category theory, Haskell programming, and formalisation with Agda.

  • πŸ“« How to reach me: Start by sending me a Twitter direct message at plt_amy, whence we can discuss an appropriate method of communication :) If you're off Twitter, my email address is me [at] amelia.how.

1lab's People

Contributors

anka-213 avatar favonia avatar guilhermehas avatar harrisongrodin avatar isovector avatar jake-gillberg avatar jakobbruenker avatar jappeace avatar jd95 avatar juanmeleiro avatar jul1u5 avatar kisonecat avatar kzvi avatar marshall-lee avatar mattecapu avatar matthiashu avatar mazetone avatar mietek avatar mmcqd avatar moritayasuaki avatar ncfavier avatar patrick-nicodemus avatar plt-amy avatar rattlehead15 avatar squiddev avatar szumixie avatar taneb avatar tomdjong avatar totbwf avatar uniwuni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

1lab's Issues

Refactor set quotients into set coequalisers

I was defining abelianisations last night and I realised that like 80% of the code I had defined to match on the underlying type of the abelianisation was shared with the code for set quotients. But they're both really easy coequalisers to define

Change definition of Cartesian to include a terminal object.

Currently, our definition of cartesian only requires binary products, which is somewhat non-standard. We should probably create a new module Cat.Cartesian that exposes this new definition, along with some helpers (agda-categories would be good to look at here).

This will also require some careful proofreading to ensure that we update any prose in other modules.

Results needed for topos theory

I'm writing up the beginnings of a section on topos theory at https://github.com/plt-amy/1lab/tree/feature/topoi (specific definition used: A topos is a lex reflective subcategory of a category of presheaves) and ran into a bunch of results we do not have yet. Tracking them here:

  • Monadic adjunctions create limits (more generally, C^M is complete when C is)
  • Reflective subcategory inclusions are monadic functors
  • Limit respects natural isomorphism (i.e. for F β‰… G, we have Limit F β†’ Limit G)
  • Reflective subcategories are exponential ideals when the reflector is lex (Elephant, prop A4.3.1)
  • Left adjoints preserve colimits (dualises right adjoints preserve limits, which we already have)
  • Slices of presheaf categories are presheaf categories: PSh(C)/F β‰… PSh(∫ F)
  • Sliced adjoint functors
  • Equivalent characterisations of reflective subcategories: right adjoint is fully faithful ←→ counit is a natural isomorphism
  • Colimits in functor categories (dualising limits in functor categories, which we already have)

Building the website without Agda

Knee-deep in the #186 refactor, getting all of the Agda to check would be a nightmare. But I still want to make sure my diagrams, TeX, etc look right!

Would it be possible to have a "mode" (like -w) which builds only the Literate Agda pages, directly from the Markdown source?

Big list of wants: better (meta)programming facilities

Just a really big list of requests for an eventual refactoring of the "bootstrap" code (some parts of 1Lab, some parts of Data).

  • Proper separation between the data structures and their properties for:
    • List
    • Bool
    • Fin
  • Rescue Vec out from under the Reflection module
  • Separate reflection primitives and reflection helpers
  • Developer documentation in all the reflection modules
  • Idiom-syntax, Do-syntax, Alt-syntax for Maybe
  • Move <$> from Idiom-syntax to (e.g.) Map-syntax
  • Proper fixities for _>>=, _=<<_
  • Map-syntax instance for Arg
  • Missing "generic" combinators:
    • Idiom-syntax: <*, *>
    • <$
    • Traverse-syntax (traverse, sequence)
    • Fold-syntax (nondet, choice/asum/msum)
  • Combinator to abstract away instance search
  • Generic term traversals?
  • More convenient List ErrorPart combinators?
    • Wrap TC in a reader-style monad to carry around the logging prefix for the current tactic?

Modules over commutative rings

I don't think we'll need modules over noncommutative rings, so let's stick with modules over CRing (needs #87). The definition should mirror the rest of the algebraic hierarchy so we can invoke the univalent record macro.

TODO:

  • R-modules
  • R as an R-module
  • The category R-Mod

New macros have screwed up spacing

The macro implementation I ported always adds extra braces around macros, to prevent future parsing accidents: e.g. if \a expands to \b, we wouldn't want the first expansion pass to expand \a x into \bx. Unfortunately there's also a problem with spacing. Since KaTeX does layout properly, groups are taken into account. Contrast a {\leftarrow} b vs a \leftarrow b.


I have a fix for this... somewhere, which was changing the generated parser for macros not to consume spaces unless it's scanning for an argument. There's bound to be a better way which isn't "Amy writes a proper reimplementation of TeX".

Commutative Monoid Solver

When doing stuff with integers, it's pretty common to see some really gnarly goals involving nats.
For instance, this monster comes up when you try to define integer multiplication

a * x + b * y + (y + a * y + (x + b * x)) ≑ a * y + b * x + (x + a * x + (y + b * y))

A simple commutative monoid solver would make quick work of this, so it would be a nice-to-have.

Design

The basic idea is to reflect expressions in some monoid into the following data type:

data Expr : Type β„“ where
  Ξ΅   : Expr
  _βŠ—_ : Expr β†’ Expr β†’ Expr
  [_↑] : M β†’ Expr

Then, we can do a sort of NbE style proof where we interpret this into some semantic domain.
In our case, this will be sorted lists. Then, we shall define a sort of "readback" function that
takes a sorted list and reflects it back into Expr.

However, this poses some problems! In particular, we will need a notion of decidable ordering on M, which is no good.
However, we can circumvent this by using an ordering on Term! This requires quite a bit of machinery though, so it is probably best to split the work across several PRs.

Lex functors preserve monos

Should be a super simple theorem to write up. We already have a characterisation of monos as certain squares being pullbacks.
Bonus points: Rex functors preserve epis, after #90 is done.

Split into base/properties modules

The way 1Lab.Data as a namespace is currently structured is very conducive to dependency cycles.

For instance, 1Lab.Data.Sum depends on 1Lab.Data.Nat, the former module needs a proof of commutativity of addition to prove sums are closed under h-levels. This is a problem if you want to use coproducts -- something very fundamental! -- in any module that might be imported from Nat.

Proposed solution: The following modules should all be split into Base/Properties, with the current module serving as a place to hang re-exports off of:

  • Nat
  • Int
  • List
  • Sum

Commutative rings

Mirror the definition of Ab for CRing, so we get univalence of the category of commutative rings for free.

TODO:

  • Define commutative rings
  • Write a bit about them
  • Data.Int has everything we need to provide a CRing of integers. Just needs to be assembled.

Kernels of ring homomorphisms, quotients, ideals as representing kernels

Essentially the same thing as Algebra.Group.Subgroup, but for ring/ideal rather than group/normal subgroup. Snarky wording about subsets and evil wizards is mandatory.

  • Images of ring homomorphisms
  • Kernels of ring homomorphisms
  • "im(f)" satisfies the universal property of "R/ker(f)"
  • Ideal
  • Quotient by an ideal
  • Kernel of the quotient map is the ideal we started with

Build daemon for katex

I've been spending some time looking at what the slow bits are of a clean 1lab build:

Name Count Total Average Max
node 1,931 6m18s 0.20s 0.53s
pdflatex 258 4m16s 0.99s 1.80s
agda 1 4m04s 4m04s 4m04s
agda html 227 48.81s 0.22s 1.12s
git 383 12.58s 0.03s 0.13s
pdftocairo 258 9.54s 0.04s 0.22s

While there's some things which are always going to be slow (Agda), the obvious issue here is KaTeX. During a fresh build, we're spinning up 1.9k KaTeX processes, each of which runs for a fraction of a second!

It would be worth experimenting with creating some sort of build daemon here; just a basic JS program which reads an equation from stdin and writes the resulting SVG to stdout. Our Shake code can then maintain a pool of these, avoiding the cost of spawning a process for each job.

Watch mode

For quick editing! Only recompiles the changed file(s), no Agda links, no neighbourhood graph, no type-on-hover. Please.

(Co)Limit Reasoning Module

It would be nice to have a good API for reasoning about (Co)Limits, much like we have with Cat.Reasoning and Cat.Functor.Reasoning.

On higher zoom levels (125%+), the sidebar disappears with no way to access it

The sidebar disappearing is intentional as a feature, which makes sense since it prevents the main content from getting too squished. However, a side-effect of the current implementation is that there is no way to directly access the sidebar while at higher zooms and more importantly no indication that there even is a sidebar (particularly problematic when a user has default page zoom set above 125%).

A solution to both issues here would be perhaps to introduce some sort of dropdown/popup/something (sorry, not a UI designer). Perhaps a "hamburger menu"-esque thing on the top bar? Or maybe a pullout drawer kind of feature.

Thanks!

Show that left adjoints preserve specific colimits

In Cat.Functor.Adjoint.Continuous we show that left adjoints preserve colimits generally, but don't show that they preserve specific colimits (coproducts, coequalisers, etc).

This should be pretty mechanical, and any prospective implementor could look at the limit versions of these proofs right here, so this should make a good beginner issue :)

This is blocked on #78.

Checklist

  • Initial Objects
  • Coproducts
  • Coequalisers
  • Pushouts

Finitely cocomplete categories

Dualising the definition of finitely complete categories, the alternative characterisations, and right exact functors.

  • Finitely cocomplete categories
  • Initial objects + pushouts => coproducts, coequalisers
  • Initial objects, coproducts, coequalisers => pushouts
  • Left exact functors

error: Duplicate binding for built-in thing TYPE

Hi all. I am on MacOS 13.2. I cloned this repo into my ~/agda folder and added it to my ~/.agda/libraries file. I am using agda-mode for VSCode with Agda 2.6.3 and am getting this error:

Duplicate binding for built-in thing TYPE, previous binding to
Agda.Primitive.Set
when checking the pragma BUILTIN TYPE Type

when loading in a file with just:

open import 1Lab.Type

and with an agda-lib file in the same folder:

depend: cubical-1lab
include: .

If I downgrade to Agda 2.6.2.2 I get a different error:

Unrecognized option: --no-load-primitives
when scope checking the declaration
  open import 1Lab.Type

It is possible I somehow have some code that conflicts with 1lab from some HoTTest summer school files, but I've removed everything from my ~/.agda/defaults and I am only depending on and importing cubical-1lab in this folder. I am not sure how to debug this issue.

Record hierarchies

Since some kind of record hierarchy is definitely required for, say, algebra, category theory, topology, and pretty much any other sort of mathematics, the implementation details need some consideration.

Usually, there are at least two separate kinds of records related to a single kind of structure:
One that parameterizes over all the data involved in the structure, e.g.

data isSemigroup (A : Type) (_*_ : A -> A -> A) where
  field is-associative : ...
  ...

which is needed to state that a specific operation does conform to laws required for a structure, as well as another one that parameterizes only over the involved type:

data SemigroupOn (A : Type) where
  field
    _*_ : A -> A -> A
    is-associative : ...
  ...

which is mainly required to avoid clutter in type signatures and allow for more general theorems.

One probably needs both of these types, but which approach should be used primarily?

It does get even more complicated when considering "inheritance"/nested records: given the semigroup definitions above, how exactly would one extend these to monoids? Would MonoidOn A have SemigroupOn A as a field, or would it include the _*_ operator as a field as well as a proof of isMonoid A _*_?

The questions do not stop there - for example, given that it is unique, should the unit of a monoid be included in the type signature of isMonoid? That's why this issue is meant as a place to collect ideas on how to find solutions to all of these topics.

Search for headings

We should augment our call to Pandoc so it also yeets a list of all headings. Then we should add these headings to the search prompt.

Add a Regularity Tactic

When dealing with some displayed category stuff, it's very easy to get owned by a bunch of transports that are stuck on refl. This is really tedious to clean up, so we should automate it!

The most naive solution here is to repeatedly re-traverse the term looking for stuck transports, and then buidling ap calls, but we can probably do better with a single traversal + some sort of zipper structure.

Watch mode breaks when adding new files

Adding a new file while watch mode is running leaves me in a loop of

πŸ”¨ src/Cat/Displayed/Cartesian/Indexing.lagda.md has changed. Rebuilding _build/html/Cat.Displayed.Cartesian.Indexing.html.
# agda (for OracleQ (MainCompileQ ()))
Checking Cat.Displayed.Cartesian.Indexing (/home/amelia/default/Projects/1lab.dev/src/Cat/Displayed/Cartesian/Indexing.lagda.md).
Generating HTML for Cat.Displayed.Cartesian.Indexing
❌ Build failed in 1.68s
Error when running Shake build system:
  at need, called at app/Main.hs:276:22 in main:Main
* Depends on: _build/html/Cat.Displayed.Cartesian.Indexing.html
  at copyFile', called at app/Main.hs:95:12 in main:Main
  at need, called at src/Development/Shake/Internal/Derived.hs:92:5 in shake-0.19.6-7wpTzbc7Oxe2G9GkWOH0sV:Development.Shake.Internal.Derived
* Depends on: _build/html0/Cat.Displayed.Cartesian.Indexing.html
  at error, called at src/Development/Shake/Internal/Rules/File.hs:179:58 in shake-0.19.6-7wpTzbc7Oxe2G9GkWOH0sV:Development.Shake.Internal.Rules.File
* Raised the exception:
Error, rule finished running but did not produce file:
  _build/html0/Cat.Displayed.Cartesian.Indexing.html

Most pages don't have descriptions

We have 66 163 pages. Only 2 have a description field:

src/1Lab/Univalence/SIP.lagda.md
src/1Lab/Equiv/Biinv.lagda.md

Example description

Here's a to-do list:

Duskin's Monadicity Theorem

In order to round out our monadicity theorem collection, it would be fun to prove Duskin's Monadicity Theorem. There are a couple of variantions on this, but the following version seems the most elegant:

A conservative right adjoint U: D β†’ C between finitely complete categories is monadic if any congruence in D which has a quotient in C already has a quotient in D, and that quotient that is preserved by U.

Dark mode?

Would adding dark mode be valuable enough to justify some extra scss complexity?

I'd be happy to handle it, albeit with no guarantees about whether the alternative color scheme is any good.

Proposal

  1. CSS-only solution with prefers-color-scheme and some presumably heavy sass restructuring
  2. Add a toggle override and store in localstorage.1lab.dark_mode : 'enabled' | 'disabled'

So nice that you have a Β«Serif FontΒ» check box!

Usually I have to write a custom CSS that a browser extension lets me inject into web pages. So for example I have a CSS for GitHub that sets serif font as default. For once I am freed from this work!

Wiki links

After #181 landed, we're on Pandoc 3.0, which supports wiki links in the Markdown reader. Wiki links are parsed as normal Link nodes, with a class (I think: please check) of wikilink

We should use wiki links to... link to pages by their titles. Since this will probably require a first pass over the Markdown to collect future link targets, the list of targets should include arbitrary elements with given attributes, e.g. paragraphs. I'm not too sure how that would work, but perhaps a block element with link-target="the description" attribute would (a) get an id if it doesn't have one, (b) be added to the map of link targets?

Citations

As the 1Lab grows, we should be mindful of properly citing our sources! For instance, #67 pulls quite a bit from multiple sources, and it would be great if we had a nice way of giving credit. Perhaps @SquidDev has some thoughts?

Collect types for primitives and postulates

Currently, primitives like primHComp and postulates like PathP don't have types. This is because they aren't compiled, and so, the HTML backend never gets a chance to look at their types. Can we fix this?

error from docker run

Any idea how to solve this?

docker run -it -v $PWD:/workspace docker.io/pltamy/1lab:latest /bin/bash -i
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown.

or equivalently, from scratch:

[giuliohome@localhost ~]$ docker run -it -v $PWD:/workspace docker.io/pltamy/1lab:latest /bin/bash -i
Unable to find image 'pltamy/1lab:latest' locally
latest: Pulling from pltamy/1lab
68d3b63725a1: Pull complete 
9a28b0df1b70: Pull complete 
b8df2d40799e: Pull complete 
222dc704eb55: Pull complete 
c134d319b85f: Pull complete 
e8339d147d0b: Pull complete 
1df22868c217: Pull complete 
71e4e4735fa1: Pull complete 
54e6b3b6dbbc: Pull complete 
0e9d80cf9b9f: Pull complete 
Digest: sha256:18a2acfa30c28d83a580d2fef0ca192beecf71cb021a7859b0de133e5f493853
Status: Downloaded newer image for pltamy/1lab:latest
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown.
ERRO[0096] error waiting for container: context canceled 

Refactor proof that conservative functors reflect limits

The proof that conservative functors reflect limits that they preserves is quite short and elegant, but unfortunately this comes at the cost of requiring a subst (See here). This can cause issues later down the line, as the limits we get out of it won't quite line up with the ones we want. Luckily, the direct proof isn't so bad, so we should probably just do that. See #76 for what that might look like.

Add definitions for preservation/reflection of specific (co)limits

Right now we have a notion of preservation/reflection of (co)limits that works over limit diagrams, but this is often a bit annoying to work with when we are working with some concrete (co)limit, as it involves dancing between limit diagrams + the concrete definitions. It would be a bit more ergonomic if we had some definitions like Preserves-products or Reflects-coequalisers, as well as a good API for moving between the general + specific forms.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.