Comments (4)
The problem is typically
aac-tactics/src/aac_rewrite.ml
Lines 110 to 112 in d3f4d88
(mk_letin does the retype)
We have Theory.Stubs.eval
which is
AAC.Internal.eval :
forall {X : Type@{AAC_tactics.AAC.58}} {R : relation X} [e_sym : idx -> Sym.pack]
[e_bin : idx -> Bin.pack], (idx -> unit_pack e_bin) -> T e_sym -> X
and x
some type (ie x : Type@{u}
for some u
), so for mkApp (eval, [|x; ...|])
to be valid we need u <= AAC.58
.
Generally every time we have a mkApp
we have preconditions such that is is well-typed, but only up to some universe constraints. To remove the tclRETYPE calls we need to explicitly produce the universe constraints.
So in the above example we would do something like
let eval = Coq.get_efresh Theory.Stubs.eval in
let (_, ety, _) = destProd sigma eval in
let euniv = destSort sigma ety in
let xuniv = Retyping.get_sort_of env sigma x in
let sigma = Evd.set_leq_sort env sigma xuniv euniv in
let eval = mkApp (eval, [|x; ...|]) in
Proofview.Unsafe.tclEVARS sigma >>= fun () ->
mk_letin ... (* if done for everything mk_letin can stop doing tclRETYPE *)
An intermediate solution is to replace let c = mkApp (hd, args) in tclRETYPE c >>= fun () -> ...
with let sigma, c = Typing.checked_appvect env sigma hd args in tclEVARS sigma >>= fun () -> ...
. checked_appvect
assumes that the subterms are well typed and only checks the application.
In the above example we would do
let sigma, eval = Typing.checked_appvect env sigma (Coq.get_efresh Theory.Stubs.eval) [|x; ...|] in
Proofview.Unsafe.tclEVARS sigma >>= fun () ->
mk_letin ... (* if done for everything mk_letin can stop doing tclRETYPE *)
or since only the first argument has universe constraint implications
let sigma, eval = Typing.checked_appvect env sigma (Coq.get_efresh Theory.Stubs.eval) [|x|] in
let eval = mkApp (eval, [|...|]) in
Proofview.Unsafe.tclEVARS sigma >>= fun () ->
mk_letin ... (* if done for everything mk_letin can stop doing tclRETYPE *)
In all cases we need to enter
or more likely enter_one
to get an env
(or factorize checked_appvect into a tactic which does enter_one).
from aac-tactics.
@fakusb : I started to clean up the code - also to fix the remaining exponential blow up (the tactic run time grows about 3^n, where n is term length in simple cases). I just want to avoid double work. If you are also working on improving aac-tactics, we should join forces.
from aac-tactics.
Sorry, I just saw now that this is 5 years old - but the code is still there and I also stumbled across it.
from aac-tactics.
@SkySkimmer : thanks for sharing your insights on this - very useful!
from aac-tactics.
Related Issues (20)
- Please pick the version you prefer for Coq 8.15 in Coq Platform 2022.02 HOT 5
- Please pick the version you prefer for Coq 8.16 in Coq Platform 2022.09
- Transfer general Instances.v lemma to Stdlib HOT 3
- Please pick the version you prefer for Coq 8.17 in Coq Platform 2023.03
- Please pick the version you prefer for Coq 8.18 in Coq Platform 2023.10
- aac_reflexivity leads to QED blow up in trivial case (just one unit removed) HOT 7
- aac tactics don't handle goal selectors properly HOT 3
- Please pick the version you prefer for Coq 8.19 in Coq Platform 2024.01
- aac_congruence HOT 20
- [warnings] Please fix OCaml warnings
- Deprecated functions to interface with Coq-side of the plugin
- Deprecation of Pervasives in OCaml 4.08 and later HOT 1
- num is a dependency for Nix CI HOT 16
- Tag for Coq 8.12.0 HOT 4
- Please create a tag for the upcoming release of Coq 8.13 HOT 2
- Build fails with Nix on Coq 8.11 HOT 5
- Quantifying over Type HOT 1
- Please create a tag for the upcoming release of Coq 8.14 HOT 6
- Support for idempotent operations HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aac-tactics.