-
Notifications
You must be signed in to change notification settings - Fork 3
/
Lem_map.thy
executable file
·159 lines (100 loc) · 6.94 KB
/
Lem_map.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
chapter {* Generated by Lem from map.lem. *}
theory "Lem_map"
imports
Main
"Lem_bool"
"Lem_basic_classes"
"Lem_function"
"Lem_maybe"
"Lem_list"
"Lem_tuple"
"Lem_set"
"Lem_num"
begin
(*open import Bool Basic_classes Function Maybe List Tuple Set Num*)
(*open import {hol} `finite_mapTheory` `finite_mapLib`*)
(*type map 'k 'v*)
(* -------------------------------------------------------------------------- *)
(* Map equality. *)
(* -------------------------------------------------------------------------- *)
(*val mapEqual : forall 'k 'v. Eq 'k, Eq 'v => map 'k 'v -> map 'k 'v -> bool*)
(*val mapEqualBy : forall 'k 'v. ('k -> 'k -> bool) -> ('v -> 'v -> bool) -> map 'k 'v -> map 'k 'v -> bool*)
(* -------------------------------------------------------------------------- *)
(* Map type class *)
(* -------------------------------------------------------------------------- *)
(*class ( MapKeyType 'a )
val {ocaml;coq} mapKeyCompare : 'a -> 'a -> ordering
end*)
(* -------------------------------------------------------------------------- *)
(* Empty maps *)
(* -------------------------------------------------------------------------- *)
(*val empty : forall 'k 'v. MapKeyType 'k => map 'k 'v*)
(*val emptyBy : forall 'k 'v. ('k -> 'k -> ordering) -> map 'k 'v*)
(* -------------------------------------------------------------------------- *)
(* Insertion *)
(* -------------------------------------------------------------------------- *)
(*val insert : forall 'k 'v. MapKeyType 'k => 'k -> 'v -> map 'k 'v -> map 'k 'v*)
(* -------------------------------------------------------------------------- *)
(* Singleton *)
(* -------------------------------------------------------------------------- *)
(*val singleton : forall 'k 'v. MapKeyType 'k => 'k -> 'v -> map 'k 'v*)
(* -------------------------------------------------------------------------- *)
(* Emptyness check *)
(* -------------------------------------------------------------------------- *)
(*val null : forall 'k 'v. MapKeyType 'k, Eq 'k, Eq 'v => map 'k 'v -> bool*)
(* -------------------------------------------------------------------------- *)
(* lookup *)
(* -------------------------------------------------------------------------- *)
(*val lookupBy : forall 'k 'v. ('k -> 'k -> ordering) -> 'k -> map 'k 'v -> maybe 'v*)
(*val lookup : forall 'k 'v. MapKeyType 'k => 'k -> map 'k 'v -> maybe 'v*)
(* -------------------------------------------------------------------------- *)
(* findWithDefault *)
(* -------------------------------------------------------------------------- *)
(*val findWithDefault : forall 'k 'v. MapKeyType 'k => 'k -> 'v -> map 'k 'v -> 'v*)
(* -------------------------------------------------------------------------- *)
(* from lists *)
(* -------------------------------------------------------------------------- *)
(*val fromList : forall 'k 'v. MapKeyType 'k => list ('k * 'v) -> map 'k 'v*)
(*let fromList l= foldl (fun m (k,v) -> insert k v m) empty l*)
(* -------------------------------------------------------------------------- *)
(* to sets / domain / range *)
(* -------------------------------------------------------------------------- *)
(*val toSet : forall 'k 'v. MapKeyType 'k, SetType 'k, SetType 'v => map 'k 'v -> set ('k * 'v)*)
(*val toSetBy : forall 'k 'v. (('k * 'v) -> ('k * 'v) -> ordering) -> map 'k 'v -> set ('k * 'v)*)
(*val domainBy : forall 'k 'v. ('k -> 'k -> ordering) -> map 'k 'v -> set 'k*)
(*val domain : forall 'k 'v. MapKeyType 'k, SetType 'k => map 'k 'v -> set 'k*)
(*val range : forall 'k 'v. MapKeyType 'k, SetType 'v => map 'k 'v -> set 'v*)
(*val rangeBy : forall 'k 'v. ('v -> 'v -> ordering) -> map 'k 'v -> set 'v*)
(* -------------------------------------------------------------------------- *)
(* member *)
(* -------------------------------------------------------------------------- *)
(*val member : forall 'k 'v. MapKeyType 'k, SetType 'k, Eq 'k => 'k -> map 'k 'v -> bool*)
(*val notMember : forall 'k 'v. MapKeyType 'k, SetType 'k, Eq 'k => 'k -> map 'k 'v -> bool*)
(* -------------------------------------------------------------------------- *)
(* Quantification *)
(* -------------------------------------------------------------------------- *)
(*val any : forall 'k 'v. MapKeyType 'k, Eq 'v => ('k -> 'v -> bool) -> map 'k 'v -> bool*)
(*val all : forall 'k 'v. MapKeyType 'k, Eq 'v => ('k -> 'v -> bool) -> map 'k 'v -> bool*)
(*let all P m= (forall k v. (P k v && ((Instance_Basic_classes_Eq_Maybe_maybe.=) (lookup k m) (Just v))))*)
(* -------------------------------------------------------------------------- *)
(* Set-like operations. *)
(* -------------------------------------------------------------------------- *)
(*val deleteBy : forall 'k 'v. ('k -> 'k -> ordering) -> 'k -> map 'k 'v -> map 'k 'v*)
(*val delete : forall 'k 'v. MapKeyType 'k => 'k -> map 'k 'v -> map 'k 'v*)
(*val deleteSwap : forall 'k 'v. MapKeyType 'k => map 'k 'v -> 'k -> map 'k 'v*)
(*val union : forall 'k 'v. MapKeyType 'k => map 'k 'v -> map 'k 'v -> map 'k 'v*)
(*val unions : forall 'k 'v. MapKeyType 'k => list (map 'k 'v) -> map 'k 'v*)
(* -------------------------------------------------------------------------- *)
(* Maps (in the functor sense). *)
(* -------------------------------------------------------------------------- *)
(*val map : forall 'k 'v 'w. MapKeyType 'k => ('v -> 'w) -> map 'k 'v -> map 'k 'w*)
(*val mapi : forall 'k 'v 'w. MapKeyType 'k => ('k -> 'v -> 'w) -> map 'k 'v -> map 'k 'w*)
(* -------------------------------------------------------------------------- *)
(* Cardinality *)
(* -------------------------------------------------------------------------- *)
(*val size : forall 'k 'v. MapKeyType 'k, SetType 'k => map 'k 'v -> nat*)
(* instance of SetType *)
definition map_setElemCompare :: "(('d*'c)set \<Rightarrow>('b*'a)set \<Rightarrow> 'e)\<Rightarrow>('d,'c)Map.map \<Rightarrow>('b,'a)Map.map \<Rightarrow> 'e " where
" map_setElemCompare cmp x y = (
cmp (map_to_set x) (map_to_set y))"
end