Exact expanded PA statement
forall p a. ((~(p = 1) /\ forall qrbu_factor_left_prime_p qrbu_factor_right_prime_p. p = qrbu_factor_left_prime_p * qrbu_factor_right_prime_p -> qrbu_factor_left_prime_p = 1 \/ qrbu_factor_right_prime_p = 1)) -> ~(a = 0) -> (exists qrbu_gap_a_lt_p. qrbu_gap_a_lt_p + S a = p) -> (exists qrbu_inverse_bounded_inverse. (~(qrbu_inverse_bounded_inverse = 0) /\ ((exists qrbu_gap_bounded_inverse_bound. qrbu_gap_bounded_inverse_bound + S qrbu_inverse_bounded_inverse = p) /\ (exists qrbu_mod_left_bounded_inverse_mod qrbu_mod_right_bounded_inverse_mod. a * qrbu_inverse_bounded_inverse + p * qrbu_mod_left_bounded_inverse_mod = 1 + p * qrbu_mod_right_bounded_inverse_mod))))Structural proof guide
Generated structural guide
A nonzero residue below a prime has a nonzero bounded inverse.
Use the direct prerequisites prime_is_succ_succ, prime_nonzero, divisor_le_nonzero, lt_not_le, prime_mod_inverse, division_remainder_exists, mul_comm, remainder_decomposition_to_mod_eq, mod_eq_mul_left, mod_eq_symm, mod_eq_trans, mod_eq_bounded_unique, succ_ne_zero as previously established PA formulas.
The proof proceeds by case analysis (9), intermediate claims (16), equality transport (2), certified simplification (2).
Referenced ingredients
PA0061 prime_is_succ_succ PA0031 prime_nonzero PA0039 divisor_le_nonzero PA003A lt_not_le PA0062 prime_mod_inverse PA001D division_remainder_exists PA000H mul_comm PA003C remainder_decomposition_to_mod_eq PA0020 mod_eq_mul_left PA003L mod_eq_symm PA0024 mod_eq_trans PA002U mod_eq_bounded_unique PA0005 succ_ne_zeroProof neighborhood
Direct dependencies
PA0061 prime_is_succ_succ PA0031 prime_nonzero PA0039 divisor_le_nonzero PA003A lt_not_le PA0062 prime_mod_inverse PA001D division_remainder_exists PA000H mul_comm PA003C remainder_decomposition_to_mod_eq PA0020 mod_eq_mul_left PA003L mod_eq_symm PA0024 mod_eq_trans PA002U mod_eq_bounded_unique PA0005 succ_ne_zeroDirect dependents
Formal native tactic body
Dependencies are introduced as named hypotheses before line 1. Linked names are exact direct references. This Stable checked-use theorem is independently kernel-checked when replayed.
- 0001
intro p - 0002
intro a - 0003
intro hp - 0004
intro ha0 - 0005
intro hap - 0006
have hp0 : ~(p = 0) - 0007
intro hpzero - 0008
specialize prime_nonzero p - 0009
apply prime_nonzero - 0010
exact hp - 0011
exact hpzero - 0012
have hnotdiv : ~(exists k. a = p * k) - 0013
intro hdiv - 0014
have hpa : exists t. t + p = a - 0015
specialize divisor_le_nonzero p - 0016
specialize divisor_le_nonzero a - 0017
apply divisor_le_nonzero - 0018
exact ha0 - 0019
exact hdiv - 0020
specialize lt_not_le a - 0021
specialize lt_not_le p - 0022
apply lt_not_le - 0023
exact hap - 0024
exact hpa - 0025
have hinv : exists z u v. a * z + p * u = 1 + p * v - 0026
specialize prime_mod_inverse p - 0027
specialize prime_mod_inverse a - 0028
apply prime_mod_inverse - 0029
exact hp - 0030
exact hnotdiv - 0031
cases hinv - 0032
cases hinv_witness - 0033
cases hinv_witness_witness - 0034
have hdivz : exists q r. x = p * q + r /\ exists h. h + S r = p - 0035
specialize division_remainder_exists p - 0036
specialize division_remainder_exists x - 0037
apply division_remainder_exists - 0038
exact hp0 - 0039
cases hdivz - 0040
cases hdivz_witness - 0041
cases hdivz_witness_witness - 0042
have hzdecomp : x = x3 * p + x4 - 0043
trans p * x3 + x4 - 0044
exact hdivz_witness_witness_left - 0045
congr - 0046
apply mul_comm - 0047
refl - 0048
have hzr : exists u v. x + p * u = x4 + p * v - 0049
specialize remainder_decomposition_to_mod_eq p - 0050
specialize remainder_decomposition_to_mod_eq x - 0051
specialize remainder_decomposition_to_mod_eq x3 - 0052
specialize remainder_decomposition_to_mod_eq x4 - 0053
apply remainder_decomposition_to_mod_eq - 0054
exact hzdecomp - 0055
have hscaled : exists u v. (a * x) + p * u = (a * x4) + p * v - 0056
specialize mod_eq_mul_left p - 0057
specialize mod_eq_mul_left x - 0058
specialize mod_eq_mul_left x4 - 0059
specialize mod_eq_mul_left a - 0060
apply mod_eq_mul_left - 0061
exact hzr - 0062
have hrz : exists u v. (a * x4) + p * u = (a * x) + p * v - 0063
specialize mod_eq_symm p - 0064
specialize mod_eq_symm (a * x) - 0065
specialize mod_eq_symm (a * x4) - 0066
apply mod_eq_symm - 0067
exact hscaled - 0068
have hfinal : exists u v. (a * x4) + p * u = 1 + p * v - 0069
specialize mod_eq_trans p - 0070
specialize mod_eq_trans (a * x4) - 0071
specialize mod_eq_trans (a * x) - 0072
specialize mod_eq_trans 1 - 0073
apply mod_eq_trans - 0074
exact hrz - 0075
exists x1 - 0076
exists x2 - 0077
exact hinv_witness_witness_witness - 0078
have hp2 : exists k. p = S (S k) - 0079
specialize prime_is_succ_succ p - 0080
apply prime_is_succ_succ - 0081
exact hp - 0082
cases hp2 - 0083
have h0bound : exists h. h + S 0 = p - 0084
exists S x5 - 0085
rewrite hp2_witness - 0086
simp - 0087
have h1bound : exists h. h + S 1 = p - 0088
exists x5 - 0089
rewrite hp2_witness - 0090
simp - 0091
have hr0 : ~(x4 = 0) - 0092
intro hrzero - 0093
have hzeroone : exists u v. 0 + p * u = 1 + p * v - 0094
cases hfinal - 0095
cases hfinal_witness - 0096
exists x6 - 0097
exists x7 - 0098
trans (a * x4) + p * x6 - 0099
congr - 0100
symm - 0101
trans a * 0 - 0102
congr - 0103
refl - 0104
exact hrzero - 0105
apply PA5 - 0106
refl - 0107
exact hfinal_witness_witness - 0108
have hzeroeqone : 0 = 1 - 0109
specialize mod_eq_bounded_unique p - 0110
specialize mod_eq_bounded_unique 0 - 0111
specialize mod_eq_bounded_unique 1 - 0112
apply mod_eq_bounded_unique - 0113
exact h0bound - 0114
exact h1bound - 0115
exact hzeroone - 0116
specialize succ_ne_zero 0 - 0117
apply succ_ne_zero - 0118
symm - 0119
exact hzeroeqone - 0120
exists x4 - 0121
split - 0122
exact hr0 - 0123
split - 0124
exact hdivz_witness_witness_right - 0125
exact hfinal