Skip to content

Instantly share code, notes, and snippets.

@Pitometsu
Last active December 1, 2019 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pitometsu/7282344908f425ff345af7e437c114e2 to your computer and use it in GitHub Desktop.
Save Pitometsu/7282344908f425ff345af7e437c114e2 to your computer and use it in GitHub Desktop.
Even: Coq to OCaml
type _ num =
| Zero : zero num
| Succ : ('a num) -> 'a plus num
and _ plus = Plus : 'a num -> 'a plus
and zero = [ ]
;;
type _ even =
| Even_0 : zero num even
| Even_S : 'a num odd -> 'a plus num even
and _ odd =
| Odd_S : 'a num even -> 'a plus num odd
;;
Inductive even : N -> Prop :=
| even_0 : even 0
| even_S n : odd n -> even (n + 1)
with odd : N -> Prop :=
| odd_S n : even n -> odd (n + 1).
@Pitometsu
Copy link
Author

Even_S (Odd_S Even_0);;
- : zero plus plus num even = Even_S (Odd_S Even_0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment