proposition: Theorem flt : forall (a : Z) (p : nat), Prime p -> ~ Mod a 0 p -> Mod (Exp a (pred p)) 1 p.
proof: Proof. intros. apply mod_sym. apply mod_mult_cancel_r with (zproduct (until (pred p))). assumption. apply until_prod_not_0mod. assumption. rewrite <- until_mapmult_exp. rewrite Zmult_1_l. apply permmod_product. apply until_mapmult_permmod. assumption. assumption. Qed.
imports: Arith ZArith lemmas natZ dec list exp divides prime modulo modprime