22553
|
1 |
|
21917
|
2 |
(* ID: $Id$
|
|
3 |
Author: Florian Haftmann, TU Muenchen
|
|
4 |
*)
|
|
5 |
|
|
6 |
header {* A huge set of executable constants *}
|
|
7 |
|
|
8 |
theory ExecutableContent
|
|
9 |
imports
|
|
10 |
Main
|
22521
|
11 |
Eval
|
21917
|
12 |
"~~/src/HOL/ex/Records"
|
|
13 |
AssocList
|
|
14 |
Binomial
|
|
15 |
Commutative_Ring
|
|
16 |
GCD
|
|
17 |
List_Prefix
|
|
18 |
Nat_Infinity
|
|
19 |
NatPair
|
22195
|
20 |
Nested_Environment
|
21917
|
21 |
Permutation
|
|
22 |
Primes
|
|
23 |
Product_ord
|
|
24 |
SetsAndFunctions
|
|
25 |
State_Monad
|
|
26 |
While_Combinator
|
|
27 |
Word
|
|
28 |
begin
|
|
29 |
|
|
30 |
definition
|
|
31 |
n :: nat where
|
|
32 |
"n = 42"
|
|
33 |
|
|
34 |
definition
|
|
35 |
k :: "int" where
|
|
36 |
"k = -42"
|
|
37 |
|
|
38 |
datatype mut1 = Tip | Top mut2
|
|
39 |
and mut2 = Tip | Top mut1
|
|
40 |
|
|
41 |
consts
|
|
42 |
mut1 :: "mut1 \<Rightarrow> mut1"
|
|
43 |
mut2 :: "mut2 \<Rightarrow> mut2"
|
|
44 |
|
|
45 |
primrec
|
|
46 |
"mut1 mut1.Tip = mut1.Tip"
|
|
47 |
"mut1 (mut1.Top x) = mut1.Top (mut2 x)"
|
|
48 |
"mut2 mut2.Tip = mut2.Tip"
|
|
49 |
"mut2 (mut2.Top x) = mut2.Top (mut1 x)"
|
|
50 |
|
|
51 |
definition
|
|
52 |
"mystring = ''my home is my castle''"
|
|
53 |
|
|
54 |
text {* nested lets and such *}
|
|
55 |
|
|
56 |
definition
|
|
57 |
"abs_let x = (let (y, z) = x in (\<lambda>u. case u of () \<Rightarrow> (y + y)))"
|
|
58 |
|
|
59 |
definition
|
|
60 |
"nested_let x = (let (y, z) = x in let w = y z in w * w)"
|
|
61 |
|
|
62 |
definition
|
|
63 |
"case_let x = (let (y, z) = x in case y of () => z)"
|
|
64 |
|
|
65 |
definition
|
|
66 |
"base_case f = f list_case"
|
|
67 |
|
|
68 |
definition
|
|
69 |
"apply_tower = (\<lambda>x. x (\<lambda>x. x (\<lambda>x. x)))"
|
|
70 |
|
|
71 |
definition
|
|
72 |
"keywords fun datatype x instance funa classa =
|
|
73 |
Suc fun + datatype * x mod instance - funa - classa"
|
|
74 |
|
|
75 |
hide (open) const keywords
|
|
76 |
|
|
77 |
definition
|
|
78 |
"shadow keywords = keywords @ [ExecutableContent.keywords 0 0 0 0 0 0]"
|
|
79 |
|
|
80 |
end
|