Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low-level Ltac2 binder API is not low-level enough #12601

Closed
JasonGross opened this issue Jun 27, 2020 · 1 comment · Fixed by #16520
Closed

Low-level Ltac2 binder API is not low-level enough #12601

JasonGross opened this issue Jun 27, 2020 · 1 comment · Fixed by #16520
Labels
part: ltac2 Issues and PRs related to the (in development) Ltac2 tactic langauge.
Projects
Milestone

Comments

@JasonGross
Copy link
Member

Description of the problem

The whole point of having Constr.Unsafe (in particular Constr.Unsafe.make) is so that I can build terms without incurring typechecking costs and without having to incur the cost of manipulating the goal evar and pushing things into the context. However, the current binder API makes this effectively impossible because the Constr.Binder.make calls Retyping.relevance_of_type which requires that the term be sufficiently well-typed in the current context.

Require Import Ltac2.Ltac2.
Require Import Ltac2.Notations.
Require Import Ltac2.Constr.
Require Import Ltac2.Array.

Ltac2 b () := (Binder.make None (Unsafe.make (Unsafe.Rel 5))).

Goal True.
  let v := b () in ().
  (* Error: Anomaly "Uncaught exception Not_found."
Please report at http://coq.inria.fr/bugs/.
*)

cc @jfehrle @ppedrot

I'm trying to benchmark some code for generating linear-sized proof terms in linear time for rewriting, and this makes it impossible to generate the proof terms I want. (Looking at the code for Retyping.relevance_of_type, it looks like I might be able to get around this by inserting extra cast nodes, but this is still quite unfortunate.)

Coq Version

master / 8.12

@JasonGross JasonGross added part: ltac2 Issues and PRs related to the (in development) Ltac2 tactic langauge. kind: ltac2 labels Jun 27, 2020
@jfehrle
Copy link
Member

jfehrle commented Jun 29, 2020

BTW, kind: ltac2 is not needed. Seems like that label was created by mistake.

@jfehrle jfehrle added this to Parking lot in Ltac2 Jun 29, 2020
JasonGross added a commit to JasonGross/doctoral-thesis that referenced this issue Oct 30, 2020
Ltac2 automation moved this from Parking lot to Done Oct 17, 2022
@coqbot-app coqbot-app bot added this to the 8.17+rc1 milestone Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: ltac2 Issues and PRs related to the (in development) Ltac2 tactic langauge.
Projects
Ltac2
  
Done
3 participants