Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. datatype id = n_1 | n_2
  2.  
  3. type_synonym entry = "(id * (entry list ⇒ nat))"
  4. type_synonym myList = "entry list"
  5.  
  6. fun ivalue :: "myList ⇒ nat"
  7. where
  8. "ivalue [] = 0" |
  9. "ivalue (x # xs) = snd x (x xs)"
  10.  
  11. fun search :: "myList ⇒ id ⇒ myList"
  12. where
  13. "search [] t = []" |
  14. "search (x # xs) t = (if fst x = t then (x # xs) else search xs t)"
  15.  
  16. definition my_list :: "myList"
  17. where
  18. "my_list = [(n_1, %p.(42::nat)),
  19. (n_2, %p.(ivalue (search p n_1)) + 6)]"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement