How to install Coq - coq

I have been installing Coq using the download links from the https://coq.inria.fr/ for both Windows and Mac. However, when I try coqc or coqtop on terminal or command prompt I get error messages saying that the command is not found. Although with that being said, I can still run Coq almost perfectly fine on the Coq IDE but when I compile buffer, in particularly the exercises from Software Foundations, i get the following message.
Running: coqc -I '/Users/zhangsheng/Desktop/G/repos/Coqy/cis500' '/Users/zhangsheng/Desktop/G/repos/Coqy/cis500/Basics.v' 2>&1
From what I understand, 2>&1 seems to be some form of misdirection and I feel that is the reason why coqc and coqtop don't seem to work on my terminal/command prompt.
Could someone kindly suggest the 'best' way to install Coq on either Mac or Windows or both such that I don't get the problems I mentioned above?

Although I am not a Windows or OSX user, I imagine that you're having this problem because the Coq installer does not update the system's PATH variable. This variable is a list of directories used by the terminal to look up the programs corresponding to commands you type. If you don't want to install Coq via a different method, you should probably find where the coqc and coqtop binaries are installed, and add these directories to your PATH. Here are a few references on how to do this: OSX, Windows.

Related

cant open GHCi with ghci command in command prompt

I am about to learn Haskell, (maybe, if I can get the program to work) I am working along with the book,"Learn you a Haskell for great good". I did some DOS in 80's a few weeks of COBAL in the 90's, so absolute noob.
I have loaded chocolatey into powershell in windows 10 as an administrator, that worked, entered choco install haskell-dev haskell-stack. That worked. ran refreshenv, that worked. then rebooted computer, went to command prompt and entered ghci [return] and is says no file found. then tried installing -dev and -stack with --force command, and that worked in case didnt take the first time. went to command prompt ghci nothing. reboot, command prompt then ghci [return] cant find file. ugh. any ideas?
My Haskell notes say a fresh installation goes like this:
Install chocolatey as administrator. There should be no errors returned. Run 'choco' to ensure that the installation worked.
Install stack
choco install haskell-dev
refreshenv
On Windows, the new compiler is stored here: C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.10.1\bin.
If it does not work as the default compiler, it could be masked by an earlier entry in the path list.
When you run which, PowerShell get-command what does it return? What is your path set to?
If no joy, you could search for an online Haskell REPL. Try this one:
https://replit.com/languages/haskell. You can enter code on the left hand side, and run it, or start the REPL with ghci on the right hand side. It's a bit clunky by comparison to a full IDE, but perhaps enough to get started with.

How to get started with OCaml on VSC?

I started learning OCaml several days ago. I installed everything and tested a small program on Atom which worked ok.
But I don't really understand how to work on VSC. I created a file 'test.ml',but how can I run it ?
Thanks in advance
Assuming VSC is Visual Studio Code (and you're on a Unix-like system):
If you want editing support such as auto-completions, you need to install OCaml Platform extension for VS Code by following installation steps outlined here. Note that the instructions indicate that you need to also have ocaml-lsp-server installed.
If you need to run test.ml as a program, you should do in the VS Code terminal:
$ ocamlc -o test test.ml # compile 'test.ml' into an executable 'test'
$ ./test # to run the program
Note that VS Code doesn't have a ready button to run an OCaml file as an executable (not yet at least).
Newcomers to OCaml are recommended to explore language either with ocaml or utop REPL.
How to get utop: Assuming you have opam installed, you should opam install utop. Aforementioned opam is a package manager for OCaml, that can also help you manage OCaml versions and is indispensable if you want to get serious about OCaml development.
Then you'll be able to launch utop in terminal, and inside utop, you can execute test.ml with
#use "test.ml"
assuming that utop was launched from the folder containing test.ml.
You should be able to do the same with ocaml REPL that is installed along with OCaml compiler, but it's much less convenient.

Coq IDE icon missing from favorites

I installed Coq and Coq IDE from here. Everything went smooth.
I launched the Coq IDE from terminal, then I right clicked it to add it to my favorites and that was not possible. When I looked for its icon in my programs it wasn't there. I'm on Ubuntu 18.04, can it be done?
You can create your own coqide.desktop in ~/.local/share/applications by imitating the ones present in /usr/share/applications.
The difficulty is that the opam installation may include multiple switches, each with one version of Coq. Thus it is not clear what binary must be pointed to by the shortlink you want to create.
I see two solutions:
choosing the version of Coq present in the current global opam switch. That's what I used for a few months a year ago. If the current opam switch does not contain a Coq binary, launching CoqIDE from the shortlink silently fails. I think I used a command similar to zsh -ic coqide (because zsh is my main shell, you may adapt this command to your own shell). I call zsh so that it loads the opam environment and can find the right coqide. The -i may not be necessary, but I remembered that without it, zsh was not loading the opam environment in my case.
choosing the version of Coq present in a given switch. You just have to adapt the previous point so that the right switch is selected before calling coqide. This gives
zsh -ic "eval $(opam env --switch myswitch) coqide"
I am not sure that running an executable by calling the shell is a good practice (I would say it is not), but at least it works and I do not see how to load the opam environment without such a hack.

Vim plugin does not recognize existing Perl support

I've been using the CoqIDE plugin for Vim on Linux machines for editing Coq files. Now I'm trying to install it on Windows 8. But when I try to source the plugin, I get
Your vim doesn't support Perl. Install it before using CoqIDE mode.
which is strange, because with :version I clearly see +perl/dyn included. Is this different from the +perl that I need?
I heard somewhere that you need to have Perl installed before Vim to get a Perl-enabled Vim, so I tried that as well. I uninstalled Vim, installed Strawberry Perl 5.18.2.2 (64bit), and reinstalled Vim. Still the same problem.
If the solution involves manually compiling binaries, I would really appreciate detailed instructions as I don't have any experience with it.
+perl/dyn just specifies that Vim has been compiled with dynamic Perl support; it doesn't yet check that the Perl library can be loaded successfully. To do that, try executing a Perl command, e.g.:
:perl VIM::Msg("Hello")
This probably yields on your system:
E370: Could not load library perl510.dll
Sorry, this command is disabled: the Perl library could not be loaded.
Next, you'd then have to investigate whether a proper Perl version has been installed and the DLL is accessible (though the PATH).
Download DWIMPerl for windows. I'm running win7 64 and gvim 7.4.2. Using strawberryperl and activeperl resulted in :echo has('perl') to yield 0. By switching to DWIMPerl (and ensuring my PATH env variables are proper) :echo has('perl') now yields 1 using the standard gvim distribution. This is important for vim extensions like dbext which require proper support for perl interfaces.

How do I get eshell working correctly in emacs?

For some reason, when I type in commands I'm used to on linux, it works perfectly, as it does in bash... But in eshell, it doesn't work.
I've narrowed the problem to a trivial and small sample, as follows:
$ du
c:/Program: command not found
$ which bash
c:/Program Files (x86)/Git/bin/bash.exe
How do I get this working? (du is whatever it is by default... It's implemented in elisp, I haven't made any unusual changes there, that is, it's a compiled lisp function in `em-unix.el')
I would've expected something along the lines of "You have used 1.3 GiB of disk space", rather than that command not found error.
It doesn't use bash.exe, but it can use du.exe, when present.
On my system:
c: gutov $ which bash.exe
which: no bash.exe in ...
c: gutov $ which du.exe
h:/Apps/System/gnuwin32/bin/du.exe
From your error message I can tell that it calls some command and fails because it doesn't properly quote the path to executable (which contains spaces). Maybe you should do M-x report-emacs-bug.
Overall, I recommend:
1) Uninstall Git and reinstall it selecting the second option when asked about your PATH environment ("Run Git from the Windows Command Prompt"). This will remove the unix tools packaged with it from PATH.
2) Install in some directory without spaces and add to PATH unix tools from GnuWin32 project, or from Eli Zaretski's ports. The latter contains fewer packages overall, but it has a much faster find, for example. You can mix them.
Alternatively, maybe you can get away with just reinstalling Git into directory without spaces.