Cannot find a physical path bound to logical path matching suffix <> and prefix Coquelicot - coq

I've recently installed Coq version 8.12.2 with opam. I have installed all the packages of Coq using the following command :
opam repo add coq-released https://coq.inria.fr/opam/released
But when I try to compile packages in Coqide, it doesn't recognize coquelicot.
From Coq Require Import Lia Reals Lra List.
From Coquelicot Require Import Coquelicot.
From Coq Require Import PropExtensionality FunctionalExtensionality.
Require Import Rbar_compl.
Require Import sum_Rbar_nonneg.
Require Import measurable_fun.
Require Import subset_compl.
Require Import R_compl.
Require Import sigma_algebra_R_Rbar.
Require Import sigma_algebra.
Require Import simple_fun.
Require Import LInt_p.
I receive these errors :
Cannot find a physical path bound to logical path matching suffix <> and prefix Coquelicot
And
Unable to locate library
Rbar_compl. (While searching for a .vos file.)

Here is a session under Linux (Fedora) that makes it all work, assuming that you already did all the work to have opam installed on your machine.
First in your linux machine, I advise that you create a new empty directory and change to this directory. Then you perform the following commands. The name MILC can be changed to your liking, this name is part of the link that #Lolo found.
opam install coq-coquelicot
opam install coqide
eval $(opam env)
wget https://lipn.univ-paris13.fr/MILC/CoqLIntp/LInt_p.tgz
tar xfz LInt_p.tgz
echo -R . MILC > _CoqProject
echo -R . MILC > Make
ls *.v >> Make
coq_makefile -f Make -o Makefile.coq
make -f Makefile.coq
coqide -R . MILC
In the coqide window, you can load all the files by typing the following command.
From Coq Require Import Lia Reals Lra List.
From Coquelicot Require Import Coquelicot.
From Coq Require Import PropExtensionality FunctionalExtensionality.
From MILC Require Import Rbar_compl sum_Rbar_nonneg measurable_fun.
From MILC Require Import subset_compl R_compl sigma_algebra_R_Rbar.
From MILC Require Import sigma_algebra simple_fun LInt_p.
Then you can see one of the theorems inside this development by typing
Check LInt_p_Dirac.

Did you do a
opam install coq-coquelicot
?
If so
opam list coq-coquelicot
should tell you which version you have.
This should be sufficient to compile the first line.
For the second line where the file Rbar_compl.v comes from? I don't think it is a coquelicot file.

seems the files you need are here.
You first need to compile then before being able to execute the file. Don't hesitate to ask for help if you don't know how to compile them.

This line should work:
From Coquelicot Require Import Coquelicot.
But these lines are suspect.
Require Import Rbar_compl.
Require Import sum_Rbar_nonneg.
Are you sure there is a library with that name? It looks more like the names of theorems inside a library. They don't seem to be defined in Coquelicot, though...
From where did you learn that you should write those lines?

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.

Idris not properly installing/finding packages

I'm currently trying to use Blodwen, the prototype of Idris 2, as a backend for a language I'm writing. So I'm trying to import its ttimp package for my project.
I go into the Blodwen directory and do idris --install ttimp.ipkg
Then in my project's .ipkg I have:
opts = "--cg-opt -O2 -i ~/GitHub/Blodwen/"
pkgs = ttimp
However, when I run idris --build myproject.ipkg I get the error
Entering directory `./src'
The following packages were specified but cannot be found:
- ttimp
If I remove ttimp from pkgs, then I get Can't find import Core/Binary
i.e. it can't find the modules from the package.
If I try to build ttimp with TARGET=~/.idris-libs
idris --install ttimp.ipkg
Entering directory `./src'
Can't find import Builtins
Can't find import Prelude
Can't find import Data/List
My Question: How can I make sure ttimp is being installed properly? Where does Idris install packages by default? Why isn't Idris finding the library after I've installed it?
I am not sure what your current goal is, but when you install blodwen it is using idris to a) install ttimp and to compile blodwen, which is available as the executable blodwen afterwards. So if you want to work with blodwen, you should also use blodwen to compile your files and install additional libraries.

where is Coq aac_tactics installed?

I was testing the AAC tactics library for rewrites modulo associativity and commutativity. According to a Coq website, one should:
Depending on your installation, either modify the following two lines,
or add them to your .coqrc files, replacing "." with the path to the
aac_tactics library.
Add Rec LoadPath "." as AAC_tactics.
Add ML Path ".".
Require Import AAC.
Require Instances.
But I don't know how to find the path to the aac_tactics library, and using "." didn't work.
I installed Coq under Ubuntu 16.04 LTS along the lines of:
opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq-mathcomp-ssreflect.1.6
opam install coq-aac-tactics.8.5.1
Does anyone know where to find the library location?
It seems this will work (at least for this tutorial):
(*
Add Rec LoadPath "." as AAC_tactics.
Add ML Path ".".
*)
Require Import AAC_tactics.AAC.
Require Import AAC_tactics.Instances.
Usually, OPAM stores its stuff in ~/.opam. You can look it up with the following command in your terminal:
$ opam config var root
Then you can have multiple configurations called switches (it's mainly for keeping different version of the OCaml compiler). The root for your current switch can be found this way:
$ opam config var prefix
And the libraries for the current switch are kept in the directory which you can look up here:
$ opam config var lib
There you'll find the AAC_tactics subdirectory, which is the prefix we needed to add to our imports above.

Coq: manage LoadPath in project with subdirectories

I have a Coq project with its libraries organised into subdirectories, something like:
…/MyProj/Auxiliary/Aux.v
…/MyProj/Main/Main.v (imports Auxiliary/Aux.v)
When I compile the files, I expect to do so from working directory MyProj (via a makefile). But I also want to work on the files using Proof General/Coqtop, in which case the working directory is by default the directory in which the file lives.
But this means that the LoadPath is different between the two contexts, and so the logical path needed for the library import is different. How do I set up the coqc invocation, the LoadPath, and the import declarations so that they work in both contexts?
Each approach I have tried, something goes wrong. For instance, if I compile Aux.v by invoking
coqc -R "." "MyProj" Auxiliary/Aux.v
and import it in Main.v as
Require Import MyProj.Auxiliary.Aux.
then this works when I compile Main.v with
coqc -R "." "MyProj" Main/Main.v
but fails in Coqtop, with Error: Cannot find library MyProj.Auxiliary.Aux in loadpath. On the other hand, if before the Require Import I add
Add LoadPath ".." as MyProj.
then this works in Coqtop, but fails under coqc -R "." "MyProj" Main/Main.v, with
Error: The file […]/MyProj/Auxiliary/Aux.vo contains library
MyProj.Auxiliary.Aux and not library MyProj.MyProj.Auxiliary.Aux
I’m looking for a solution that’s robust for a library that’s shared with collaborators (and hopefully eventually with users), so in particular it can’t use absolute file paths. The best I have found for now is to add emacs local variables to set the LoadPath up when Proof General invokes Coqtop:
((coq-mode . ((coq-prog-args . ("-R" ".." "MyProj" "-emacs")))))
but this (a) seems a little hacky, and (b) only works for Proof General, not in Coqide or plain Coqtop. Is there a better solution?
Allow me to side-step your question by suggesting an alternative process, hinted at by Tiago.
Assuming that your project's tree looks like this:
MyProj/Auxiliary/Aux.v
MyProj/Main/Main.v
In MyProj, write a _CoqProject file listing all your Coq files
-R . ProjectName
Auxiliary/Aux.v
Main/Main.v
When you open one of these Coq files, emacs will look for the _CoqProject and do-the-right-thing (tm).
As shown by Tiago, coq_makefile will also give you a Makefile for free.
I know you explicitly asked for something that works across different platforms, but there's already a Proof-General-specific solution that is less hacky than the one you have. Proof General has a special variable called coq-load-path that you can set with local variables, much like you did for coq-prog-args. The advantage is that you don't have to worry about any other arguments that need to be passed to coqtop (such as -emacs in your example). Thus, your .dir-locals.el file could have a line like this:
((coq-mode . ((coq-load-path . ((".." "MyProj"))))))
Unfortunately, I am not aware of anything that works across platforms, although I'm pretty sure that something specific for CoqIDE must exist. If this is the case, maybe you could set up a script to keep these configuration files updated across different platforms?
If you use coq_makefile you can install the library in your system.
Without OPAM
To initialize your project:
coq_makefile -f _CoqProject -o Makefile
Share your library with other projects:
make install
With OPAM
Assuming you have OPAM installed, you can use coq-shell to help you take care of dependencies.
To setup your project:
coq_shell_url="https://raw.githubusercontent.com/gares/opam-coq-shell/master/src/opam-coq"
curl -s "${coq_shell_url}" | bash /dev/stdin init 8.4 # Install Coq and its dependencies
eval `opam config env --switch=coq-shell-8.4` # Setup the environment
coq_makefile -f _CoqProject -o Makefile # Generates the makefile
opam pin add coq:YOURLIBRARY . # Add your library to OPAM
When you update your library you should do:
opam upgrade coq:YOURLIBRARY
Here is an example of a project that uses the OPAM method:
https://bitbucket.org/cogumbreiro/aniceto-coq/src

coq Hello World example (with opam) can't find libraries

I was following a coq HelloWorld tutorial (code below), and couldn't get the program to compile. I followed the installation steps and installed opam install coq:io:system. My opam installation is at the default location ~/.opam. But still, I got an error about
Toplevel input, characters 53-67:
Error: The reference System.effects was not found in the current environment.
This is with either emacs/proofgeneral or coqide (8.4pl6, ubuntu 14.04). Does any one know how to fix the issue?
Here's the code which I copied into a file called hello_world.v and loaded into emacs/coqide:
Require Import Coq.Lists.List.
Require Import Io.All.
Require Import Io.System.All.
Require Import ListString.All.
Import ListNotations.
Import C.Notations.
(** The classic Hello World program. *)
Definition hello_world (argv : list LString.t) : C.t System.effects unit :=
System.log (LString.s "Hello world!").
-- Update ---
#gtzinos, I followed the readme in https://github.com/clarus/coq-hello-world. This time there was no complaint about System.effects, but there was a new error about Extraction.launch not found. I tried:
git clone https://github.com/clarus/coq-hello-world.git
cd coq-hello-world
./configure.sh && make
and got:
"coqc" -q -R src HelloWorld src/Main
File "/.../coq-hello-world/src/Main.v", line 32, characters 19-36:
Error: The reference Extraction.launch was not found in the current
environment.
I tried also to make in the extraction folder, but without success. Any pointers?
New versions of the coq:io and coq:io:system libraries were just released. Run:
opam update
opam upgrade
to make sure you have coq:io:system in version at least 2.3.0. Now Extraction.launch should be available. System.effects has been replaced by System.effect.