#|
Copyright (C) 1994 by David Russinoff.  All Rights Reserved.
You may copy and distribute verbatim copies of this Nqthm-1992 event script as
you receive it, in any medium, including embedding it verbatim in derivative
works, provided that you conspicuously and appropriately publish on each copy
a valid copyright notice "Copyright (C) 1994 by David Russinoff.  All Rights
Reserved."
NO WARRANTY
David Russinoff PROVIDES ABSOLUTELY NO WARRANTY.  THE EVENT SCRIPT IS
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE SCRIPT IS WITH YOU.  SHOULD THE SCRIPT PROVE DEFECTIVE, YOU
ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
IN NO EVENT WILL David Russinoff BE LIABLE TO YOU FOR ANY DAMAGES,
ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THIS SCRIPT (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
SUSTAINED BY THIRD PARTIES), EVEN IF YOU HAVE ADVISED US OF THE POSSIBILITY OF
SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
|#
; Work of David Russinoff.

Event: Start with the library "rsa" using the compiled version.

Event: For efficiency, compile those definitions not yet compiled.

Definition: inverse (j , p) = if p = 2 then j mod 2

else exp (j , p − 2) mod p endif

Theorem: inverse-inverts-lemma (p ≄ 0) → (((inverse (j , p) ∗ j ) mod p) = (exp (j , p − 1) mod p))

Theorem: inverse-inverts (prime (p) ∧ ((j mod p) ≠ 0)) → (((inverse (j , p) ∗ j ) mod p) = 1)

Theorem: inverse-is-unique (prime (p) ∧ (1 = ((m ∗ x) mod p))) → (inverse (m, p) = (x mod p))

Theorem: s-p-i-i-lemma1 ((n ≄ 0) ∧ (n ≠ 1)) → (((n − 1) ∗ (n − 1)) = (1 + (n ∗ ((n − 1) − 1))))

Theorem: s-p-i-i-lemma2 ((n ≄ 0) ∧ (n ≠ 1)) → ((((n − 1) ∗ (n − 1)) mod n) = 1)

Theorem: sub1-p-is-involution prime (p) → (inverse (p − 1, p) = (p − 1))

Theorem: n-o-i-lemma1 ((x ∗ x) − 1) = ((1 + x) ∗ (x − 1))

Theorem: n-o-i-lemma2 (prime (p) ∧ ((((j ∗ j ) − 1) mod p) = 0)) → ((((1 + j ) mod p) = 0) ∨ (((j − 1) mod p) = 0))

Theorem: n-o-i-lemma3 ((a ≮ 1) ∧ ((a mod p) = 1)) → (((a − 1) mod p) = 0)

Theorem: n-o-i-lemma4 (prime (p) ∧ ((j mod p) ≠ 0) ∧ (inverse (j , p) = j )) → ((((1 + j ) mod p) = 0) ∨ (((j − 1) mod p) = 0))

Theorem: no-other-involutions (prime (p) ∧ (j < (p − 1)) ∧ (1 < j )) → (inverse (j , p) ≠ j )

Theorem: i-o-i-lemma (((p − 2) ∗ (p − 2)) − 1) = ((p − 3) ∗ (p − 1))

Theorem: inverse-of-inverse (prime (p) ∧ ((j mod p) ≠ 0)) → (inverse (inverse (j , p), p) = (j mod p))

Theorem: n-z-i-lemma ((i ≃ 0) ∧ (1 < p)) → (inverse (i, p) = 0)

Theorem: non-zerop-inverse (prime (p) ∧ ((j mod p) ≠ 0)) → (inverse (j , p) ≄ 0)

Theorem: b-i-lemma2 (prime (p) ∧ ((j mod p) ≠ 0) ∧ (inverse (j , p) = (p − 1))) → ((j mod p) = (p − 1))

Theorem: b-i-lemma1 (1 < p) → (inverse (j , p) ≤ (p − 1))

Theorem: bounded-inverse (prime (p) ∧ (j < (p − 1))) → (inverse (j , p) < (p − 1))

Definition: inverse-list (i, p) = if i ≃ 0 then nil

elseif i = 1 then cons (1, nil)

elseif i ∈ inverse-list (i − 1, p) then inverse-list (i − 1, p) else cons (i, cons (inverse (i, p), inverse-list (i − 1, p))) endif

Theorem: all-non-zerop-inverse-list (prime (p) ∧ (i < (p − 1))) → all-non-zerop (inverse-list (i, p))

Theorem: bounded-inverse-list (prime (p) ∧ (i < (p − 1)) ∧ (j = (p − 2))) → all-lesseqp (inverse-list (i, p), j )

Theorem: subsetp-positives subsetp (positives (n), inverse-list (n, p))

Theorem: inverse-1 (1 < p) → (inverse (1, p) = 1)

Theorem: a-d-i-l-lemma1 (prime (p) ∧ ((i mod p) ≠ 0) ∧ (i < p) ∧ (j ∈ inverse-list (i, p))) → (inverse (j , p) ∈ inverse-list (i, p))

Theorem: a-d-i-l-lemma2 (prime (p) ∧ ((i mod p) ≠ 0) ∧ ((j mod p) ≠ 0) ∧ (i < p) ∧ (j < p) ∧ (inverse (j , p) ∈ inverse-list (i, p))) → (j ∈ inverse-list (i, p))

Theorem: a-d-i-l-lemma3 (prime (p) ∧ (i < (p − 1)) ∧ all-distinct (inverse-list (i − 1, p))) → all-distinct (inverse-list (i, p))

Theorem: all-distinct-inverse-list (prime (p) ∧ (i < (p − 1))) → all-distinct (inverse-list (i, p))

Theorem: t-i-l-lemma1 (((a ∗ b) mod p) = 1) → (((a ∗ (b ∗ c)) mod p) = (c mod p))

Theorem: t-i-l-lemma (((i ∗ inverse (i, p)) mod p) = 1) → ((times-list (inverse-list (i, p)) mod p)

= (times-list (inverse-list (i − 1, p)) mod p))

Theorem: t-i-l-lemma3 (prime (p) ∧ ((i mod p) ≠ 0)) → ((times-list (inverse-list (i, p)) mod p)

= (times-list (inverse-list (i − 1, p)) mod p))

Theorem: t-i-l-lemma4 (i ≤ 1) → (times-list (inverse-list (i, p)) = 1)

Theorem: times-inverse-list (prime (p) ∧ (i < p)) → ((times-list (inverse-list (i, p)) mod p) = 1)

Theorem: delete-x-leave-a ((a ∈ s) ∧ (a ≠ x)) → (a ∈ delete (x, s))

Theorem: delete-member-leave-subset (subsetp (r, s) ∧ (x ∉ r)) → subsetp (r, delete (x, s))

Theorem: all-lesseqp-delete (all-distinct (l) ∧ all-lesseqp (l, n)) → all-lesseqp (delete (n, l), n − 1)

Theorem: positives-bounded (n < m) → (m ∉ positives (n))

Theorem: subsetp-positives-delete subsetp (positives (n), l) → subsetp (positives (n − 1), delete (n, l))

Theorem: nonzerop-lesseqp-zero ((n ≃ 0) ∧ all-lesseqp (l, n) ∧ all-non-zerop (l)) → (¬ listp (l))

Definition: pigeonhole2-induction (l, n) = if n ≃ 0 then t

else pigeonhole2-induction (delete (n, l), n − 1) endif

Theorem: pigeonhole2 (all-distinct (l) ∧ all-non-zerop (l) ∧ all-lesseqp (l, n) ∧ subsetp (positives (n), l)) → perm (positives (n), l)

Theorem: perm-positives-inverse-list (prime (p) ∧ (i = (p − 2))) → perm (positives (i), inverse-list (i, p))

Theorem: inverse-list-fact (prime (p) ∧ (i = (p − 2))) → (times-list (inverse-list (i, p)) = fact (i))

Theorem: w-t-lemma (prime (p) ∧ (i = (p − 2))) → ((fact (i) mod p) = 1)

Theorem: wilson-thm prime (p) → ((fact (p − 1) mod p) = (p − 1))

Event: Make the library "wilson" and compile it.

Index

a-d-i-l-lemma1, 3 a-d-i-l-lemma2, 3 a-d-i-l-lemma3, 3 all-distinct, 3, 4 all-distinct-inverse-list, 3 all-lesseqp, 3, 4 all-lesseqp-delete, 4 all-non-zerop, 3, 4 all-non-zerop-inverse-list, 3

b-i-lemma1, 3 b-i-lemma2, 2 bounded-inverse, 3 bounded-inverse-list, 3

delete, 4 delete-member-leave-subset, 4 delete-x-leave-a, 4

exp, 1

fact, 5

i-o-i-lemma, 2 inverse, 1–4 inverse-1, 3 inverse-inverts, 1 inverse-inverts-lemma, 1 inverse-is-unique, 2 inverse-list, 3–5 inverse-list-fact, 5 inverse-of-inverse, 2

n-o-i-lemma1, 2 n-o-i-lemma2, 2 n-o-i-lemma3, 2 n-o-i-lemma4, 2 n-z-i-lemma, 2 no-other-involutions, 2 non-zerop-inverse, 2 nonzerop-lesseqp-zero, 4 perm, 4, 5 perm-positives-inverse-list, 5 pigeonhole2, 4 pigeonhole2-induction, 4 positives, 3–5 positives-bounded, 4 prime, 1–5

s-p-i-i-lemma1, 2 s-p-i-i-lemma2, 2 sub1-p-is-involution, 2 subsetp, 3, 4 subsetp-positives, 3 subsetp-positives-delete, 4

t-i-l-lemma, 4 t-i-l-lemma1, 4 t-i-l-lemma3, 4 t-i-l-lemma4, 4 times-inverse-list, 4 times-list, 4, 5

w-t-lemma, 5 wilson-thm, 5