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

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.

Related

Why can't I add a package (module) I created in Julia?

I am having trouble installing a module I created in Julia. I am running the Julia plugin under Visual Studio Code. If I run the file below with Ctrl+F5 I get a message
ERROR: LoadError: ArgumentError: Package Utils not found in current path:
- Run `import Pkg; Pkg.add("Utils")` to install the Utils package.
This is the file:
module demo
using Utils
greet() = print("Hello World!")
end # module
If I follow the advice on the error message I get another error message:
ERROR: LoadError: The following package names could not be resolved:
* Utils (not found in project, manifest or registry)
I also tried inserting this line:
import Pkg; Pkg.add(path="C:/Dropbox/Code/Julia/demo/src/Utils.jl")
and got this message (although the path definitely exists):
ERROR: LoadError: Path `C:/Dropbox/Code/Julia/demo/src/Utils.jl` does not exist.
The files demo.jl and Utils.jl are in C:\Dropbox\Code\Julia\demo\src\ and the demo project has been activated as can be seen in the REPL. The OS is Windows 10 Pro.
Any help will be greatly appreciated. Lots of time wasted trying to make this work.
Module and packages are not the same things. In short, packages are modules plus a set of metadata that make it easy for the package to be found and interact well with other packages. See here for a tutorial to write Julia packages:
https://syl1.gitbook.io/julia-language-a-concise-tutorial/language-core/11-developing-julia-packages
In your case, if you want to load a local module, just type include("fileWhereThereIsTheModule.jl") followed by a using Main.MyModule or using .MyModule. Note the dot... without it, Julia would indeed look for a package and to let it find your Demo or Util module you would have to either change an environmental variable or place your module file in certain predefined folders. Using include followed by the "absolute or relative position" of the module you don't have to do either.

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

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?

’unresolved import’ message for streamlit in Eclipse PyDev

I have successfully installed the streamlit package using the following
shell command and can run the resulting local server localhost:8501
Python3.8 -m pip install streamlit
In Eclipse, the module appears under the Package Library in the Python Interpreter.
I can import it as a library item in a PyDev module as as follows:
import streamlit
The only note I get from the compiler is that streamlit is an ‘unused import’. However, when I append the command as follows the compiler then says ‘unresloved import st’
import streamlit as st
Both ‘import streamlit’. and ‘import streamlit as st’ will not code complete.
How can I clear the ’unresolved import’ message ?
The sys.path is as follows:
/Users/davidklemitz/eclipse-workspace/streamlit
/Users/davidklemitz/eclipse-workspace/streamlit
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
/Library/Frameworks/Python.framework/Versions/3.8/lib/python38.zip
Thanks in advance for any help.
I solved the problem. Turns out it was a compound of two issues.
First the name of the PyDev module I chose was the same name as the package module name streamlit.py, installed using the following command
Python3.8 -m pip install streamlit
Second, I had a look at the PYTHONPATH under Eclipse->Preferences-> PyDev->Interpreters-> Python Interpreter where these paths were arranged as follows:
/Library/Frameworks/Python.framework/Versions/3.8/lib
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
As streamit.py was in the second and not the first, I reversed the order, restarted Eclipse, created a new PyDev project and associated development model named stream_lit.py and the code completed as expected.

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.

Need help on start using purescript on NixOS

I am trying to setup hello world project with purescript on NixOs and have couple questions,
Official purescript website recommend installation via npm but there is no nixos.nodePackages.purescript, instead there are at least 2 variants I found in nixpkgs
nixos.purescript
nixos.haskellPackages.purescript
What are the different?
Official site recommend pulp and bower via npm but only nodePackages.bower is avaliable and there is undocumented psc-package.
What should be the nix way to handle purescript packages?
The sample code on official site (see hello.purs bellow) doesn't even compile,
with these error.
$ purs compile hello.purs
Error found:
at hello.purs line 1, column 1 - line 1, column 1
Unable to parse module:
unexpected "import"
expecting "module"
I add module Hello to code but still failed.
$ purs compile hello.purs
Error 1 of 2:
in module Hello
at hello.purs line 2, column 1 - line 2, column 15
Module Prelude was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
Error 2 of 2:
in module Hello
at hello.purs line 3, column 1 - line 3, column 39
Module Control.Monad.Eff.Console was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
How the correct workflow should be?
The goal is to have minimal example project with a single hello.purs
running in web browser.
This is hello.purs
module Hello where
import Prelude
import Control.Monad.Eff.Console (log)
greet :: String -> String
greet name = "Hello, " <> name <> "!"
main = log (greet "World")
It would be really helpful if you can also provide shell.nix for nix-shell or default.nix for nix-build.
Found this 2 years old guild, I am trying it but I still not have answer to all of my questions.
nixos.purescript is just the static executables for nixos.haskellPackages.purescript; this skips building/installing PureScript as a Haskell library
You can install Pulp via npm install pulp - the binary will be installed to node_modules/.bin/pulp
The sample code doesn't compile because you haven't downloaded the dependencies via Bower. You can install them via bower install purescript-prelude purescript-console.
But node_modules/.bin/pulp init will give you a Bower file and you can run bower install to give you a basic project. You can then do node_modules/.bin/pulp run to execute it using node.js, but you'll probably want pulp browserify --to example.js to get a file you can put in a <script> tag in HTML.