Git Product home page Git Product logo

logrel-coq's Introduction

Presentation

This repo contains formalisation work on implementing a logical relation over MLTT with one universe. This formalisation follows the work done by Abel et al. (described in Decidability of conversion for Type Theory in Type Theory, 2018), and Loïc Pujet's work on removing induction-recursion from the previous formalization, making it feasible to translate it from Agda to Coq.

The definition of the logical relation (LR) ressembles Loïc's in many ways, but also had to be modified for a few reasons :

  • Because of universe constraints and the fact that functors cannot be indexed by terms in Coq whereas it is possible in Agda, the relevant structures had to be parametrized by a type level and a recursor, and the module system had to be dropped out entirely.
  • Since Coq and Agda's positivity checking for inductive types is different, it turns out that LR's definition, even though it does not use any induction-induction or induction-recursion in Agda, is not accepted in Coq. As such, the predicate over Π-types for LR has been modified compared to Agda. You can find a MWE of the difference in positivity checking in the two systems in Positivity.v and Positivity.agda.

In order to avoid some work on the syntax, this project uses the AutoSubst project to generate syntax-related boilerplate.

Building

The project builds with Coq version 8.19.0. It needs the opam package coq-smpl. Once these have been installed, you can simply issue make in the root folder.

The make depgraph recipe can be used to generate the dependency graph.

Browsing the development

The development, rendered using coqdoc, can be browsed online. A dependency graph for the project is available here.

Syntax (re)generation

The syntax boilerplate has been generated using AutoSubst OCaml from the root folder, with the options -s ucoq -v ge813 -no-static -p ./theories/AutoSubst/Ast_preamble (see the AutoSubst OCaml documentation for installation instructions). Currently, this package works only with older version of Coq (8.14), so we cannot add a recipe to the MakeFile for automatically re-generating the syntax.

If you wish to regenerate the syntax by hand, you need to install AutoSubst from source using Coq 8.14, and use it with the previous options.

Getting started with using the development

A few things to get accustomed to if you want to use the development.

Notations and refolding

In a style somewhat similar to the Math Classes project, generic notations for typing, conversion, renaming, etc. are implemented using type-classes. While some care has been taken to try and respect the abstractions on which the notations are based, they might still be broken by carefree reduction performed by tactics. In this case, the refold tactic can be used, as the name suggests, to refold all lost notations.

Induction principles

The development relies on large, mutually-defined inductive relations. To make proofs by induction more tractable, functions XXXInductionConcl are provided. These take the predicates to be mutually proven, and construct the type of the conclusion of a proof by mutual induction. Thus, a typical induction proof looks like the following:

Section Foo.

Let P := … .
…

Theorem Foo : XXXInductionConcl P … .
Proof.
  apply XXXInduction.

End Section.

The names of the arguments printed when querying About XXXInductionConcl should make it clear to which mutually-defined relation each predicate corresponds.

logrel-coq's People

Contributors

arthur-adjedj avatar kyodralliam avatar mevenbertrand avatar ppedrot avatar yforster avatar

Stargazers

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

Watchers

 avatar

logrel-coq's Issues

Dependency graph generation fails

@yforster It seems like the dependency graph is not generated. Looking at the CI run, the make depgraph recipe requires coqdep, which seems to not be available when the recipe is used?

Some small scale improvements

This is a dump of the improvements I think are needed after working on the algorithmic typing bit, so as not to forget them.

General

  • Naming conventions: there is much needed uniformization to be done (for instance, _ren vs _wk?).

Automation

  • (n-ary) products: automation seems not to play nicely with the and3 and consort; there might be a need to register some hints somewhere.
  • Generic folding tactic: having fold_algo and fold_decl is somewhat weird… Is there a way to have a generic folding tactic, to be fed with more definitional equalities over the files?

Inductive types and induction principles

  • Induction theorem statement: how to generate the conclusion of mutual induction schemes (using the correct product), instead of hardcoding them as is currently done? Is the current Ltac-based code the nicest way to generate the induction principle for bundled algorithmic typing? Is there a better way to setup large induction than with the current local Let pattern?
  • Nicer (e)constructor: the current pattern of doing econstructor ; fold_decl could maybe be improved by wrapping econstructor + a generic folding tactic together.

Proof structure

  • Validity application: the current pattern of applying validity in hypothesis is quite ugly, but somewhat required because validity is not conclusion-directed; maybe there is a need for a tactic to handle this better.
  • Test unbundled weakenings: the current presentation of a good weakening as a record forces some suboptimal contortions when wanting to use a weakening in a extended context, maybe an unbundled version would be nicer.

Autosubst

  • Replace explicit renRen_term usage: not sure why this is needed, but it definitely shouldn't.
  • Renaming instances (defined in Weakening.v and Context.v) play poorly with autosubst.
  • Autosubst notations could be made quite a bit better

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.