Skip to content

Commit

Permalink
generalise nat_mod_one_l to nat_mod_lt
Browse files Browse the repository at this point in the history
We show that for k < n, k mod n = k.

Signed-off-by: Ali Caglayan <[email protected]>

<!-- ps-id: 14b9788f-fa61-434f-a054-d5712712e6aa -->
  • Loading branch information
Alizter committed Nov 14, 2024
1 parent bf50a38 commit baa5191
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions theories/Spaces/Nat/Division.v
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,14 @@ Defined.
(** [n] modulo [0] is [n]. *)
Definition nat_mod_zero_r n : n mod 0 = n := idpath.

(** TODO: generalise for all small n *)
Definition nat_mod_one_l n : 1 < n -> 1 mod n = 1.
Definition nat_mod_lt n k : k < n -> k mod n = k.
Proof.
intros H.
destruct H; trivial.
destruct m.
1: contradiction (not_lt_zero_r _ H).
cbn; clear H.
by induction m.
lhs_V nrapply nat_div_mod_spec'.
rewrite nat_div_lt.
- rewrite nat_mul_zero_r.
apply nat_sub_zero_r.
- exact H.
Defined.

(** [n] modulo [1] is [0]. *)
Expand Down

0 comments on commit baa5191

Please sign in to comment.