metacoq icon indicating copy to clipboard operation
metacoq copied to clipboard

Compute Dependencies in the extractable monad

Open gmalecha opened this issue 5 years ago • 7 comments

This is a proposal to implement tmQuoteRecursive using an action tmDependencies that returns a list of all of the dependencies. The client can then traverse the list to compute the global_references type. I'm not sure how much this simplifies things, but it seems a little bit more orthogonal and potentially allows quoting less.

gmalecha avatar May 08 '19 01:05 gmalecha

Yes. tmDependencies would be nice!

SimonBoulier avatar May 08 '19 11:05 SimonBoulier

tmDependencies was almost definable in the monad (even before this PR)? Fuel was needed to circumvent the issue of convincing the termination checker. Would it be better (more general) to just add a fixpoint combinator in the monad?

aa755 avatar May 08 '19 13:05 aa755

There was a PR for Coq at some point (by Théo I think?) introducing a flag to make fixpoints unguarded. That would make a fixpoint combinator in the monad superfluos. Do we know what the status of this PR is?

On 8 May 2019 4:01:37 p.m. Abhishek Anand [email protected] wrote:

tmDependencies was almost definable in the monad (even before this PR)? Fuel was needed to circumvent the issue of convincing the termination checker. Would it be better (more general) to just add a fixpoint combinator in the monad? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

yforster avatar May 08 '19 13:05 yforster

When used, the option of making fixpoints unguarded will make the entire logic inconsistent. Adding a fixpoint combinator to the monad will not.

-- Abhishek http://www.cs.cornell.edu/~aa755/

On Wed, May 8, 2019 at 6:26 AM Yannick Forster [email protected] wrote:

There was a PR for Coq at some point (by Théo I think?) introducing a flag to make fixpoints unguarded. That would make a fixpoint combinator in the monad superfluos. Do we know what the status of this PR is?

On 8 May 2019 4:01:37 p.m. Abhishek Anand [email protected] wrote:

tmDependencies was almost definable in the monad (even before this PR)? Fuel was needed to circumvent the issue of convincing the termination checker. Would it be better (more general) to just add a fixpoint combinator in the monad? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MetaCoq/metacoq/pull/133#issuecomment-490485013, or mute the thread https://github.com/notifications/unsubscribe-auth/AADZ44UWEM733UVETANZOG3PULIJ5ANCNFSM4HLNSIIQ .

aa755 avatar May 08 '19 13:05 aa755

General recursion could be nice, but that might warrant a longer discussion. In particular, it might make reasoning about meta functions more difficult.

gmalecha avatar May 08 '19 14:05 gmalecha

I’m surprised you couldn’t do it with fuel and a computed bound, as there is a finite number of references in a global_environment + term. Termination might be tricky, e.g. avoiding loops cleanly requires to know that the env is well-founded/linearizable (Typing.wf would ensure this). But I don’t see how it could be impossible, at least using the size of the term as a bound for the number of global_references or something like that.

mattam82 avatar May 22 '19 16:05 mattam82

Discussion with @mattam82 , it seems like the plan is to finish implementing this (and possibly something else).

gmalecha avatar Jul 31 '19 19:07 gmalecha