Skip to content
Snippets Groups Projects
Unverified Commit c5148da4 authored by Viktor Kunčak's avatar Viktor Kunčak Committed by GitHub
Browse files

Macro to include executable lisa listings from a file (#230)

parent 3aa243f2
Branches
No related tags found
No related merge requests found
......@@ -6,3 +6,4 @@ lisa.fls
lisa.log
lisa.out
lisa.toc
src/.scala-build
No preview for this file type
......@@ -21,7 +21,8 @@
\date{}
% PDF links and meta data
\usepackage{hyperref}
%\usepackage{hyperref}
\usepackage{bookmark}
\makeatletter
\hypersetup{
colorlinks=true,
......
......@@ -184,3 +184,6 @@
\DeclareMathOperator{\pick}{pick}
\newcommand{\lisaCode}[3]{
\lstinputlisting[language=lisa, frame=single,caption=\href{#1}{#2}, #3]{#1}
}
......@@ -6,34 +6,7 @@ Lisa provides a canonical way of writing and organizing Kernel proofs by mean of
\autoref{fig:theoryFileExample} is a reminder from \autoref{chapt:quickguide} of the canonical way to write a theory file in Lisa.
\begin{figure}
\begin{lstlisting}[language=lisa, frame=single]
object MyTheoryName extends lisa.Main {
val x = variable
val f = function[1]
val P = predicate[1]
val fixedPointDoubleApplication = Theorem(
∀(x, P(x) ==> P(f(x))) |- P(x) ==> P(f(f(x)))
) {
assume(∀(x, P(x) ==> P(f(x))))
val step1 = have(P(x) ==> P(f(x))) by InstantiateForall
val step2 = have(P(f(x)) ==> P(f(f(x)))) by InstantiateForall
have(thesis) by Tautology.from(step1, step2)
}
val emptySetIsASubset = Theorem(
∅ ⊆ x
) {
have((y ∈ ∅) ==> (y ∈ x)) by Tautology.from(
emptySetAxiom of (x := y))
val rhs = thenHave (∀(y, (y ∈ ∅) ==> (y ∈ x))) by RightForall
have(thesis) by Tautology.from(
subsetAxiom of (x := ∅, y := x), rhs)
}
}
\end{lstlisting}
\caption{An example of a theory file in Lisa}
\lisaCode{src/MyTheoryName.scala}{An example of a theory file in Lisa}{firstline=3}
\label{fig:theoryFileExample}
\end{figure}
......
//> using scala 3.5.1
//> using jar "../../../lisa/target/scala-3.5.1/lisa-assembly-0.7.jar"
object MyTheoryName extends lisa.Main:
val x = variable
val y = variable
val f = function[1]
val P = predicate[1]
val fixedPointDoubleApplication = Theorem(
∀(x, P(x) ==> P(f(x))) |- P(x) ==> P(f(f(x)))
) {
assume(∀(x, P(x) ==> P(f(x))))
val step1 = have(P(x) ==> P(f(x))) by InstantiateForall
val step2 = have(P(f(x)) ==> P(f(f(x)))) by InstantiateForall
have(thesis) by Tautology.from(step1, step2)
}
val emptySetIsASubset = Theorem(
x
) {
have((y ∅) ==> (y x)) by Tautology.from(
emptySetAxiom of (x := y))
val rhs = thenHave (∀(y, (y ∅) ==> (y x))) by RightForall
have(thesis) by Tautology.from(
subsetAxiom of (x := ∅, y := x), rhs)
}
@main def show = println(emptySetAxiom)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment