Exact expanded PA statement
forall p n x. p = S n -> ((~(p = 1) /\ forall wsq_prime_left_prime wsq_prime_right_prime. p = wsq_prime_left_prime * wsq_prime_right_prime -> wsq_prime_left_prime = 1 \/ wsq_prime_right_prime = 1)) -> (exists wsq_positive_gap_positive. wsq_positive_gap_positive + 1 = x) -> (exists wsq_strict_gap_bounded. wsq_strict_gap_bounded + S x = p) -> (exists wsq_mod_left_square_one wsq_mod_right_square_one. x * x + p * wsq_mod_left_square_one = 1 + p * wsq_mod_right_square_one) -> x = 1 \/ x = nStructural proof guide
Generated structural guide
A bounded square root of one modulo a prime is one or the prime predecessor.
Use the direct prerequisites ne_zero_of_one_le, nonzero_is_succ, mul_succ_left, add_assoc, add_comm, add_left_cancel, factor_difference, euclid_prime_dvd_product, le_succ_self, lt_of_le_of_lt, zero_or_succ, divisor_le_nonzero, lt_not_le, succ_ne_zero, le_antisymm, succ_injective as previously established PA formulas.
The proof proceeds by case analysis (7), intermediate claims (18), equality transport (6).
Referenced ingredients
PA003U ne_zero_of_one_le PA001V nonzero_is_succ PA000G mul_succ_left PA0009 add_assoc PA000F add_comm PA002B add_left_cancel PA0013 factor_difference PA0038 euclid_prime_dvd_product PA000Q le_succ_self PA0033 lt_of_le_of_lt PA0008 zero_or_succ PA0039 divisor_le_nonzero PA003A lt_not_le PA0005 succ_ne_zero PA0069 le_antisymm PA003V succ_injectiveProof neighborhood
Direct dependencies
PA003U ne_zero_of_one_le PA001V nonzero_is_succ PA000G mul_succ_left PA0009 add_assoc PA000F add_comm PA002B add_left_cancel PA0013 factor_difference PA0038 euclid_prime_dvd_product PA000Q le_succ_self PA0033 lt_of_le_of_lt PA0008 zero_or_succ PA0039 divisor_le_nonzero PA003A lt_not_le PA0005 succ_ne_zero PA0069 le_antisymm PA003V succ_injectiveDirect dependents
Formal native tactic body
Dependencies are introduced as named hypotheses before line 1. Linked names are exact direct references. This Alpha-v16 checked-use theorem is independently kernel-checked when replayed; it is not a Stable theorem.
- 0001
intro p - 0002
intro n - 0003
intro x - 0004
intro hpn - 0005
intro hp - 0006
intro hxpos - 0007
intro hxlt - 0008
intro hsquaremod - 0009
cases hp - 0010
have hprime : (~(p = 1) /\ forall wsq_prime_left_prime wsq_prime_right_prime. p = wsq_prime_left_prime * wsq_prime_right_prime -> wsq_prime_left_prime = 1 \/ wsq_prime_right_prime = 1) - 0011
split - 0012
exact hp_left - 0013
exact hp_right - 0014
have hx0 : ~(x = 0) - 0015
specialize ne_zero_of_one_le x - 0016
intro hxzero - 0017
apply ne_zero_of_one_le - 0018
exact hxpos - 0019
exact hxzero - 0020
have hxpred : exists t. x = S t - 0021
specialize nonzero_is_succ x - 0022
apply nonzero_is_succ - 0023
exact hx0 - 0024
cases hxpred - 0025
have hsquare : x * x = 1 + x1 * S (S x1) - 0026
rewrite hxpred_witness - 0027
rewrite hxpred_witness - 0028
specialize mul_succ_left x1 - 0029
specialize mul_succ_left (S x1) - 0030
trans x1 * S x1 + S x1 - 0031
exact mul_succ_left - 0032
trans S (x1 * S x1 + x1) - 0033
apply PA4 - 0034
trans (x1 * S x1 + x1) + 1 - 0035
symm - 0036
trans S ((x1 * S x1 + x1) + 0) - 0037
apply PA4 - 0038
congr - 0039
apply PA3 - 0040
trans 1 + (x1 * S x1 + x1) - 0041
apply add_comm - 0042
congr - 0043
refl - 0044
symm - 0045
apply PA6 - 0046
cases hsquaremod - 0047
cases hsquaremod_witness - 0048
have hcancel : x1 * S (S x1) + p * x2 = p * x3 - 0049
specialize add_left_cancel 1 - 0050
specialize add_left_cancel (x1 * S (S x1) + p * x2) - 0051
specialize add_left_cancel (p * x3) - 0052
apply add_left_cancel - 0053
trans (1 + x1 * S (S x1)) + p * x2 - 0054
symm - 0055
apply add_assoc - 0056
trans x * x + p * x2 - 0057
congr - 0058
symm - 0059
exact hsquare - 0060
refl - 0061
trans 1 + p * x3 - 0062
exact hsquaremod_witness_witness - 0063
refl - 0064
have hfactor : p * x3 = p * x2 + x1 * S (S x1) - 0065
trans x1 * S (S x1) + p * x2 - 0066
symm - 0067
exact hcancel - 0068
apply add_comm - 0069
have hproduct : exists w. x1 * S (S x1) = p * w - 0070
specialize factor_difference p - 0071
specialize factor_difference x3 - 0072
specialize factor_difference x2 - 0073
specialize factor_difference (x1 * S (S x1)) - 0074
apply factor_difference - 0075
exact hfactor - 0076
have hsplit : (exists u. x1 = p * u) \/ exists v. S (S x1) = p * v - 0077
specialize euclid_prime_dvd_product p - 0078
specialize euclid_prime_dvd_product x1 - 0079
specialize euclid_prime_dvd_product (S (S x1)) - 0080
apply euclid_prime_dvd_product - 0081
exact hprime - 0082
exact hproduct - 0083
cases hsplit - 0084
have htx : exists k. k + x1 = x - 0085
rewrite hxpred_witness - 0086
specialize le_succ_self x1 - 0087
exact le_succ_self - 0088
have htp : exists k. k + S x1 = p - 0089
specialize lt_of_le_of_lt x1 - 0090
specialize lt_of_le_of_lt x - 0091
specialize lt_of_le_of_lt p - 0092
apply lt_of_le_of_lt - 0093
exact htx - 0094
exact hxlt - 0095
have htcase : x1 = 0 \/ exists t. x1 = S t - 0096
specialize zero_or_succ x1 - 0097
exact zero_or_succ - 0098
cases htcase - 0099
left - 0100
trans S x1 - 0101
exact hxpred_witness - 0102
rewrite htcase_left - 0103
refl - 0104
cases htcase_right - 0105
have ht0 : ~(x1 = 0) - 0106
intro htzero - 0107
rewrite htcase_right_witness at htzero - 0108
apply PA1 - 0109
exact htzero - 0110
have hpt : exists k. k + p = x1 - 0111
specialize divisor_le_nonzero p - 0112
specialize divisor_le_nonzero x1 - 0113
apply divisor_le_nonzero - 0114
exact ht0 - 0115
exact hsplit_left - 0116
exfalso - 0117
specialize lt_not_le x1 - 0118
specialize lt_not_le p - 0119
apply lt_not_le - 0120
exact htp - 0121
exact hpt - 0122
right - 0123
have hfactor0 : ~(S (S x1) = 0) - 0124
specialize succ_ne_zero (S x1) - 0125
exact succ_ne_zero - 0126
have hpfactor : exists k. k + p = S (S x1) - 0127
specialize divisor_le_nonzero p - 0128
specialize divisor_le_nonzero (S (S x1)) - 0129
apply divisor_le_nonzero - 0130
exact hfactor0 - 0131
exact hsplit_right - 0132
have hfactorp : exists k. k + S (S x1) = p - 0133
rewrite <- hxpred_witness - 0134
exact hxlt - 0135
have hpeq : p = S (S x1) - 0136
specialize le_antisymm p - 0137
specialize le_antisymm (S (S x1)) - 0138
apply le_antisymm - 0139
exact hpfactor - 0140
exact hfactorp - 0141
have hpred_eq : S x1 = n - 0142
specialize succ_injective (S x1) - 0143
specialize succ_injective n - 0144
apply succ_injective - 0145
trans p - 0146
symm - 0147
exact hpeq - 0148
exact hpn - 0149
trans S x1 - 0150
exact hxpred_witness - 0151
exact hpred_eq