Table of Contents

Isabelle/HOL Syntax

This is one of the most important sections of the Wiki. Here you'll find the basic reserved words used in Isabelle/HOL, how should they be called, in which context, their meaning and hopefully some example code. If you're uploading/updating content, please try to adapt to the schema used for all the words to improve readability.

Keywords

theory

theory name

theory MyTheory

imports

imports package

theory Bar
imports Main
begin
...
end

begin ... end

begin … end

theory Foo
imports Main
begin
...
end

definition

definition name :: “domain” where “fun_def

definition swap :: "('a * 'b) => ('b * 'a)"
where
"swap pair = (snd pair, fst pair)"

primrec

primrec name :: “domain” where “fun_def_1 | fun_def_2 | … | fun_def_n

primrec listSwap :: "('a * 'b) list => ('b * 'a) list"
where
"listSwap [] = []" |
"listSwap(x#xs) = (swap(x))#(listSwap(xs))"

value

value “some_val

value "(1 # 2 # 3 # [])"
(*Assume you have a function definition called myMap :: "('a => 'b) => ('a list) => ('b list)"*)
value "myMap ((op +)1) ((1::nat) # 3 # [])"

Symbols from Libraries

Cons

Cons firstElem listTale

value "Cons 0 (Cons 1 (Cons 2 (Cons 3 Nil)))"
(*Equivalent expression using the abbreviations*)
value "0 # 1 # 2 # 3 # []"

Template

TERM

Syntax definition of the term with its parameters parameters

put some simple example code here. 
Hopefully an example that isn't already in the documentation so we can have more examples.