Last active
September 23, 2019 13:25
-
-
Save oonis/ce6abe60aaeeb938bdc50b9229f2be5a to your computer and use it in GitHub Desktop.
Coq script for the collatz conjecture.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Export Coq.PArith.BinPos. | |
Inductive odd : positive -> Prop := | |
| odd_one : odd xH | |
| odd_xI : forall n : positive, odd (xI (n)). | |
Inductive even : positive -> Prop := | |
| even_xO : forall n : positive, even (xO (n)). | |
Lemma even_or_odd n : even n \/ odd n. | |
Proof. | |
induction n. Focus 3. | |
right. apply odd_one. | |
right. apply odd_xI. | |
left. apply even_xO. | |
Inductive collatz : positive -> Prop := | |
| collatz_one : collatz xH | |
| collatz_double : forall n : positive, collatz n -> collatz (n + n) | |
| collatz_divide_three : forall n : positive, ((odd n) /\ (collatz (n + n + n + 1))) -> collatz n. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment