New to Coq: How to compile .vo files and run command line? - math

I'm new to working with Coq, and I'm progressing through the first volume of the Software Foundations book, but I can't for the life of me figure out how to compile the Basics.v file for the second chapter on induction.
I've seen things floating around about using the Coqc command on the command line, but I don't know how to access the terminal, or at least the windows terminal doesn't recognize the command. If anyone could walk me through this it'd be much appreciated!

In case you are using CoqIDE, there is a menu item "Compile/Compile buffer", which creates a .vo file for the currently loaded .v file. For a few files and early stages of learning, this might be the easiest way.
Then SF likely comes with a make file which you can just run with make. You didn't say what OS your are using - on Linux and Mac this should be trivial, on Windows it depends on how you did install Coq. The Windows installer doesn't come with make, but if you used the Coq Platform scripts to setup Coq on Windows, everything is there.
Otherwise it might get a bit complicated - you need to pass the right options to coqc (which CoqIDE and make do automatically for you).

Related

How to do image-based development in Common Lisp?

I am new to Common Lisp. This is how I develop programs in other languages, and also how I now develop programs in Common Lisp:
Open a text editor (e.g. vim or emacs) to create/edit a text file.
Write source code into the text file. (If unsure about the behavior of a snippet of code, and an REPL is available, then evaluate the snippet in the REPL, verify that the snippet evaluates as expected, and then go back to writing more code.)
Save the text file.
Ask the compiler/interpreter to load and run the source code in the text file. (e.g. sbcl --script myprog.lisp)
Go to step 1 if needed.
This is the conventional write-compile-run development cycle for most programming languages. However, in the lisp world, I hear things like "interactive development" and "image-based development", and I feel that I am missing out on an important feature of Common Lisp. How do I do "image-based development" instead of "write-compile-run development"?
Can someone provide a step-by-step example of "image-based development" similar to how I described "write-compile-run development" above?
(Note: I am using SBCL)
In typical Common Lisp implementations the runtime, the compiler, parts of the development environment and the program you are developing reside in the same program and share the same object space. The compiler is always available while you develop the program and the program can be incrementally developed. The development tools have access to all objects and can inspect their state. One can also undefine/remove, replace, enhance functionality from the running program.
Thus:
don't restart the program you are developing. Stay connected and update it. Even days, weeks, or months - if possible.
write code in such a way that the program can be replicated and built from scratch if necessary. Build it from time to time and fix any build problems.
once you use our program and there is an error -> fix the error within the program, while being able to inspect the full error state
creating a running program is either loading all code into a plain Lisp all the time or saving an executable image with the loaded code/data
Fixes to program bugs can also shipped to the user as compiled Lisp files, which gets loaded into the delivered program and update the code then.
Let's say that you are using SBCL with Emacs and SLIME (e. g. through Portacle).
Open Emacs
Start SLIME (M-x slime) — this starts a “plain” Lisp process in the background and connects the editor functions provided by slime to it; then gives you a REPL that is also connected into this process (image)
Open a text file (e. g. foo.lisp)
Type some code
Press C-c C-k to compile the file and load it into the running Lisp process
Switch to the REPL, try it out
Switch to the Lisp file (step 4).
This is just very basic usage. Further things to do/learn
You can also compile and load just a single toplevel form (C-c C-c)
Learn about packages
Learn about systems (ASDF)
Learn how to use Quicklisp to get the libraries you want
Learn how to access inline documentation from the REPL
Note that you never need to unload your program, you just modify it, even when downloading and loading new libraries. This makes the feedback cycle instantaneous in most cases. You also never need to switch away from the IDE (Emacs).

Is there any way to call Inform7 from the command line?

is there any way to play inform7 from the command line? I'd like to write some automated test script that plays the play with certain commands and don't want to do it manually. Is there any way to do that?
This is easiest to do with the CLI Linux package of Inform 7. It contains a perl CLI script you can run, but you may also like to consider this alternative script I wrote: https://github.com/i7/kerkerkruip/blob/master/tools/build-i7-project
You can invoke this with
build-i7-project -p "Project Folder"
(Leave off the .inform.)
You can also run the binaries which are installed with the IDE packages by themselves instead of installing the CLI Linux package. The command line options are probably mostly the same in other operating systems, but you may need to change them slightly. If you can't get it to work, compare with what the Inform 7 IDE says when you build with it.
If what you really want to do is periodically run some test scripts that verify that your work is still performing as expected, then Inform 7 has the capability do do that from within the IDE. Take a look at chapter 24.2 of Writing with Inform for details. In combination with good use of the Skein, this should handle the more common unit-testing requirements.
Of course, if you're doing something more outré, running bash scripts from the command line may wind up being the way to go. Still, don't do any more work than you have to. :)

Phabricator SVN Revision file context

I cannot get phabricator to display the changes in using the file context. I got the "Context not available" on every file.
Does anyone know why is this not work? What should i do to debug this problem?
This seems a problem related with SVN only because its working with GIT.
Thanks.
I bumped in the same problem recently and googled this question. I found out that the context is available only when diff is created via arcanist command line tool (arc diff) in Linux or Mac OS.
It won't work if you create a diff directly by pasting it in Phabricator/Differential or by using arcanist tool in Windows.
I tested this with arcanist on Ubuntu 14.04, Mac OS 10.10 (those two worked) and in Windows 7 (didn't work).
You didn't specify whether you're using the arc diff command line tool, or manually uploading a diff via the Phab. web interface.
If you're not using arc diff, I have an answer for you: It's up to you to include the context yourself. Phab. only knows what's in the diff/patch that you give it. If you can't get the full context, that's a fault with your diff/patch, not with Phab.
If you're using a standard diff utility, like GNU diff, you can use the command-line arguments to dictate how much context to include in the output. I usually use some obscenely large number, like 500 or 1000, to ensure that the entire file ends up in the output.
I just took a quick look at the svn command-line documentation, and it seems that there's no way to control how much context goes into the output. ...but maybe I'm wrong...
In any case, shortboy is correct that the easiest way to get the full file context is to use arc diff.

Tools Commonly used to Program in R

I apologize if this has already been asked a different way but I couldn't find anything getting at what I wanted.
I am really getting into R from other packages (SPSS). As I learn about what truly can be done, I realize that there are additional "tools" that I need. This gets me to my question.
What setup do you have for developing R code? I can't see myself actually developing r packages anywhere in the near future, but I do see myself wanting to manage my r projects effeciently, as well as create reports and presentations in LaTeX.
For context, I develop my R code in Eclipse for Windows, but I have had a real hard time successfully setting up Latex/Sweave and Github plugins.
Lastly, do you develop code using Windows or something else?
Many thanks in advance for any insight you can lend.
Emacs has everything I commonly need:
ESS (for R),
AucTeX (for Latex),
similarly rich 'modes' for other languages I use (C++, make, shell, ...),
plus a lot of other modes you get quite used to as e.g. dired for directory/file browsing or org-mode as planner/to-do list,
the SVN integration is very good too
and there are probably a number of tools within Emacs I am now forgetting.
Works in text mode as well as graphical mode, and works essentially the same (incl ESS and AucTeX) on several operating systems (Linux mostly and Windows when I must). On Debian/Ubuntu all this is prepackaged and tends to work out of the box as well. For both Windows and OS X, Vincent Goulet has package very handy bundles, see here.
The 'daemon mode' is outstanding too -- I keep the same main Emacs session running and just connect and re-connect to it even when accessing the machine (via ssh or directly) from different computers.
Also see the EmacsWiki for more tips around Emacs.
Back to Emacs and R in particular. The R FAQ says it pretty well:
6.1 Is there Emacs support for R?
6.2 Should I run R from within Emacs?
and I like the affirmative and resounding answer to the second question: "Yes, definitely". I fully concur.
I'll second the suggestion that Emacs compliments R nicely, but let me share what the "killer feature" is for me.
Using Org-mode with Org-babel, I can write whole reports with inline graphs produced from R in raster and vector format which compiles seamlessly into a PDF report via latex. I can also view the graphs while editing, similar to a WYSIWYG editor.
I just wrapped up a major report with over 70 inline graphs with little effort, no editing external files, no issues maintaining naming between figures in my report and external files, or forgetting to recompile the latest version of a figure. Org & Babel does it all.
Org-mode:
http://orgmode.org/
Org-Babel:
http://orgmode.org/worg/org-contrib/babel/index.php
Example of inline R with Babel and PDF output, see the first example in multiple formats:
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.php
Enjoy!
This is probably more relevant for package development, but it is also worth mentioning the roxygen R package that allows in-source documentation of your code. Note that even though you can't see yourself developing R packages anywhere in the near future, a package can be a very handy way of grouping related functions you develop and maintain, consistently documenting the code and keeping track of updates, even if you do not plan to distribute it.
I use a mac, and my most important tools are:
the command line, for running R
git, for keeping track of changes
github for publishing my code, bug tracking and collaboration
textmate for writing R code
Has anyone tried RStudio? It's the shiny new editor for R.
I use windows... (don't say it).
I like Notepad++ and NPPtoR. Makes it pretty easy to send things back and forth.
I use Eclipse on Windows and Linux. I compile LaTeX code (with Sweave) on Linux and I haven't bothered yet to set up the whole process in Eclipse. I need to pdflatex and bibtex files several times anyway, so I just have a terminal window with the specific string of commands handy. I tried ESS and Eclipse and they're very similar in functionality (and in my opinion the best two editors out there).
I use Eclipse / StatEt on Windows, and it Rocks !. For LaTex/Sweave I use MikTex which works well for me. For help setting things up check out this document and this post.
Other Tools you may find useful include;
If you want to build R Packages on
Windows, then get the RTools
For
Creating Documents, you may want to
check out odfWeave,
LibreOffice (was OpenOffice) and
the MSOffice ODF plugin
I have also
dabbled with Git but also didn't get
very far on Windows, but that was a
while ago.
For Presentations in LaTex
I recomend Beamer
I use Eclipse for both R and Latex while working on research papers. The plugins for both are very mature now. The nice thing is that you don't have to switch application while writing papers. I used different combination before but I found this to be the best.
I just got home from our local R User meeting (find one near you here) and of the 20 or so people there, all of us used a different program or tool to write R code in. I think that goes to show the diversity of the tools used to write and edit R code is just as diverse as the R community itself.

Is there a library for Visual C++ that renders math formulas?

I've been looking all over, but I can't find anything free that will let me simply display math formulas on a window. I found one for Visual C++.net, but no APIs. Are there any out there?
What format are the Math formulas in?
My first impulse would be to try and find a LaTeX library for C++ which will let you render out LaTeX to an image. That way you could display most basic formulas, but the formulas would have to be in the LaTeX format.
Try ReforMath (http://reformath.webnode.com). Runs under both Windows and Linux. It is unfinished though, but can render a number of elements.
What a great question! Yes, there is now: latexpp.
You'll have to install VS 2017 Community first with the minimal amount of C++ features checked (so it doesn't take all day).
Then you install Boost using the binary (try the latest).
But you still have to build boost. By using the VS > Tools > Visual Studio Command Prompt. CD to your boost directory and run .\bootstrap.bat, then .\bjam.exe. This will take all day.
Good news is it seems to be working so far on Windows 7, 64-bit with VS 2017 community and the latest boost 1.6.x.
The Latex library has other requirements, and I still haven't tried it but will post my notes here if any hickups.
Make sure all your directories are short, such as C:\VisualStudio2017. However, boost will then fail if you use your regular windows command prompt unless you do the vcvarsall.bat trick. The VS Command Prompt does that for you, so that boost can find your MSVC stuff. Boost would still probably fail if you used the default directory and didn't use the VS command prompt.
So, again, my boost is in C:\boost_{blah version} which you should shorten to C:\boost assuming you'll only use one version of boost.
One reason is that if you have to add the respective /bin directories to your system Path, then you won't fail by maxing out the length of Path value (yes, it has a max length). Also stuff is easy to find and especially from the command line so you can cd quickly there. If you don't want everything in C:\ then make a C:\__TOOLS or something short.
I will post my notes here when I've gotten LaTeX rendered.
Notes
When building boost with bjam, if it seemingly hangs for more than 10 mins on one item, then hit ctrl-C at the command line once. This seems to unhang it without canceling the install.
TODO

Resources