playground/coq/unfinished/nofixpoint-fn.v

73 lines
981 B
Coq

Require Import Lia.
Definition f (x:nat) : nat := x + 1.
Theorem fnofix : forall n:nat,
f n <> n.
Proof.
intros.
induction n.
- discriminate.
- intros H.
apply IHn.
injection H.
unfold f.
trivial.
Qed.
(*
Require Import Relations.
Check clos_refl_trans.
Print relation.
(*
replace (n+1) with (f n).
+ reflexivity.
auto.
- now intros [=H].
*)
Lemma fsn_eq_sfn: forall n:nat,
f (S n) = S (f n).
Proof.
intros.
induction n.
Admitted.
Theorem fnofix : forall n:nat,
f n <> n.
Proof.
intros.
induction n.
- discriminate.
- rewrite -> (fsn_eq_sfn n).
*)
Definition f2 (x:nat) : nat := 0.
Theorem f2_fix_is_O : forall x:nat,
((f2 x) = x) -> (x = 0).
Proof.
intros.
rewrite <- H.
unfold f2.
reflexivity.
Qed.
Definition f3 (x:nat) : nat := x*x.
Theorem f3_fix_is_O : forall x:nat,
((f3 x) = x) -> (x = 0) \/ (x = 1).
Proof.
intros.
induction x.
- now left.
- right.
destruct IHx.
*