Exact expanded PA statement
forall b c z d n sn i x y. sn = S n -> (exists h. h + S i = n) -> (((exists ff_h_swap_surj_old_i. ff_h_swap_surj_old_i + S (x) = S ((S (i)) * c)) /\ exists ff_q_swap_surj_old_i. b = ff_q_swap_surj_old_i * S ((S (i)) * c) + (x))) -> (((exists ff_h_swap_surj_old_n. ff_h_swap_surj_old_n + S (y) = S ((S (n)) * c)) /\ exists ff_q_swap_surj_old_n. b = ff_q_swap_surj_old_n * S ((S (n)) * c) + (y))) -> (((exists ff_h_swap_surj_new_i. ff_h_swap_surj_new_i + S (y) = S ((S (i)) * d)) /\ exists ff_q_swap_surj_new_i. z = ff_q_swap_surj_new_i * S ((S (i)) * d) + (y))) -> (((exists ff_h_swap_surj_new_n. ff_h_swap_surj_new_n + S (x) = S ((S (n)) * d)) /\ exists ff_q_swap_surj_new_n. z = ff_q_swap_surj_new_n * S ((S (n)) * d) + (x))) -> (forall j a. (exists h. h + S j = S n) -> ~(j = i) -> ~(j = n) -> (((exists ff_h_swap_surj_old_j. ff_h_swap_surj_old_j + S (a) = S ((S (j)) * c)) /\ exists ff_q_swap_surj_old_j. b = ff_q_swap_surj_old_j * S ((S (j)) * c) + (a))) -> (((exists ff_h_swap_surj_new_j. ff_h_swap_surj_new_j + S (a) = S ((S (j)) * d)) /\ exists ff_q_swap_surj_new_j. z = ff_q_swap_surj_new_j * S ((S (j)) * d) + (a)))) -> (forall fp_value_swap_surj_new. (exists fp_gap_swap_surj_new_value. fp_gap_swap_surj_new_value + S fp_value_swap_surj_new = sn) -> exists fp_i_swap_surj_new. ((exists fp_gap_swap_surj_new_index. fp_gap_swap_surj_new_index + S fp_i_swap_surj_new = sn) /\ (((exists ff_h_swap_surj_new_entry. ff_h_swap_surj_new_entry + S (fp_value_swap_surj_new) = S ((S (fp_i_swap_surj_new)) * d)) /\ exists ff_q_swap_surj_new_entry. z = ff_q_swap_surj_new_entry * S ((S (fp_i_swap_surj_new)) * d) + (fp_value_swap_surj_new))))) -> (forall fp_value_swap_surj_old. (exists fp_gap_swap_surj_old_value. fp_gap_swap_surj_old_value + S fp_value_swap_surj_old = sn) -> exists fp_i_swap_surj_old. ((exists fp_gap_swap_surj_old_index. fp_gap_swap_surj_old_index + S fp_i_swap_surj_old = sn) /\ (((exists ff_h_swap_surj_old_entry. ff_h_swap_surj_old_entry + S (fp_value_swap_surj_old) = S ((S (fp_i_swap_surj_old)) * c)) /\ exists ff_q_swap_surj_old_entry. b = ff_q_swap_surj_old_entry * S ((S (fp_i_swap_surj_old)) * c) + (fp_value_swap_surj_old)))))Structural proof guide
Generated structural guide
Surjectivity of a swapped successor prefix transports back to the original code.
Use the direct prerequisites beta_prefix_swap_last_reflect, le_succ, le_refl as previously established PA formulas.
The proof proceeds by case analysis (8), intermediate claims (6), equality transport (8).
Referenced ingredients
Proof neighborhood
Direct dependencies
Direct 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 b - 0002
intro c - 0003
intro z - 0004
intro d - 0005
intro n - 0006
intro sn - 0007
intro i - 0008
intro x - 0009
intro y - 0010
intro hsn - 0011
intro hi - 0012
intro hold_i - 0013
intro hold_n - 0014
intro hnew_i - 0015
intro hnew_n - 0016
intro hpreserve - 0017
intro hsurjective - 0018
rewrite hsn at hsurjective - 0019
rewrite hsn at hsurjective - 0020
have hisn : exists h. h + S i = S n - 0021
specialize le_succ (S i) - 0022
specialize le_succ n - 0023
apply le_succ - 0024
exact hi - 0025
have hnsn : exists h. h + S n = S n - 0026
specialize le_refl (S n) - 0027
exact le_refl - 0028
have hreflect : forall b c z d n i x y. (((exists ff_h_reflect_new_i. ff_h_reflect_new_i + S (y) = S ((S (i)) * d)) /\ exists ff_q_reflect_new_i. z = ff_q_reflect_new_i * S ((S (i)) * d) + (y))) -> (((exists ff_h_reflect_new_n. ff_h_reflect_new_n + S (x) = S ((S (n)) * d)) /\ exists ff_q_reflect_new_n. z = ff_q_reflect_new_n * S ((S (n)) * d) + (x))) -> (forall k v. (exists h. h + S k = S n) -> ~(k = i) -> ~(k = n) -> (((exists ff_h_reflect_old_k. ff_h_reflect_old_k + S (v) = S ((S (k)) * c)) /\ exists ff_q_reflect_old_k. b = ff_q_reflect_old_k * S ((S (k)) * c) + (v))) -> (((exists ff_h_reflect_new_k. ff_h_reflect_new_k + S (v) = S ((S (k)) * d)) /\ exists ff_q_reflect_new_k. z = ff_q_reflect_new_k * S ((S (k)) * d) + (v)))) -> forall j a. (exists h. h + S j = S n) -> (((exists ff_h_reflect_new_j. ff_h_reflect_new_j + S (a) = S ((S (j)) * d)) /\ exists ff_q_reflect_new_j. z = ff_q_reflect_new_j * S ((S (j)) * d) + (a))) -> ((j = i /\ a = y) \/ ((j = n /\ a = x) \/ (~(j = i) /\ (~(j = n) /\ (((exists ff_h_reflect_old_j. ff_h_reflect_old_j + S (a) = S ((S (j)) * c)) /\ exists ff_q_reflect_old_j. b = ff_q_reflect_old_j * S ((S (j)) * c) + (a))))))) - 0029
exact beta_prefix_swap_last_reflect - 0030
specialize hreflect b - 0031
specialize hreflect c - 0032
specialize hreflect z - 0033
specialize hreflect d - 0034
specialize hreflect n - 0035
specialize hreflect i - 0036
specialize hreflect x - 0037
specialize hreflect y - 0038
have hreflect_entries : forall j a. (exists h. h + S j = S n) -> ((exists h. h + S a = S ((S j) * d)) /\ exists q. z = q * S ((S j) * d) + a) -> ((j = i /\ a = y) \/ ((j = n /\ a = x) \/ (~(j = i) /\ (~(j = n) /\ ((exists h. h + S a = S ((S j) * c)) /\ exists q. b = q * S ((S j) * c) + a))))) - 0039
apply hreflect - 0040
exact hnew_i - 0041
exact hnew_n - 0042
exact hpreserve - 0043
rewrite hsn - 0044
rewrite hsn - 0045
intro a - 0046
intro ha - 0047
specialize hsurjective a - 0048
have hoccurs : exists j. ((exists h. h + S j = S n) /\ ((exists h. h + S a = S ((S j) * d)) /\ exists q. z = q * S ((S j) * d) + a)) - 0049
apply hsurjective - 0050
exact ha - 0051
cases hoccurs - 0052
cases hoccurs_witness - 0053
specialize hreflect_entries x1 - 0054
specialize hreflect_entries a - 0055
have hsource : ((x1 = i /\ a = y) \/ ((x1 = n /\ a = x) \/ (~(x1 = i) /\ (~(x1 = n) /\ ((exists h. h + S a = S ((S x1) * c)) /\ exists q. b = q * S ((S x1) * c) + a))))) - 0056
apply hreflect_entries - 0057
exact hoccurs_witness_left - 0058
exact hoccurs_witness_right - 0059
cases hsource - 0060
cases hsource_left - 0061
exists n - 0062
split - 0063
exact hnsn - 0064
rewrite hsource_left_right - 0065
rewrite hsource_left_right - 0066
exact hold_n - 0067
cases hsource_right - 0068
cases hsource_right_left - 0069
exists i - 0070
split - 0071
exact hisn - 0072
rewrite hsource_right_left_right - 0073
rewrite hsource_right_left_right - 0074
exact hold_i - 0075
cases hsource_right_right - 0076
cases hsource_right_right_right - 0077
exists x1 - 0078
split - 0079
exact hoccurs_witness_left - 0080
exact hsource_right_right_right_right