-
Notifications
You must be signed in to change notification settings - Fork 0
/
leap.v
61 lines (49 loc) · 1.21 KB
/
leap.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
(** Lemmas:
1) (m * k) divides n -> m divides n
2) pq|r = p(q|r) unless r = true, p = false
with Lemmas 1 and 2, we can prove that this is correct:
p := n mod 4 = 0
q := n mod 100 = 0
r := n mod 400 = 0
pq|r = p(q|r)
by showing that r = true, p = false is impossible.
*)
(* auxillary stuff *)
Definition divides m n := exists k, n = m * k.
Infix "divides" := divides (at level 40).
Goal 400 <> 0 /\ 4 <> 0 /\ 100 <> 0. repeat split; discriminate. Qed.
Goal forall n m,
m <> 0 -> Nat.modulo n m = 0 <-> m divides n.
Proof.
Require Import PeanoNat.
apply Nat.mod_divides.
Qed.
(* 1 *)
Require Import Mult.
Lemma mul_mod: forall k m n,
(m * k) divides n -> m divides n.
Proof.
intros k m n H.
destruct H.
exists (k * x).
rewrite H.
apply mult_assoc_reverse.
Qed.
(* 2 *)
Goal forall r p : Prop, (r -> p) -> ~(r /\ ~p).
tauto. Qed.
Lemma pqr: forall p q r: Prop,
(r -> p) -> p /\ q \/ r <-> p /\ (q \/ r).
tauto. Qed.
(* The actual proof *)
Theorem leap: forall y,
let p := 4 divides y in
let q := 100 divides y in
let r := 400 divides y in
p /\ ~q \/ r <-> p /\ (~q \/ r).
Proof.
intro y.
apply pqr.
replace 400 with (4 * 100) by reflexivity.
apply mul_mod.
Qed.