definition congruent: nat \to nat \to nat \to Prop \def
\lambda n,m,p:nat. mod n p = mod m p.
+interpretation "congruent" 'congruent n m p =
+ (cic:/matita/nat/congruence/congruent.con n m p).
+
+notation < "hvbox(n break \cong\sub p m)"
+ (*non associative*) with precedence 45
+for @{ 'congruent $n $m $p }.
+
theorem congruent_n_n: \forall n,p:nat.congruent n n p.
intros.unfold congruent.reflexivity.
qed.
apply div_mod_spec_div_mod.assumption.
constructor 1.
apply lt_mod_m_m.assumption.
+(*cut (n = r * p + (m / p * p + m \mod p)).*)
+(*lapply (div_mod m p H).
+rewrite > sym_times.
+rewrite > distr_times_plus.
+(*rewrite > (sym_times p (m/p)).*)
+(*rewrite > sym_times.*)
+rewrite > assoc_plus.
+auto paramodulation.
+rewrite < div_mod.
+assumption.
+assumption.
+*)
rewrite > sym_times.
rewrite > distr_times_plus.
rewrite > sym_times.
theorem congruent_pi: \forall f:nat \to nat. \forall n,m,p:nat.O < p \to
congruent (pi n f m) (pi n (\lambda m. mod (f m) p) m) p.
intros.
-elim n.change with (congruent (f m) (f m \mod p) p).
+elim n. simplify.
apply congruent_n_mod_n.assumption.
-change with (congruent ((f (S n1+m))*(pi n1 f m))
-(((f (S n1+m))\mod p)*(pi n1 (\lambda m.(f m) \mod p) m)) p).
+simplify.
apply congruent_times.
assumption.
apply congruent_n_mod_n.assumption.