Skip to content

Instantly share code, notes, and snippets.

@cpitclaudel
Created October 16, 2015 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpitclaudel/2c75c8dc88b0e1c9a6e7 to your computer and use it in GitHub Desktop.
Save cpitclaudel/2c75c8dc88b0e1c9a6e7 to your computer and use it in GitHub Desktop.
(defun my-pg-preprocessor (coq-sentence)
"Run COQ-SENTENCE through preprocessor and return the result."
(let ((preprocessor (with-current-buffer proof-script-buffer
(expand-file-name "./preprocessor.rb"))))
(with-temp-buffer
(insert coq-sentence)
(call-process-region (point-min) (point-max) preprocessor t '(t nil) nil)
(buffer-string))))
(defun my-pg-preprocessor-hook ()
"Preprocess PG's current command."
(setq string (my-pg-preprocessor string)))
(add-hook 'proof-shell-insert-hook #'my-pg-preprocessor-hook)
#!/usr/bin/env ruby
require 'erb'
version = `coqc -v`.match(/version ([^(]*) \(/)[1]
renderer = ERB.new(STDIN.read)
puts renderer.result()
Definition proj (n : {n : nat & n >= 2}) : nat :=
match n with
| existT <%= "_" unless version[0..2] == "8.4" %> n _ => n
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment