sangwinc / logic_and_proof

CMU Undergrad Course

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

Logic and Proof

An undergraduate introductory course on logic and proof.

Note: the course is being developed in a downstream fork:

This version may be slightly more up to date. To deploy this version, replace "leanprover" by "avigad" in the instructions below.

How to Build

We use cask to install emacs dependencies (org-mode, lean-mode, htmlize). We use pygments and minted to syntax-highlight Lean code in LaTeX.

We assume that you already have emacs-24.3 or higher installed in your system. To install the latest version of emacs, please run the following in a terminal:

sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ubuntu-elisp/ppa
sudo apt-get update
sudo apt-get install -y emacs-snapshot

To install the required packages, run the following in a terminal:

sudo apt-get update
sudo apt-get install -y mercurial python2.7 texlive-latex-recommended \
                        texlive-humanities texlive-xetex texlive-science \
                        texlive-latex-extra texlive-fonts-recommended \
                        texlive-luatex bibtex2html git mercurial \
                        latex-xcolor lmodern dvipng pgf moreutils \
                        autoconf automake gcc curl git make

To deploy, we are using minify to minimize .css and .js files. You need node.js which you can install by running the following in a terminal:

sudo add-apt-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Run the following in a terminal to build HTML and PDF version of "Logic and Proof":

git clone https://github.com/leanprover/logic_and_proof
cd logic_and_proof
npm install minify
tar xvfz header/l3kernel.tar.gz -C ~/
make install-cask # after this, you need to add the cask binary to your $PATH
make install-pygments
make

Deploy to Github Pages

Running the following command deploys the contents to the gh-pages branch of leanprover/logic_and_proof repository:

# ./deploy.sh <account_name> <repo_name>
./deploy.sh leanprover logic_and_proof

It will be accessible via https://leanprover.github.io/logic_and_proof.

Automatic Build using Watchman

Using watchman, we can detect any changes on the org-files, and trigger re-builds automatically on the background.

To install watchman:

sudo apt-get install automake
make install-watchman

To enable watch:

make watch-on

To disable watch:

make watch-off

How to preview generated HTML files

It requires a webserver to preview generated HTML files. We can use Python's SimpleHTTPServer module:

python -m SimpleHTTPServer

The above command starts a HTTP server at logic_and_proof directory (default port: 8000). For example, 01_Introduction.html is available at http://localhost:8000/01_Introduction.html.

Auto-reload HTML page

  • Firefox: Auto Reload add-on

    • Tools > AutoReload Preferences 1
    • Create Reload Rule 2
    • Link .html in the filesystem 3
  • Chrome: Tincr (does not work on Linux)

    • Right-click and choose "Inspect Element" 5
    • Go to "tincr" tab, choose "Http Web Server" for project type, then select Root directory. 4

Test Lean Code in .org files

  1. Using Native Lean: First, you need to install Lean. Please follow the instructions at the download page. You can test all Lean code blocks in *.org files by executing the following command:

make test ```

To use a specific binary of Lean in test, please do the following: bash LEAN_BIN=/path/to/your/lean make test

  1. Using Lean.JS:

make test_js ```

About

CMU Undergrad Course

License:Apache License 2.0


Languages

Language:TeX 86.0%Language:JavaScript 6.2%Language:Emacs Lisp 3.2%Language:CSS 1.7%Language:HTML 1.5%Language:Shell 0.8%Language:Makefile 0.6%Language:Lean 0.0%