Isabelle


https://isabelle.in.tum.de/documentation.html

Coq analogues:

Isabelle Coq
Isar Ltac
locale Section
Proof methods Tactics
==> -> (implication)
=> -> (arrow)
value Compute
sorry admit
oops give_up
x:xs x # xs

Proof methods

Default names:

Notations

notation

Associate a mixfix notation with a predefined definition.

Example from the isabelle tutorial:

definition xor :: "bool => bool => bool" (infixl "[+]" 60)
where "A [+] B = (A ∧ ¬B) ∨ (¬A ∧ B)"

notation (xsymbols) xor (infixl "±" 60)

where xsymbols is an optional argument?? called the 'print mode specification' which is used when pretty-printing.

abbreviation

Kind of like a more complex form of notation.

Mixfix notations

class group = monoid +
  fixes inverse :: ‹'a ⇒ 'a› (‹(_÷)› [1000] 999)
  assumes invl: ‹x÷ ⊗ x = 𝟭›

Isabelle document processor

Markup commands:

Anti-quotations

Evaluate a term

Use value to compute. Like Compute of Coq.

datatype onat = Zero | Succ onat

fun oadd :: "onat ⇒ onat ⇒ onat" where
  "oadd Zero n = n" |
  "oadd (Succ m) n = Succ (oadd m n)"

value "oadd Zero (Succ Zero)"
(*
"Succ Zero"
  :: "onat"
 *)

Jedit stuff

https://isabelle.in.tum.de/dist/doc/jedit.pdf

Examples of 'cartouches' (ie, the special symbols, I guess):

\<open>
\<one> 𝟭

Other editors:

Classes

https://isabelle.in.tum.de/doc/classes.pdf

Record type

Example:

record tg =
  tg_mut :: mut
  tg_t :: t

Locale

Lifting and transfer

https://www21.in.tum.de/%7Ekuncar/documents/huffman-kuncar-cpp2013.pdf

Bundled declarations (Isar)

Prove mode and state mode ??

A class instance can be defined in more than one way, apparently.

theory Example
  imports Main
begin
  class semigroup =
    fixes sgop :: ‹'a ⇒ 'a ⇒ 'a› (infixl ‹⊗› 70)
    assumes assoc : ‹(x ⊗ y) ⊗ z = x ⊗ (y ⊗ z)›

  class monoid = semigroup +
    fixes unit :: ‹'a› (‹𝟭›)
    assumes unitl : ‹unit ⊗ x = x›
      and unitr : ‹x ⊗ unit = x›

  instantiation prod :: (semigroup, semigroup) semigroup
  begin
    definition sgop_prod :: "'a × 'b ⇒ 'a × 'b ⇒ 'a × 'b" where
      "sgop_prod x y =
        (case x of (a1, b1) ⇒
          (case y of (a2, b2) ⇒ (a1 ⊗ a2, b1 ⊗ b2)))"

    instance proof
      fix p q r :: ‹'a::semigroup × 'b::semigroup›
      show ‹(p ⊗ q) ⊗ r = p ⊗ (q ⊗ r)› 
        unfolding sgop_prod_def
        unfolding case_prod_unfold
        by (simp add: assoc)
    qed

  end

The instance for pair semigroup could also have been done (outside of prove mode??) like:

instance
  apply (standard)
  apply (simp add: sgop_prod_def)
  apply (simp add: case_prod_unfold)
  apply (simp add: assoc)
done

'Old-style datatypes'

From https://isabelle.in.tum.de/library/Doc/Datatypes/Datatypes.html:

'datatype_compat command registers new-style datatypes as old-style datatypes and invokes the old-style plugins'

Annotations

Use (nonexhaustive) annotation to say that a function is not total. For example:

primrec (nonexhaustive) last :: "'a list ⇒ 'a" where
  "last (x # xs) = (if xs = [] then x else last xs)"

Code gen

https://isabelle.in.tum.de/doc/codegen.pdf