Exact expanded PA statement
forall B p a. ~(p = 0) -> ((exists qr_x_search_yes. (exists qr_bound_search_yes. qr_bound_search_yes + qr_x_search_yes = B) /\ (exists qr_u_search_yes qr_v_search_yes. qr_x_search_yes * qr_x_search_yes + p * qr_u_search_yes = a + p * qr_v_search_yes)) \/ (forall qr_x_search_no. (exists qr_bound_search_no. qr_bound_search_no + qr_x_search_no = B) -> ~(exists qr_u_search_no qr_v_search_no. qr_x_search_no * qr_x_search_no + p * qr_u_search_no = a + p * qr_v_search_no)))Structural proof guide
Generated structural guide
Inclusive bounded search constructively decides square congruence.
Use the direct prerequisites mod_eq_decidable_nonzero, add_eq_zero_right, le_eq_or_lt, add_succ_left, zero_add as previously established PA formulas.
The proof proceeds by structural induction (1), case analysis (9), intermediate claims (5), equality transport (4), certified simplification (2).
Referenced ingredients
Proof neighborhood
Direct dependencies
PA005K mod_eq_decidable_nonzero PA0004 add_eq_zero_right PA000W le_eq_or_lt PA000E add_succ_left PA0001 zero_addDirect 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
induction B - 0002
intro p - 0003
intro a - 0004
intro hp - 0005
have hdec : (exists u v. 0 * 0 + p * u = a + p * v) \/ ~(exists u v. 0 * 0 + p * u = a + p * v) - 0006
specialize mod_eq_decidable_nonzero p - 0007
specialize mod_eq_decidable_nonzero (0 * 0) - 0008
specialize mod_eq_decidable_nonzero a - 0009
apply mod_eq_decidable_nonzero - 0010
exact hp - 0011
cases hdec - 0012
left - 0013
exists 0 - 0014
split - 0015
exists 0 - 0016
simp - 0017
exact hdec_left - 0018
right - 0019
intro x - 0020
intro hx - 0021
intro hs - 0022
cases hx - 0023
have hx0 : x = 0 - 0024
specialize add_eq_zero_right x1 - 0025
specialize add_eq_zero_right x - 0026
apply add_eq_zero_right - 0027
exact hx_witness - 0028
apply hdec_right - 0029
rewrite hx0 at hs - 0030
rewrite hx0 at hs - 0031
exact hs - 0032
intro p - 0033
intro a - 0034
intro hp - 0035
have hprev : (exists x. (exists h. h + x = B) /\ exists u v. x * x + p * u = a + p * v) \/ (forall x. (exists h. h + x = B) -> ~(exists u v. x * x + p * u = a + p * v)) - 0036
specialize IH p - 0037
specialize IH a - 0038
apply IH - 0039
exact hp - 0040
cases hprev - 0041
left - 0042
cases hprev_left - 0043
cases hprev_left_witness - 0044
exists x - 0045
split - 0046
cases hprev_left_witness_left - 0047
exists S x1 - 0048
trans S (x1 + x) - 0049
apply add_succ_left - 0050
congr - 0051
exact hprev_left_witness_left_witness - 0052
exact hprev_left_witness_right - 0053
have hdec : (exists u v. (S B) * (S B) + p * u = a + p * v) \/ ~(exists u v. (S B) * (S B) + p * u = a + p * v) - 0054
specialize mod_eq_decidable_nonzero p - 0055
specialize mod_eq_decidable_nonzero ((S B) * (S B)) - 0056
specialize mod_eq_decidable_nonzero a - 0057
apply mod_eq_decidable_nonzero - 0058
exact hp - 0059
cases hdec - 0060
left - 0061
exists S B - 0062
split - 0063
exists 0 - 0064
simp - 0065
congr - 0066
specialize zero_add B - 0067
exact zero_add - 0068
exact hdec_left - 0069
right - 0070
intro x - 0071
intro hx - 0072
intro hs - 0073
specialize le_eq_or_lt x - 0074
specialize le_eq_or_lt (S B) - 0075
have hcases : x = S B \/ exists k. k + S x = S B - 0076
apply le_eq_or_lt - 0077
exact hx - 0078
cases hcases - 0079
apply hdec_right - 0080
rewrite hcases_left at hs - 0081
rewrite hcases_left at hs - 0082
exact hs - 0083
apply hprev_right - 0084
cases hcases_right - 0085
exists x1 - 0086
apply PA2 - 0087
trans x1 + S x - 0088
symm - 0089
apply PA4 - 0090
exact hcases_right_witness - 0091
exact hs