coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Cedric Auger <sedrikov AT gmail.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Speeding up inversion on large inductives
- Date: Tue, 8 Sep 2015 09:43:11 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=sedrikov AT gmail.com; spf=Pass smtp.mailfrom=sedrikov AT gmail.com; spf=None smtp.helo=postmaster AT mail-io0-f179.google.com
- Ironport-phdr: 9a23:hOE21RcmBo2Y88rsCnZAB4OglGMj4u6mDksu8pMizoh2WeGdxc6/Yh7h7PlgxGXEQZ/co6odzbGG7+a5ACdZvN6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDuvcSKKFwVzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePFyRrtBST8iLmod5cvxtBCFQxHFri8XVXxTmR5VCSDE6gv7V9H/qH2pmPB63XyxMMHsTLt8cCmt4r0jHATlhD0GNDkn2G7Sg810yqlcpUTy9FRE34fIbdTNZ7JFdaTHcIZCSA==
Hello everyone,
I'm working on a development where there's an inductive type with 400+
constructors. Recently, it has become necessary to invert on it
regularly, and this takes an exceedingly long time.
I am curious of what would lead to such a big inductive type.
The only big inductive type I tried to make once was for the ASCII type, I believe (thus not using the one in the stdlib).
Can't you regroup many of your constructors in a more structured way?
I mean something like:
Inductive type1 :=
| T1C1 : type1
| T1C2 : type1.
Inductive type2 := …
Inductive type3 := …
Inductive my_big_type :=
| Type1 : type1 -> my_big_type
| Type2 : type2 -> my_big_type
| Type3 : type3 -> my_big_type.
What I've done to speed it up is to 'precompile' the inversion
principles using Derive Inversion for each of the constructors and
then build a custom tactic that uses these principles; this does speed
up the proofs immensely. The compilation process for the files that
hold the Derive Inversions is still horribly slow, but that is
expected and tolerable. The problem I'm having is that when I do a
Require Import or Export of these files in Proof General & Emacs, this
takes a very long time as well. This is also the case for compilation
of such files with coqc, even with the -dont-load-proofs directive in
place.
My current solution is to take all the generated induction principles,
print them into a separate file and declare them as axioms there. That
gives me the desired speedup, but is essentially a hack.
My questions are:
- Is there another way to speed up inversion?
Is the situation is the same as what it was some years ago, it might be the case (inversion produced needlessly big terms, and you end up with equalities in your context). There were more clever ways to do it, but were not automatized. The situation might have changed now. (still, for backward compatibility, a new name for such a tactic might have been taken).
- Is there a way to load the compiled libraries quicker?
You can try to optimize your proofs, so that proof terms are smaller (but this has to be done manually, as there is no proof optimizer I know of in Coq).
You can do a variation of your hack:
declare a Record (or a Module, you have to decide which one is faster/more convenient) containing all your "axioms" and make your definitions depending on it.
In a separate file, you instantiate them with your Derive Inversion, so that you "prove" your axioms, and feed your main proofs with it.
This would look like:
(* File 1 *)
Module Type Inversions.
Parameter axiom1 : …
Parameter axiom2 : …
…
End Inversions.
(* File 2 *)
Require Import File1.
Module PartialProofs (INV : Inversions).
… (* use INV.axiom1, INV.axiom2, … *)
End PartialProofs.
(* File 3 *)
Require Import File1.
Module Derivations : Inversions.
Derive Inversion …
Definition axiom1 := …
…
End Derivations.
Module Proofs := PartialProofs(Derivations).
Thanks, cheers,
Petar
- [Coq-Club] Speeding up inversion on large inductives, Petar Maksimovic, 09/07/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Cedric Auger, 09/08/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Xavier Leroy, 09/09/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Petar Maksimovic, 09/09/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Jean-Francois Monin, 09/09/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Petar Maksimovic, 09/09/2015
- RE: [Coq-Club] Speeding up inversion on large inductives, Soegtrop, Michael, 09/10/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Pierre Courtieu, 09/10/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Petar Maksimovic, 09/10/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Enrico Tassi, 09/10/2015
- RE: [Coq-Club] Speeding up inversion on large inductives, Soegtrop, Michael, 09/10/2015
- RE: [Coq-Club] Speeding up inversion on large inductives, Soegtrop, Michael, 09/10/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Petar Maksimovic, 09/09/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Jean-Francois Monin, 09/09/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Petar Maksimovic, 09/09/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Robbert Krebbers, 09/09/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Xavier Leroy, 09/09/2015
- Re: [Coq-Club] Speeding up inversion on large inductives, Cedric Auger, 09/08/2015
Archive powered by MHonArc 2.6.18.