-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fleche] Support .tex literate documents
Similarly to `.mv` files, we recognize `.lv` files to be LaTeX files with embedded Coq snippets, delimited by `begin/end` pairs. To have some Coq code recognized inside a `.lv` file do: ```LaTeX \begin{coq} \end{coq} ``` Some tweaks to this scheme will be likely needed, for example I'm unsure the `.lv` extension will work in practice; suggestions welcome!
- Loading branch information
Showing
9 changed files
with
219 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
\documentclass{article} | ||
|
||
\usepackage{listings} | ||
|
||
\lstdefinelanguage{Coq} | ||
{morekeywords={Theorem, Definition}} | ||
|
||
\lstnewenvironment{coq} | ||
{ | ||
\lstset{ | ||
language=Coq, | ||
basicstyle=\ttfamily, | ||
breaklines=true, | ||
columns=fullflexible} | ||
} | ||
{ | ||
} | ||
|
||
\begin{document} | ||
|
||
\section{Welcome to Coq LSP} | ||
|
||
\begin{itemize} | ||
\item You can edit this document as you please | ||
\item Coq will recognize the code snippets as Coq | ||
\item You will be able to save the document and link to other documents soon | ||
\end{itemize} | ||
|
||
\begin{coq} | ||
From Coq Require Import List. | ||
Import ListNotations. | ||
\end{coq} | ||
|
||
\subsection{Here is a simple Proof about Lists} | ||
|
||
$$ | ||
\forall~x~l, | ||
\mathsf{rev}(l \mathrel{++} [x]) = x \mathrel{::} (\mathsf{rev}~l) | ||
$$ | ||
|
||
\begin{coq} | ||
Lemma rev_snoc_cons A : | ||
forall (x : A) (l : list A), rev (l ++ [x]) = x :: rev l. | ||
Proof. | ||
induction l. | ||
- reflexivity. | ||
- simpl. rewrite IHl. simpl. reflexivity. | ||
Qed. | ||
\end{coq} | ||
|
||
\subsection{Here is another proof depending on it} | ||
|
||
Try to update \emph{above} and \textbf{below}: | ||
|
||
\begin{coq} | ||
Theorem rev_rev A : forall (l : list A), rev (rev l) = l. | ||
Proof. | ||
induction l. | ||
- reflexivity. | ||
- simpl. rewrite rev_snoc_cons. rewrite IHl. | ||
reflexivity. | ||
Qed. | ||
\end{coq} | ||
|
||
Please edit your code here! | ||
|
||
\section{Here we do some lambda terms, because we can!} | ||
|
||
\begin{coq} | ||
Inductive term := | ||
| Var : nat -> term | ||
| Abs : term -> term | ||
| Lam : term -> term -> term. | ||
\end{coq} | ||
|
||
\end{document} | ||
|
||
|
||
%%% Local Variables: | ||
%%% mode: LaTeX | ||
%%% TeX-master: "lists" | ||
%%% End: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
\documentclass{article} | ||
|
||
\usepackage{listings} | ||
|
||
\lstdefinelanguage{Coq} | ||
{morekeywords={Theorem, Definition}} | ||
|
||
\lstnewenvironment{coq} | ||
{ | ||
\lstset{ | ||
language=Coq, | ||
basicstyle=\ttfamily, | ||
breaklines=true, | ||
columns=fullflexible} | ||
} | ||
{ | ||
} | ||
|
||
\begin{document} | ||
|
||
\section{Welcome to Coq LSP} | ||
|
||
\begin{itemize} | ||
\item You can edit this document as you please | ||
\item Coq will recognize the code snippets as Coq | ||
\item You will be able to save the document and link to other documents soon | ||
\end{itemize} | ||
|
||
\begin{coq} | ||
From Coq Require Import List. | ||
Import ListNotations. | ||
\end{coq} | ||
|
||
\subsection{Here is a simple Proof about Lists} | ||
|
||
$$ | ||
\forall~x~l, | ||
\mathsf{rev}(l \mathrel{++} [x]) = x \mathrel{::} (\mathsf{rev}~l) | ||
$$ | ||
|
||
\begin{coq} | ||
Lemma rev_snoc_cons A : | ||
forall (x : A) (l : list A), rev (l ++ [x]) = x :: rev l. | ||
Proof. | ||
induction l. | ||
- reflexivity. | ||
- simpl. rewrite IHl. simpl. reflexivity. | ||
Qed. | ||
\end{coq} | ||
|
||
\subsection{Here is another proof depending on it} | ||
|
||
Try to update \emph{above} and \textbf{below}: | ||
|
||
\begin{coq} | ||
Theorem rev_rev A : forall (l : list A), rev (rev l) = l. | ||
Proof. | ||
induction l. | ||
- reflexivity. | ||
- simpl. rewrite rev_snoc_cons. rewrite IHl. | ||
reflexivity. | ||
Qed. | ||
\end{coq} | ||
|
||
Please edit your code here! | ||
|
||
\section{Here we do some lambda terms, because we can!} | ||
|
||
\begin{coq} | ||
Inductive term := | ||
| Var : nat -> term | ||
| Abs : term -> term | ||
| Lam : term -> term -> term. | ||
\end{coq} | ||
|
||
\end{document} | ||
|
||
|
||
%%% Local Variables: | ||
%%% mode: LaTeX | ||
%%% TeX-master: "lists" | ||
%%% End: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters