Some fancy syntax to define the extractor directly:
datatype dtype = T bool (payload: int)
Thinking about sets is a good starting point: you are looking for image
for multisets. That function exists and it is called image_mset
. So:
definition extr :: "dtype multiset => int multiset" where
"extr = image_mset payload"
The syntax `# for image_mset has not yet been added to the Multiset entry, but it is used by various people.
notation image_mset (infixr "`#" 90)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…