playground/coq/misc/mathcomp-stuff.v

68 lines
1.2 KiB
Coq

From mathcomp Require Import all_ssreflect.
Require Import Arith.
(*=================================================================*)
Goal forall n m:nat,
n.+1 < m.+1 -> n < m.
(* I guess it's because mathcomp uses `addn` and coq stdlib uses `Nat.add`? *)
Proof.
move => n m /ltP //=.
(* Check (ltn_add2r 1) n m. *)
Qed.
Goal forall n m:nat,
n < m -> n.+1 < m.+1.
Proof.
move => n m /ltP //=.
Qed.
Goal forall (n m: nat),
(forall a b:nat, a < b) -> n.+1 < m.+1.
Proof.
move => n m H.
have HH := H n m.
move: HH.
by move /ltP.
Qed.
(*=================================================================*)
Locate "_ <? _".
Locate "_ < _".
Search Nat.ltb lt.
Search Nat.ltb leq.
Goal forall a b: nat,
a <? b -> False.
Proof.
(*
move: H1 /Nat.ltb_spec0.
Error:
dependents switch `/' in move tactic
*)
Restart.
move => a b H1.
move: H1.
move /Nat.ltb_spec0 /ltP => H. (**)
Restart.
move => a b /Nat.ltb_spec0 /ltP.
Abort. (**)
(*=================================================================*)
Lemma le_ge_symm: forall n m:nat,
n >= m <-> m <= n.
Proof.
split.
- elim: n => [|n]; first by [].
move => IHn.
by case.
- elim: n => [|n]; first by [].
move => IHn.
by case.
Qed.