Code Monkey home page Code Monkey logo

coq-guarded-computational-type-theory's Introduction

This is the Coq formalization of Sterling and Harper's "Guarded Computational Type Theory".

Hacking

To build this Coq development, ensure that you have Coq 8.7 installed. I recommend that you install Coq in the standard way through OPAM, and my instructions are not guaranteed to work otherwise (they may work, but I have no way to double check).

opam install coq.8.7.1+1

Now, you are ready to build this development. Simply run make. To build the coqdoc (HTML rendering of the proofs), run make html.

coq-guarded-computational-type-theory's People

Contributors

jonsterling avatar jozefg avatar

Stargazers

 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

Forkers

pythonesque

coq-guarded-computational-type-theory's Issues

formalize that y-combinator realizes löb induction

  • define Y-combinator
  • show that it is computationally equivalent to its one-step unfolding
  • then I should be able to use meta-level löb induction to establish that this fixed point program has the right type

substitution for external language

It's come to the point (#12) where it is necessary to implement substitution for the external language, so that we can state rules about dependent types. It will be necessary to implement this substitution, which is not so hard, but what will be a bit annoying is the following:

  • carry over all the bureaucratic lemmas that I proved about substitution and renaming for the internal syntax

  • relate external substitution to internal substitution in some suitable way. I expect that most of the external rules that talk about substitutions will need some lemmas that yank an external substitution outside the interpretation brackets, by composing the substitution with the interpretation map.

I think that all this will be very bureaucratic to prove, but it's a prerequisite for getting the rest of this done. It would be so nice if this could have been done automatically... That would be possible if instead I had developed a general notion of second-order abstract syntax, but that is a separate project which I don't have time to work on right now.

The big renaming

The names of many different constructs have changed in the draft paper over the past week; the coq formalization should be updated to reflect this.

Try using type classes for "type system" properties?

Things like "extensionality" and "cper_valued" etc. seem like ideal uses of coq's type classes. Right now I just treat these as theorems and then add unification hints for them (Hint Resolve...). I think that type classes would work a bit better here, using the style from the Iris development.

Define cartesian product of clock-indexed family of types

I had intended not to formalize this just yet, but I think it's worth doing, and may be easier than I thought. (Note that there is still no need for indexing universes in clock contexts; by design, we intend this quantifier to not be irrelevant, since the whole point of it is to capture the notion of a clock-indexed family of types, which may of course vary in the clock in a non-trivial way.)

break up and get rid of "GCTT.v"

This is a grab-bag of random facts which should be reorganized and moved into the appropriate place; it also should use the notations that are now in Sequent.v.

formalize pi types

Now that I've formalized sigma types, it's time to formalize dependent function types. Then, we can establish that these interact correctly with the later modality, giving us the final rules that we need.

Replace uses of AUC with Pick operator

This clever operator I defined in order to validate the later modality rules without power objects being total can also be used to validate the intersection type rules, without using AUC. This would clean up some proofs and make them more systematic. I've already tried it out when proving that intersection commutes with sigma, and it worked really nicely there.

Update for latest Coq version

The latest version of Coq has ssreflect bundled with it; it would be good to get this building with that, and then the setup process for this development will be simpler.

break up GCTT.v into multiple files

This module takes long enough to refine that it makes sense to break it up into multiple files (to take advantage of caching).

  1. basic definitions about refinement matrices and behaviors
  2. definition of monotone operator, and its least fixed point; rolling lemmas.
  3. definition of universe hierarchy
  4. refinement matrix functionality lemmas, culminating in theorem for the full hierarchy
  5. proofs of closed "rules"

Consider different notion of open type equality

Currently, (external) open type equality factors through the internal open type equality: basically, if the two equands are equal types at equal total substitutions, then they are equal as open types.

This is a perfectly sensible notion of type equality, but it doesn't seem to work that well for some things. In particular, it is not necessarily the case that we can conclude /\k. A[k] = /\k. B[k] type from forall k, A[k] = B[k] type, so it does not seem possible (or at least easy) for us to prove the naïve formation rule for the intersection type. On the other hand, I have proved the version of this rule that uses equality in a universe, rather than general typehood. This version actually suffices for all applications, fwiw; just like how in Nuprl, you can't even state type equality without a universe.

Why does this happen? Remember that the judgments are interpreted with respect to the join of the type system hierarchy. So, ultimately the meaning of forall k, A[k] = B[k] type is something like forall k, there exists level i such that τ[i] != A[k] ~ B[k]. So, when we make the judgment generic in the clock, we have at each clock a level at which the equality holds, but we don't necessarily have a uniform such level. It seems like we ought to have one (some kind of "continuity" principle), but if it is even true, it would be very hard to prove.

We can get around the problem by simply defining the external type equality judgment so that it fixes a level outside the quantification over clocks: basically, we get around the problem of commuting those quantifiers by just changing a definition. This would be equivalent to just using equality-in-the-universe everywhere, but it might lead to easier-to-use rules. I may experiment with this at some point soon.

Right now it is not an emergency, since it is possible to just use equality in the universe for everything.

Better way to do induction on the type system?

It's currently really awful to do induction on the type system as implemented by the least fixed point of this monotone operator... I wonder if there is a way to define another type by Coq's inductive type mechanism which can act as a "handle" for doing induction on this object.

(This ticket isn't super well-defined, but I want to think about it a bit.)

Steps to validate open version of irrelevance rule

We need to define the open judgments in Coq, but I think that a first step would be to just give the version where you are open in a single variable; if we can prove the rule in question for this version, then we can surely prove it for the proper one.

To get this fired up, I need to implement simultaneous substitutions for the internal terms, and probably prove a few things about that. I know how to do that properly now, I just have to do it. I've been a little delayed in my progress because of the amount of time I've been having to put into the Systems and Constructive Logic courses.

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.