Skip to content

Instantly share code, notes, and snippets.

@emarzion
Created February 7, 2020 09:16
Show Gist options
  • Save emarzion/403ba894a16b1a10a0df4034fc26a584 to your computer and use it in GitHub Desktop.
Save emarzion/403ba894a16b1a10a0df4034fc26a584 to your computer and use it in GitHub Desktop.
A simple proof that monotone functions over the naturals are cofinal
Require Import Lia PeanoNat.
Definition monotone(f : nat -> nat) :=
forall x, f x < f (S x).
Definition cofinal(f : nat -> nat) :=
forall x, { y : nat & x < f y }.
Lemma monotone_cofinal : forall f, monotone f -> cofinal f.
Proof.
intros f f_mon x.
induction x.
- destruct (f 0) eqn:f0.
+ destruct (f 1) eqn:f1.
* absurd (f 0 < f 1).
** lia.
** apply f_mon.
* exists 1.
lia.
+ exists 0.
lia.
- destruct IHx as [y fy].
destruct (Nat.eq_dec (S x) (f y)).
+ exists (S y).
rewrite e.
apply f_mon.
+ exists y.
lia.
Defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment