theorem divides_plus: \forall n,p,q:nat.
n \divides p \to n \divides q \to n \divides p+q.
intros.
-elim H.elim H1. apply (witness n (p+q) (n2+n1)).
+elim H.elim H1. apply (witness n (p+q) (n1+n2)).
rewrite > H2.rewrite > H3.apply sym_eq.apply distr_times_plus.
qed.
theorem divides_minus: \forall n,p,q:nat.
divides n p \to divides n q \to divides n (p-q).
intros.
-elim H.elim H1. apply (witness n (p-q) (n2-n1)).
+elim H.elim H1. apply (witness n (p-q) (n1-n2)).
rewrite > H2.rewrite > H3.apply sym_eq.apply distr_times_minus.
qed.
theorem divides_times: \forall n,m,p,q:nat.
n \divides p \to m \divides q \to n*m \divides p*q.
intros.
-elim H.elim H1. apply (witness (n*m) (p*q) (n2*n1)).
+elim H.elim H1. apply (witness (n*m) (p*q) (n1*n2)).
rewrite > H2.rewrite > H3.
-apply (trans_eq nat ? (n*(m*(n2*n1)))).
-apply (trans_eq nat ? (n*(n2*(m*n1)))).
+apply (trans_eq nat ? (n*(m*(n1*n2)))).
+apply (trans_eq nat ? (n*(n1*(m*n2)))).
apply assoc_times.
apply eq_f.
-apply (trans_eq nat ? ((n2*m)*n1)).
+apply (trans_eq nat ? ((n1*m)*n2)).
apply sym_eq. apply assoc_times.
-rewrite > (sym_times n2 m).apply assoc_times.
+rewrite > (sym_times n1 m).apply assoc_times.
apply sym_eq. apply assoc_times.
qed.
theorem transitive_divides: transitive ? divides.
unfold.
intros.
-elim H.elim H1. apply (witness x z (n2*n)).
+elim H.elim H1. apply (witness x z (n1*n)).
rewrite > H3.rewrite > H2.
apply assoc_times.
qed.
theorem antisymmetric_divides: antisymmetric nat divides.
unfold antisymmetric.intros.elim H. elim H1.
-apply (nat_case1 n2).intro.
+apply (nat_case1 n1).intro.
rewrite > H3.rewrite > H2.rewrite > H4.
rewrite < times_n_O.reflexivity.
intros.
(* divides le *)
theorem divides_to_le : \forall n,m. O < m \to n \divides m \to n \le m.
-intros. elim H1.rewrite > H2.cut (O < n2).
-apply (lt_O_n_elim n2 Hcut).intro.rewrite < sym_times.
+intros. elim H1.rewrite > H2.cut (O < n1).
+apply (lt_O_n_elim n1 Hcut).intro.rewrite < sym_times.
simplify.rewrite < sym_plus.
apply le_plus_n.
-elim (le_to_or_lt_eq O n2).
+elim (le_to_or_lt_eq O n1).
assumption.
absurd (O<m).assumption.
rewrite > H2.rewrite < H3.rewrite < times_n_O.
intros.
elim H1.
rewrite > H2.
-rewrite > (sym_times c n2).
+rewrite > (sym_times c n1).
cut(O \lt c)
-[ rewrite > (lt_O_to_div_times n2 c)
+[ rewrite > (lt_O_to_div_times n1 c)
[ rewrite < assoc_times.
- rewrite > (lt_O_to_div_times (a *n2) c)
+ rewrite > (lt_O_to_div_times (a *n1) c)
[ reflexivity
| assumption
]