Coq make failing on Omega - coq

I'm trying to follow this but the provided source files are failing make with this error
make[1]: Entering directory '/home/myhome/Dropbox/org/coq/cpdt'
COQC src/CpdtTactics.v
File "./src/CpdtTactics.v", line 10, characters 0-32:
Error: Cannot find a physical path bound to logical path Omega.
in CpdtTactics.v there is
...
Require Import Eqdep List Omega.
...
Where is this Omega? One reference mentioned it being deprecated. Another might have mentioned ZArith as a substitute. Also, just calling up InductiveTypes.v of the cpdt/src files and trying to evaluate line-by-line, I get
Error: Cannot find a physical path bound to logical path Cpdt.CpdtTactics.
I've got this in my custom-set-variables
'(coq-prog-args
'("-emacs -R /home/myhome/Dropbox/org/coq/cpdt/src Cpdt"))
But I'm guessing this is not necessarily my mistake, rather, coq is looking for CpdtTactics.vo and it's not there because make didn't complete? (In fact, it's not there.)
I'm on coq 8.15 and am using Emacs 28.1/Proof General Version 4.5-git.
BTW, on https://x80.org/collacoq/ Require Import Omega. seems to succeed.

The Omega module and the omega tactic have been removed in Coq version 8.14 (after being deprecated in version 8.12).
It seems that the latest CPDT tarball was not updated yet to be compatible with Coq 8.14, so this means that you should compile it with a lower version of Coq, such as version 8.13.
You can install earlier versions of Coq by relying on the Coq Platform.
If you use the Coq Platform scripts, you can rely on the latest version of the Coq Platform since it provides the option to select an earlier version of Coq. If you'd rather use the binary installers, then you can find installers for Coq 8.13 in a previous release of the Platform.
The reason why Require Import Omega works on https://x80.org/collacoq is that this website has not been kept up-to-date and is still at Coq version 8.11. If you use https://coq.vercel.app/scratchpad.html instead, you get the latest version of Coq (and thus Require Import Omega does not work).

Related

Importing HoTT library in Coq

I'm trying to use coq-hott library in Coq, but the import won't work. I'm working in the container of the coqorg/coq:latest docker image. After starting the container I've done the following:
opam install coq-hott in the container's terminal.
Hooked up vscode to the container and installed the VsCoq extension there.
Set the paths to _CoqProject and coqtop.
Created the _CoqProject file with the following lines:
-arg -noinit
-arg -indices-matter
Checked the HoTT library location: /home/coq/.opam/4.05.0/lib/coq/user-contrib/HoTT
After creating the *.v file to test the library I got the following problems:
Require Import HoTT. gives
Cannot find a physical path bound to logical path HoTT.
From HoTT Require Import Basics. works, but doing Check (2+2). after that gives
The term "2" has type "trunc_index" while it is expected to have type "Type".
From HoTT Require Import Algebra. works but From HoTT Require Import Analysis. gives
Cannot find a physical path bound to logical path Analysis with prefix HoTT.
I don't understand this behavior at all. It is similar to this question, but still different. Am I doing something wrong ?
According to opam the packages versions for coq and coq-hott are 8.15.1 [4.07.1+flambda 4.05.0] and 8.15 [4.05.0] respectively.

Coq file generated by WP does not compile

I have installed frama-c (18.0) and coqide (8.9) through opam (plus other needed dependencies of course, but that may not be the matter here). Well the point is I simply installed it through opam, not done anything else strange (and I didn't see any particular instruction that I should do otherwise).
Frama-c works as expected when I use Alt-ergo with WP, but if I try to use coq or coqide instead of Alt-ergo, then I get the following error for each goal that Qed does not manage to prove immediately:
[wp] 13 goals scheduled
[wp] [Coq] 'Qed.v' compilation failed.
------------------------------------------------------------
--- Coqc (stderr) :
------------------------------------------------------------
File "/tmp/wp7fe5dc.dir/coqwp/Qed.v", line 27, characters 8-17:
Error:
Cannot find a physical path bound to logical path matching suffix bool.
------------------------------------------------------------
[wp] [Coq] Goal typed_nondet_loop_inv_preserved : Failed
Compilation of 'Qed.v' failed.
As a note, before displaying the error, it manages to compile some other .v files. I have tried to open manually the files in coqide, and I get the same result. For the record, here are the lines coq complains about:
Require bool.Bool.
Require int.Int.
Require int.Abs.
Require int.ComputerDivision.
Require real.Real.
Require real.RealInfix.
Require real.FromInt.
I have also tried to downgrade coq a bit, but not lower than 8.7 (as otherwise opam complains of incompatible base installation package and I don't really want to screw up my installation), and got the same result.
If someone would have an idea of what is causing that and how I can get to set it up that correctly, that'd be nice. Even if for what I'm doing with it for now, Alt-ergo is sufficient, I would have liked to play a bit with coq to see how it can be used.
Regards,
--
Vincent Penelle.
First, indeed you need coq < 8.8 (e.g. 8.7.2) if you want to use it with Frama-C/WP, as newer versions are not supported for the moment.
Second, the order in which you have installed your packages is relevant. In particular, if the appropriate version of coq has been installed after frama-c, WP did not compile and install its coq libraries, which are the ones that are missing here. Thus, you may want to do opam reinstall frama-c to compile the package against a compatible coq version.

Basics.vo contains library Basics and not library Metalib.Basics

I am getting the error "Basics.vo contains library Basics
and not library Metalib.Basics" in CoqIDE 4.5. I am following Software Foundations and importing Basics as 'Require Export Basics.'. Also I compiled the Basics using the same CoqIDE. In the past I was using CoqIDE 4.2 and this worked fine in CoqIDE 4.2. Now I switched to CoqIDE 4.5, deleted previously compiled Basics.vo and compiled again.
Can someone please help me in that?
I have tried deleting the previously compiled Basics.v. Also tried restarting CoqIDE multiple times.
Print LoadPath.
Require Export Basics.
Theorem plus_n_O_firsttry : forall n:nat, n = n+0.
Proof.
intros n.
simpl.
Abort.

View all installed libraries and how they are to be imported in Coq

I've been wanting to use coq-vpl, and I have it installed. I can confirm this from opam list
ubuntu#ubuntu-xenial:~$ opam list
# Installed packages for system:
...
coq 8.6 Formal proof management system.
coq-vpl 0.2 Coq interface to VPL abstract domain of convex polyhedra.
coq-vpltactic 0.2 A Coq Tactic for Arithmetic (based on VPL).
coqide 8.6 IDE of the Coq formal proof management system.
...
However, how do I find out what the library is actually called and what I need to import? The vpl page does not have docs on it.
You can run
coqc -config
To get a list of configuration variables. On my system, this gives
LOCAL=0
COQLIB=/home/jgross/.local64/coq/coq-8.7.1/lib/coq/
DOCDIR=/home/jgross/.local64/coq/coq-8.7.1/share/doc/coq/
OCAMLFIND=/home/jgross/.opam/system/bin/ocamlfind
CAMLP4=camlp5
CAMLP4O=/home/jgross/.opam/system/bin/camlp5o
CAMLP4BIN=/home/jgross/.opam/4.02.2/bin/
CAMLP4LIB=/home/jgross/.opam/system/lib/camlp5
CAMLP4OPTIONS=-loc loc
CAMLFLAGS=-thread -rectypes -w +a-4-9-27-41-42-44-45-48-50 -bin-annot -safe-string
HASNATDYNLINK=true
COQ_SRC_SUBDIRS=config dev lib kernel library engine pretyping interp parsing proofs tactics toplevel printing intf grammar ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/fourier plugins/funind plugins/ltac plugins/micromega plugins/nsatz plugins/omega plugins/quote plugins/romega plugins/rtauto plugins/setoid_ring plugins/ssr plugins/ssrmatching plugins/syntax plugins/xml
If you look at the user-contrib directory of the path given by COQLIB, you should see folders with the various libraries you've installed. For any of these folder names, you can add From FolderName Require Import FileName to your Coq file.
According to https://github.com/VERIMAG-Polyhedra/VplTactic, you need to run coq, for instance by launching coqide (which you installed) and by typing the following lines in the left-hand-side window and executing them (using the downward green arrows on top of the window).
Require Import VplTactic.Tactic.
Add Field Qcfield: Qcft (decidable Qc_eq_bool_correct, constants [vpl_cte]).
And so on, please read the page at the link given above. I did not try it yet.

CoqIDE loadpath error for ssreflect

I am a Coq newbie and therefore to improve my understanding of proof checking I am trying to use the Ssreflect library.
I have installed Ssreflect v 1.5 on a Mac OS v 10.10.3 ( Yosemite ) which runs at the Terminal.
However when I tried to load the library into CoqIDE 8.4p15 using:
Require Import ssreflect.
I get the error:
Cannot find library ssreflect in loadpath
I have tried using:
Add LoadPath "/opt/local/lib/coq/user-contrib/Ssreflect/".
where SSRCOQ_LIB is currently set, but I get the error:
The file /opt/local/lib/coq/user-contrib/Ssreflect/ssreflect.vo contains library Ssreflect.ssreflect and not library ssreflect
Grateful for any help in loading the ssreflect library from within CoqIDE.
A big thanks to the people on the Coq-Club Forum who helped with this problem, and in particular Pierre Boutillier who pinpointed the cause of the problem and provided the solution.
The problem was that I had 2 copies of coqtop and 2 copies of standard libraries:
One in /opt/local/bin/coqtop ( which is the folder where my copy is installed yours maybe in a different folder ) and used to compile ssreflect ( I
used MacPorts to install coq ).
One in /Applications/CoqIDE_8.4pl5.app/Resources/bin/coqtop that is loaded by CoqIDE when double clicked on the app ( I downloaded it from the Cog web site ).
Therefore when I was in CoqIDE it was calling a different version of coqtop than the one that I used to compile and install the Ssreflect library.
The solution is the following :
Double click on CoqIDE
Open the preferences in the CoqIDE menu
Set Externals -> coqtop ( or it could be AUTO ) to "/opt/local/bin/coqtop" ( or wherever your version is installed ) Apply OK Close.
Quit and restart CoqIDE.
I successfully loaded the Ssreflect library both using coqtop in the Terminal and CoqIDE using:
Require Import ssreflect.