src/HOL/ex/Eval_Examples.thy
author haftmann
Sat, 15 Sep 2007 19:27:42 +0200
changeset 24587 4f2cbf6e563f
parent 24423 ae9cd0e92423
child 24659 6b7ac2a43df8
permissions -rw-r--r--
multi-functional value keyword

(*  ID:         $Id$
    Author:     Florian Haftmann, TU Muenchen
*)

header {* Small examples for evaluation mechanisms *}

theory Eval_Examples
imports Eval
begin

text {* SML evaluation oracle *}

lemma "True \<or> False" by evaluation
lemma "\<not> (Suc 0 = Suc 1)" by evaluation
lemma "[] = ([]\<Colon> int list)" by evaluation
lemma "[()] = [()]" by evaluation
lemma "fst ([]::nat list, Suc 0) = []" by evaluation

text {* evaluation oracle *}

lemma "True \<or> False" by eval
lemma "\<not> (Suc 0 = Suc 1)" by eval
lemma "[] = ([]\<Colon> int list)" by eval
lemma "[()] = [()]" by eval
lemma "fst ([]::nat list, Suc 0) = []" by eval

text {* term evaluation *}

value "(Suc 2 + 1) * 4"
value "(Suc 2 + 1) * 4"
value "(Suc 2 + Suc 0) * Suc 3"
value "nat 100"
value "(10\<Colon>int) \<le> 12"
value "[]::nat list"
value "[(nat 100, ())]"
value "max (2::int) 4"

text {* a fancy datatype *}

datatype ('a, 'b) bair =
    Bair "'a\<Colon>order" 'b
  | Shift "('a, 'b) cair"
  | Dummy unit
and ('a, 'b) cair =
    Cair 'a 'b

value "Shift (Cair (4::nat) [Suc 0])"

end