Up to index of Isabelle/HOL/ex
theory Eval_Examples(* ID: $Id: Eval_Examples.thy,v 1.10 2008/01/31 10:44:43 haftmann Exp $ Author: Florian Haftmann, TU Muenchen *) header {* Small examples for evaluation mechanisms *} theory Eval_Examples imports Eval "~~/src/HOL/Real/Rational" begin text {* evaluation oracle *} lemma "True ∨ False" by eval lemma "¬ (Suc 0 = Suc 1)" by eval lemma "[] = ([]:: int list)" by eval lemma "[()] = [()]" by eval lemma "fst ([]::nat list, Suc 0) = []" by eval text {* SML evaluation oracle *} lemma "True ∨ False" by evaluation lemma "¬ (Suc 0 = Suc 1)" by evaluation lemma "[] = ([]:: int list)" by evaluation lemma "[()] = [()]" by evaluation lemma "fst ([]::nat list, Suc 0) = []" by evaluation text {* normalization *} lemma "True ∨ False" by normalization lemma "¬ (Suc 0 = Suc 1)" by normalization lemma "[] = ([]:: int list)" by normalization lemma "[()] = [()]" by normalization lemma "fst ([]::nat list, Suc 0) = []" by normalization text {* term evaluation *} value "(Suc 2 + 1) * 4" value (code) "(Suc 2 + 1) * 4" value (SML) "(Suc 2 + 1) * 4" value ("normal_form") "(Suc 2 + 1) * 4" value "(Suc 2 + Suc 0) * Suc 3" value (code) "(Suc 2 + Suc 0) * Suc 3" value (SML) "(Suc 2 + Suc 0) * Suc 3" value ("normal_form") "(Suc 2 + Suc 0) * Suc 3" value "nat 100" value (code) "nat 100" value (SML) "nat 100" value ("normal_form") "nat 100" value "(10::int) ≤ 12" value (code) "(10::int) ≤ 12" value (SML) "(10::int) ≤ 12" value ("normal_form") "(10::int) ≤ 12" value "max (2::int) 4" value (code) "max (2::int) 4" value (SML) "max (2::int) 4" value ("normal_form") "max (2::int) 4" value "of_int 2 / of_int 4 * (1::rat)" value (code) "of_int 2 / of_int 4 * (1::rat)" value (SML) "of_int 2 / of_int 4 * (1::rat)" value ("normal_form") "of_int 2 / of_int 4 * (1::rat)" value "[]::nat list" value (code) "[]::nat list" value (SML) "[]::nat list" value ("normal_form") "[]::nat list" value "[(nat 100, ())]" value (code) "[(nat 100, ())]" value (SML) "[(nat 100, ())]" value ("normal_form") "[(nat 100, ())]" text {* a fancy datatype *} datatype ('a, 'b) bair = Bair "'a::order" 'b | Shift "('a, 'b) cair" | Dummy unit and ('a, 'b) cair = Cair 'a 'b value "Shift (Cair (4::nat) [Suc 0])" value (code) "Shift (Cair (4::nat) [Suc 0])" value (SML) "Shift (Cair (4::nat) [Suc 0])" value ("normal_form") "Shift (Cair (4::nat) [Suc 0])" end
lemma
True ∨ False [!]
lemma
Suc 0 ≠ Suc 1 [!]
lemma
[] = [] [!]
lemma
[()] = [()] [!]
lemma
fst ([], Suc 0) = [] [!]
lemma
True ∨ False [!]
lemma
Suc 0 ≠ Suc 1 [!]
lemma
[] = [] [!]
lemma
[()] = [()] [!]
lemma
fst ([], Suc 0) = [] [!]
lemma
True ∨ False [!]
lemma
Suc 0 ≠ Suc 1 [!]
lemma
[] = [] [!]
lemma
[()] = [()] [!]
lemma
fst ([], Suc 0) = [] [!]