ericfinster / catt.io Goto Github PK
View Code? Open in Web Editor NEWRevised Omega-categorical Typechecker
Revised Omega-categorical Typechecker
It would be good to add a test for equality (up to alpha equivalence) into our syntax. That would allow us to write .catt files that test the normalization functionality, e.g. to test that a given term A normalizes correctly to a second term B.
Would it be possible to get a single sentence of the major constructs used in examples?
I think one pager would go a long way, does not need to be full fledged reference or tutorial.
It would be good to be able to write "EOF" to stop parsing at a given point in a file.
Now implemented with the function "locally_maximal" in normalization.ml. It makes use of an operation on contexts called "remove_first_cell", which removes the first variable in the context (guaranteed to be locally maximal), and then gobbles up more of the context until it reaches the next local maximum.
To trigger this in a .catt file use the function "locmax".
There is the following code to determine the free variables of terms:
and tm_free_vars t =
match t with
| VarT id -> SS.singleton id
| DefAppT (_, args) ->
List.fold_right SS.union (List.map tm_free_vars args) SS.empty
| CellAppT (cell, args) ->
let args_fvs = List.fold_right SS.union (List.map tm_free_vars args) SS.empty in
SS.union (cell_free_vars cell) args_fvs
It seems very odd that (cell_free_vars cell)
is added to the free variables. This gives for example:
Simple normal form: [coh (x0 : *) : x0 -> x0](x)
Free variables x x0
whereas intuitively I feel the free variables should just be x
?
Apologies if I have misunderstood how this is meant to work, I couldn't find a bit in the paper explaining how to calculate the free variables of coherences.
different monads could be implemented with modules in ocaml as in
https://blog.haberkucharsky.com/technology/2015/07/21/more-monads-in-ocaml.html
This might neaten up some of the code where there are multiple monads being used
It would be useful to have a catt command that instructs the parser to load another catt file. This would allow us to call multiple catt test files from a single master file.
When enough locally maximal terms are supplied for a substitution, the checker will ignore other invalid variables. The following should not typecheck:
coh comp
(x : *) (y : *) (f : x -> y) (z : *) (g : y -> z)
: x -> z
coh whisk_good
(x : *) (y : *) (f : x -> y) (g : x -> y) (a : f -> g) (z : *) (h : y -> z)
: comp(f,h) -> comp(g,h)
coh whisk_bad
(x : *) (y : *) (f : x -> y) (g : x -> y) (a : f -> g) (z : *) (h : y -> z)
: comp(z,w,f,h) -> comp(g,h)
I'm not sure of the intended tab structure of the files. We need to check our editors are configured in a consistent way. Let's discuss this.
Eric suggested we could use a PPX syntax extension to allow us to write Catt terms directly in OCaml. This would remove the need for a separate parser, and give us an ability to work more flexibly (build lists of contexts, call other files, etc). It would also let us experiment with the Catt library interactively in the toplevel.
I just watched the HoTTest presentation @jamievicary gave in December, and Emily Riehl's question (and the answer) brought to mind that there may be a (ready-made) proof of a stronger weak equivalence than the one stated as WIP in the talk, which might get you both strict unitality and strict associativity.
Specifically, in "Coherence for tricategories", Gordon, Power, and Street show that Gray-categories (which are strict in everything except interchange, as the answer mentioned) are weakly equivalent to tricategories.
I'm just an interested hobbyist, so I don't know if this has already been considered and is unsuitable in some way, but I thought I'd bring it up.
EDIT: On consideration, it may be that what's missing is the generalization to higher n, and perhaps the proof doesn't generalize straightforwardly - I could certainly see how that could be the case.
In #17 I have implemented some reduction relations. We would expect that unification is able to unify definitionally equal terms but this does not seem to be the case. I believe a fallback case of the unification algorithm has gone missing somewhere between all the different branches (in particular the case that tries to completely unfold both values).
An example of this not working can be seen in the current (as of Web 07 Apr) version of #17 with the unification algorithm giving the following error:
Typing error:
The expression:
unitor g
has type:
[comp g (id y) => g]
but was expected to have type:
[g => _ C x y f g a]
even though we get the following reduction above:
Checking definition: test
Checking complete for test
Type: {C : Cat} {x : [C]} {y : [C]} (f : [x => y]) -> [x => y]
Term: \{C}. \{x}. \{y}. \f. comp f (id y)
Type unfolded: {C : Cat} {x : [C]} {y : [C]} (f : [x => y]) -> [x => y]
Term unfolded: \{C}. \{x}. \{y}. \f. f
I seem to remember that you had some sort of (at least minimal) interface for editing catt terms when you gave a demo, does this still exist?
the identity on a zero cell can be defined in two possible ways
let id = coh (x : *) : x -> x
let id2 = comp (x : *) : x -> x
@jamievicary seemed to believe that each term should either be a comp or a coh. Is it possible that the second term should not be accepted?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.