-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathITree_Extraction.thy
109 lines (83 loc) · 2.37 KB
/
ITree_Extraction.thy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
subsection \<open> ITree Code Generation Support \<close>
theory ITree_Extraction
imports ITree_Deadlock "HOL-Library.Code_Lazy"
begin
text \<open> Necessary to deal with SML value restriction \<close>
declare deadlock_def [code_unfold]
text \<open> Configuring the code generator; either partial functions or associative lists can be used
in specifying choice functions. Partial injections are also supported using lists. \<close>
code_datatype pfun_of_alist pfun_of_map pfun_of_pinj pfun_entries
code_datatype pinj_of_alist
declare pinv_pinj_of_alist [code]
instantiation list :: (type) default
begin
definition "default_list = ([] :: 'a list)"
instance ..
end
instantiation set :: (type) default
begin
definition "default_set = ({} :: 'a set)"
instance ..
end
instantiation option :: (type) default
begin
definition "default_option = (None :: 'a option)"
instance ..
end
instantiation bool :: default
begin
definition "default_bool = False"
instance ..
end
instantiation nat :: default
begin
definition "default_nat = (0 :: nat)"
instance ..
end
instantiation int :: default
begin
definition "default_int = (0 :: int)"
instance ..
end
instantiation integer :: default
begin
definition "default_integer = (0 :: integer)"
instance ..
end
instantiation String.literal :: default
begin
definition "default_literal = STR ''''"
instance ..
end
instantiation pfun :: (type, type) default
begin
definition "default_pfun = ({}\<^sub>p :: ('a, 'b) pfun)"
instance ..
end
instantiation ffun :: (type, type) default
begin
definition "default_ffun = ({}\<^sub>f :: ('a, 'b) ffun)"
instance ..
end
instantiation pinj :: (type, type) default
begin
definition default_pinj :: "'a \<Zpinj> 'b" where "default_pinj = {}\<^sub>\<rho>"
instance ..
end
instantiation prod :: (default, default) default
begin
definition default_prod :: "'a \<times> 'b" where
"default_prod = (default, default)"
instance ..
end
declare UNIV_I [code_unfold]
declare bool_simps [code_unfold]
declare UNIV_unit [code_unfold]
lemma Collect_List_member [code_unfold]: "Collect (List.member xs) = set xs"
using in_set_member by fastforce
declare image_ident [code_unfold]
lemma all_mem_Ball [code_unfold]: "(\<forall> x. x \<in> A \<longrightarrow> P x) \<longleftrightarrow> (\<forall> x\<in>A. P x)"
by auto
lemma ex_mem_Bex [code_unfold]: "(\<exists> x. x \<in> A \<and> P x) \<longleftrightarrow> (\<exists>x\<in>A. P x)"
by auto
end