BA0048

continued_fraction_terminal_convergent_is_exact

Every actual terminal convergent has zero cross-product error; the best-approximation theorem does not exclude this rational endpoint.

Alpha v34 checked-use · first admitted v29 · independently kernel and Lean verified; not Stable

Current library: Alpha v34, 4,223 checked-use theorems; Stable remains 432. Historical first admissions, original proof editions, and non-admitted aliases are preserved. Exact original first-admission records.

The initial 0/1 convergent is included: u is natural, not necessarily positive. Comparison denominators are strictly smaller and positive. Signed competitors are represented by an arbitrary difference rp−rn. Approximation inequalities are proved from the trace, never stored as assumptions in Convergent.

Exact theorem in conservative defined notation

∀ a. ∀ b. ∀ s. ∀ h. ∀ e. ∀ k. ∀ u. ∀ v. ContinuedFractionTrace(a,b,s,h,e,S k)Convergent(s,k,u,v) → a · v = b · u

Every linked abbreviation expands hygienically to the identical original native formula.

Definition DAG

Actual proof prerequisites

Original expanded first-order statement
forall a b s h e k u v. (exists cf_gcd_terminal_history. ((((exists ff_h_cf_terminal_history_initial_state. ff_h_cf_terminal_history_initial_state + S (((cf_gcd_terminal_history) + (((0) + (0)) * S ((0) + (0)) + ((0) + (0)))) * S ((cf_gcd_terminal_history) + (((0) + (0)) * S ((0) + (0)) + ((0) + (0)))) + ((((0) + (0)) * S ((0) + (0)) + ((0) + (0))) + (((0) + (0)) * S ((0) + (0)) + ((0) + (0))))) = S ((S (0)) * e)) /\ exists ff_q_cf_terminal_history_initial_state. h = ff_q_cf_terminal_history_initial_state * S ((S (0)) * e) + (((cf_gcd_terminal_history) + (((0) + (0)) * S ((0) + (0)) + ((0) + (0)))) * S ((cf_gcd_terminal_history) + (((0) + (0)) * S ((0) + (0)) + ((0) + (0)))) + ((((0) + (0)) * S ((0) + (0)) + ((0) + (0))) + (((0) + (0)) * S ((0) + (0)) + ((0) + (0))))))) /\ ((((exists ff_h_cf_terminal_history_terminal_state. ff_h_cf_terminal_history_terminal_state + S (((a) + (((b) + (s)) * S ((b) + (s)) + ((s) + (s)))) * S ((a) + (((b) + (s)) * S ((b) + (s)) + ((s) + (s)))) + ((((b) + (s)) * S ((b) + (s)) + ((s) + (s))) + (((b) + (s)) * S ((b) + (s)) + ((s) + (s))))) = S ((S (S k)) * e)) /\ exists ff_q_cf_terminal_history_terminal_state. h = ff_q_cf_terminal_history_terminal_state * S ((S (S k)) * e) + (((a) + (((b) + (s)) * S ((b) + (s)) + ((s) + (s)))) * S ((a) + (((b) + (s)) * S ((b) + (s)) + ((s) + (s)))) + ((((b) + (s)) * S ((b) + (s)) + ((s) + (s))) + (((b) + (s)) * S ((b) + (s)) + ((s) + (s))))))) /\ forall cf_index_terminal_history. (exists ff_lt_cf_terminal_history_index. ff_lt_cf_terminal_history_index + S cf_index_terminal_history = S k) -> exists cf_old_a_terminal_history cf_old_b_terminal_history cf_tail_terminal_history cf_new_a_terminal_history cf_new_b_terminal_history cf_head_terminal_history cf_quotient_terminal_history. ((((exists ff_h_cf_terminal_history_previous_state. ff_h_cf_terminal_history_previous_state + S (((cf_old_a_terminal_history) + (((cf_old_b_terminal_history) + (cf_tail_terminal_history)) * S ((cf_old_b_terminal_history) + (cf_tail_terminal_history)) + ((cf_tail_terminal_history) + (cf_tail_terminal_history)))) * S ((cf_old_a_terminal_history) + (((cf_old_b_terminal_history) + (cf_tail_terminal_history)) * S ((cf_old_b_terminal_history) + (cf_tail_terminal_history)) + ((cf_tail_terminal_history) + (cf_tail_terminal_history)))) + ((((cf_old_b_terminal_history) + (cf_tail_terminal_history)) * S ((cf_old_b_terminal_history) + (cf_tail_terminal_history)) + ((cf_tail_terminal_history) + (cf_tail_terminal_history))) + (((cf_old_b_terminal_history) + (cf_tail_terminal_history)) * S ((cf_old_b_terminal_history) + (cf_tail_terminal_history)) + ((cf_tail_terminal_history) + (cf_tail_terminal_history))))) = S ((S (cf_index_terminal_history)) * e)) /\ exists ff_q_cf_terminal_history_previous_state. h = ff_q_cf_terminal_history_previous_state * S ((S (cf_index_terminal_history)) * e) + (((cf_old_a_terminal_history) + (((cf_old_b_terminal_history) + (cf_tail_terminal_history)) * S ((cf_old_b_terminal_history) + (cf_tail_terminal_history)) + ((cf_tail_terminal_history) + (cf_tail_terminal_history)))) * S ((cf_old_a_terminal_history) + (((cf_old_b_terminal_history) + (cf_tail_terminal_history)) * S ((cf_old_b_terminal_history) + (cf_tail_terminal_history)) + ((cf_tail_terminal_history) + (cf_tail_terminal_history)))) + ((((cf_old_b_terminal_history) + (cf_tail_terminal_history)) * S ((cf_old_b_terminal_history) + (cf_tail_terminal_history)) + ((cf_tail_terminal_history) + (cf_tail_terminal_history))) + (((cf_old_b_terminal_history) + (cf_tail_terminal_history)) * S ((cf_old_b_terminal_history) + (cf_tail_terminal_history)) + ((cf_tail_terminal_history) + (cf_tail_terminal_history))))))) /\ ((((exists ff_h_cf_terminal_history_following_state. ff_h_cf_terminal_history_following_state + S (((cf_new_a_terminal_history) + (((cf_new_b_terminal_history) + (cf_head_terminal_history)) * S ((cf_new_b_terminal_history) + (cf_head_terminal_history)) + ((cf_head_terminal_history) + (cf_head_terminal_history)))) * S ((cf_new_a_terminal_history) + (((cf_new_b_terminal_history) + (cf_head_terminal_history)) * S ((cf_new_b_terminal_history) + (cf_head_terminal_history)) + ((cf_head_terminal_history) + (cf_head_terminal_history)))) + ((((cf_new_b_terminal_history) + (cf_head_terminal_history)) * S ((cf_new_b_terminal_history) + (cf_head_terminal_history)) + ((cf_head_terminal_history) + (cf_head_terminal_history))) + (((cf_new_b_terminal_history) + (cf_head_terminal_history)) * S ((cf_new_b_terminal_history) + (cf_head_terminal_history)) + ((cf_head_terminal_history) + (cf_head_terminal_history))))) = S ((S (S cf_index_terminal_history)) * e)) /\ exists ff_q_cf_terminal_history_following_state. h = ff_q_cf_terminal_history_following_state * S ((S (S cf_index_terminal_history)) * e) + (((cf_new_a_terminal_history) + (((cf_new_b_terminal_history) + (cf_head_terminal_history)) * S ((cf_new_b_terminal_history) + (cf_head_terminal_history)) + ((cf_head_terminal_history) + (cf_head_terminal_history)))) * S ((cf_new_a_terminal_history) + (((cf_new_b_terminal_history) + (cf_head_terminal_history)) * S ((cf_new_b_terminal_history) + (cf_head_terminal_history)) + ((cf_head_terminal_history) + (cf_head_terminal_history)))) + ((((cf_new_b_terminal_history) + (cf_head_terminal_history)) * S ((cf_new_b_terminal_history) + (cf_head_terminal_history)) + ((cf_head_terminal_history) + (cf_head_terminal_history))) + (((cf_new_b_terminal_history) + (cf_head_terminal_history)) * S ((cf_new_b_terminal_history) + (cf_head_terminal_history)) + ((cf_head_terminal_history) + (cf_head_terminal_history))))))) /\ (cf_new_b_terminal_history = cf_old_a_terminal_history /\ (cf_new_a_terminal_history = cf_new_b_terminal_history * cf_quotient_terminal_history + cf_old_b_terminal_history /\ ((exists ff_lt_cf_terminal_history_remainder. ff_lt_cf_terminal_history_remainder + S cf_old_b_terminal_history = cf_new_b_terminal_history) /\ (cf_head_terminal_history = S ((cf_quotient_terminal_history + cf_tail_terminal_history) * S (cf_quotient_terminal_history + cf_tail_terminal_history) + (cf_tail_terminal_history + cf_tail_terminal_history))))))))))) -> (exists cfc_previous_numerator_terminal_convergent cfc_previous_denominator_terminal_convergent cfc_code_terminal_convergent cfc_scale_terminal_convergent. ((~(v = 0)) /\ (exists cfc_tail_terminal_convergentcomputation. ((exists cfc_state_terminal_convergentcomputationinitial. ((exists cfc_left_terminal_convergentcomputationinitialcode cfc_right_terminal_convergentcomputationinitialcode cfc_matrix_terminal_convergentcomputationinitialcode. ((cfc_left_terminal_convergentcomputationinitialcode = ((1) + (0)) * S ((1) + (0)) + ((0) + (0))) /\ ((cfc_right_terminal_convergentcomputationinitialcode = ((0) + (1)) * S ((0) + (1)) + ((1) + (1))) /\ ((cfc_matrix_terminal_convergentcomputationinitialcode = ((cfc_left_terminal_convergentcomputationinitialcode) + (cfc_right_terminal_convergentcomputationinitialcode)) * S ((cfc_left_terminal_convergentcomputationinitialcode) + (cfc_right_terminal_convergentcomputationinitialcode)) + ((cfc_right_terminal_convergentcomputationinitialcode) + (cfc_right_terminal_convergentcomputationinitialcode))) /\ ((cfc_state_terminal_convergentcomputationinitial) = ((cfc_tail_terminal_convergentcomputation) + (cfc_matrix_terminal_convergentcomputationinitialcode)) * S ((cfc_tail_terminal_convergentcomputation) + (cfc_matrix_terminal_convergentcomputationinitialcode)) + ((cfc_matrix_terminal_convergentcomputationinitialcode) + (cfc_matrix_terminal_convergentcomputationinitialcode))))))) /\ (((exists ff_h_terminal_convergentcomputationinitialentry. ff_h_terminal_convergentcomputationinitialentry + S (cfc_state_terminal_convergentcomputationinitial) = S ((S (0)) * cfc_scale_terminal_convergent)) /\ exists ff_q_terminal_convergentcomputationinitialentry. cfc_code_terminal_convergent = ff_q_terminal_convergentcomputationinitialentry * S ((S (0)) * cfc_scale_terminal_convergent) + (cfc_state_terminal_convergentcomputationinitial))))) /\ ((exists cfc_state_terminal_convergentcomputationterminal. ((exists cfc_left_terminal_convergentcomputationterminalcode cfc_right_terminal_convergentcomputationterminalcode cfc_matrix_terminal_convergentcomputationterminalcode. ((cfc_left_terminal_convergentcomputationterminalcode = ((u) + (cfc_previous_numerator_terminal_convergent)) * S ((u) + (cfc_previous_numerator_terminal_convergent)) + ((cfc_previous_numerator_terminal_convergent) + (cfc_previous_numerator_terminal_convergent))) /\ ((cfc_right_terminal_convergentcomputationterminalcode = ((v) + (cfc_previous_denominator_terminal_convergent)) * S ((v) + (cfc_previous_denominator_terminal_convergent)) + ((cfc_previous_denominator_terminal_convergent) + (cfc_previous_denominator_terminal_convergent))) /\ ((cfc_matrix_terminal_convergentcomputationterminalcode = ((cfc_left_terminal_convergentcomputationterminalcode) + (cfc_right_terminal_convergentcomputationterminalcode)) * S ((cfc_left_terminal_convergentcomputationterminalcode) + (cfc_right_terminal_convergentcomputationterminalcode)) + ((cfc_right_terminal_convergentcomputationterminalcode) + (cfc_right_terminal_convergentcomputationterminalcode))) /\ ((cfc_state_terminal_convergentcomputationterminal) = ((s) + (cfc_matrix_terminal_convergentcomputationterminalcode)) * S ((s) + (cfc_matrix_terminal_convergentcomputationterminalcode)) + ((cfc_matrix_terminal_convergentcomputationterminalcode) + (cfc_matrix_terminal_convergentcomputationterminalcode))))))) /\ (((exists ff_h_terminal_convergentcomputationterminalentry. ff_h_terminal_convergentcomputationterminalentry + S (cfc_state_terminal_convergentcomputationterminal) = S ((S (S (k))) * cfc_scale_terminal_convergent)) /\ exists ff_q_terminal_convergentcomputationterminalentry. cfc_code_terminal_convergent = ff_q_terminal_convergentcomputationterminalentry * S ((S (S (k))) * cfc_scale_terminal_convergent) + (cfc_state_terminal_convergentcomputationterminal))))) /\ (forall cfc_index_terminal_convergentcomputation. (exists cfba_gap_terminal_convergentcomputationbound. cfba_gap_terminal_convergentcomputationbound + S (cfc_index_terminal_convergentcomputation) = (S (k))) -> exists cfc_old_terminal_convergentcomputation cfc_a_terminal_convergentcomputation cfc_b_terminal_convergentcomputation cfc_c_terminal_convergentcomputation cfc_d_terminal_convergentcomputation cfc_new_terminal_convergentcomputation cfc_quotient_terminal_convergentcomputation. ((exists cfc_state_terminal_convergentcomputationprevious. ((exists cfc_left_terminal_convergentcomputationpreviouscode cfc_right_terminal_convergentcomputationpreviouscode cfc_matrix_terminal_convergentcomputationpreviouscode. ((cfc_left_terminal_convergentcomputationpreviouscode = ((cfc_a_terminal_convergentcomputation) + (cfc_b_terminal_convergentcomputation)) * S ((cfc_a_terminal_convergentcomputation) + (cfc_b_terminal_convergentcomputation)) + ((cfc_b_terminal_convergentcomputation) + (cfc_b_terminal_convergentcomputation))) /\ ((cfc_right_terminal_convergentcomputationpreviouscode = ((cfc_c_terminal_convergentcomputation) + (cfc_d_terminal_convergentcomputation)) * S ((cfc_c_terminal_convergentcomputation) + (cfc_d_terminal_convergentcomputation)) + ((cfc_d_terminal_convergentcomputation) + (cfc_d_terminal_convergentcomputation))) /\ ((cfc_matrix_terminal_convergentcomputationpreviouscode = ((cfc_left_terminal_convergentcomputationpreviouscode) + (cfc_right_terminal_convergentcomputationpreviouscode)) * S ((cfc_left_terminal_convergentcomputationpreviouscode) + (cfc_right_terminal_convergentcomputationpreviouscode)) + ((cfc_right_terminal_convergentcomputationpreviouscode) + (cfc_right_terminal_convergentcomputationpreviouscode))) /\ ((cfc_state_terminal_convergentcomputationprevious) = ((cfc_old_terminal_convergentcomputation) + (cfc_matrix_terminal_convergentcomputationpreviouscode)) * S ((cfc_old_terminal_convergentcomputation) + (cfc_matrix_terminal_convergentcomputationpreviouscode)) + ((cfc_matrix_terminal_convergentcomputationpreviouscode) + (cfc_matrix_terminal_convergentcomputationpreviouscode))))))) /\ (((exists ff_h_terminal_convergentcomputationpreviousentry. ff_h_terminal_convergentcomputationpreviousentry + S (cfc_state_terminal_convergentcomputationprevious) = S ((S (cfc_index_terminal_convergentcomputation)) * cfc_scale_terminal_convergent)) /\ exists ff_q_terminal_convergentcomputationpreviousentry. cfc_code_terminal_convergent = ff_q_terminal_convergentcomputationpreviousentry * S ((S (cfc_index_terminal_convergentcomputation)) * cfc_scale_terminal_convergent) + (cfc_state_terminal_convergentcomputationprevious))))) /\ ((exists cfc_state_terminal_convergentcomputationfollowing. ((exists cfc_left_terminal_convergentcomputationfollowingcode cfc_right_terminal_convergentcomputationfollowingcode cfc_matrix_terminal_convergentcomputationfollowingcode. ((cfc_left_terminal_convergentcomputationfollowingcode = (((cfc_quotient_terminal_convergentcomputation * cfc_a_terminal_convergentcomputation + cfc_c_terminal_convergentcomputation)) + ((cfc_quotient_terminal_convergentcomputation * cfc_b_terminal_convergentcomputation + cfc_d_terminal_convergentcomputation))) * S (((cfc_quotient_terminal_convergentcomputation * cfc_a_terminal_convergentcomputation + cfc_c_terminal_convergentcomputation)) + ((cfc_quotient_terminal_convergentcomputation * cfc_b_terminal_convergentcomputation + cfc_d_terminal_convergentcomputation))) + (((cfc_quotient_terminal_convergentcomputation * cfc_b_terminal_convergentcomputation + cfc_d_terminal_convergentcomputation)) + ((cfc_quotient_terminal_convergentcomputation * cfc_b_terminal_convergentcomputation + cfc_d_terminal_convergentcomputation)))) /\ ((cfc_right_terminal_convergentcomputationfollowingcode = ((cfc_a_terminal_convergentcomputation) + (cfc_b_terminal_convergentcomputation)) * S ((cfc_a_terminal_convergentcomputation) + (cfc_b_terminal_convergentcomputation)) + ((cfc_b_terminal_convergentcomputation) + (cfc_b_terminal_convergentcomputation))) /\ ((cfc_matrix_terminal_convergentcomputationfollowingcode = ((cfc_left_terminal_convergentcomputationfollowingcode) + (cfc_right_terminal_convergentcomputationfollowingcode)) * S ((cfc_left_terminal_convergentcomputationfollowingcode) + (cfc_right_terminal_convergentcomputationfollowingcode)) + ((cfc_right_terminal_convergentcomputationfollowingcode) + (cfc_right_terminal_convergentcomputationfollowingcode))) /\ ((cfc_state_terminal_convergentcomputationfollowing) = ((cfc_new_terminal_convergentcomputation) + (cfc_matrix_terminal_convergentcomputationfollowingcode)) * S ((cfc_new_terminal_convergentcomputation) + (cfc_matrix_terminal_convergentcomputationfollowingcode)) + ((cfc_matrix_terminal_convergentcomputationfollowingcode) + (cfc_matrix_terminal_convergentcomputationfollowingcode))))))) /\ (((exists ff_h_terminal_convergentcomputationfollowingentry. ff_h_terminal_convergentcomputationfollowingentry + S (cfc_state_terminal_convergentcomputationfollowing) = S ((S (S cfc_index_terminal_convergentcomputation)) * cfc_scale_terminal_convergent)) /\ exists ff_q_terminal_convergentcomputationfollowingentry. cfc_code_terminal_convergent = ff_q_terminal_convergentcomputationfollowingentry * S ((S (S cfc_index_terminal_convergentcomputation)) * cfc_scale_terminal_convergent) + (cfc_state_terminal_convergentcomputationfollowing))))) /\ (cfc_new_terminal_convergentcomputation = S ((cfc_quotient_terminal_convergentcomputation + cfc_old_terminal_convergentcomputation) * S (cfc_quotient_terminal_convergentcomputation + cfc_old_terminal_convergentcomputation) + (cfc_old_terminal_convergentcomputation + cfc_old_terminal_convergentcomputation))))))))))) -> a * v = b * u

Complete tactic proof in conservative notation

All 30 original proof lines are preserved. Only local proposition formulas are abbreviated; every abbreviation has an exact binder-safe expansion check. The linked exact edition contains the unchanged replay script.

Read the argument

Proof checkpoints

30 script commands · 4 reading checkpoints · 0 local claims

This is a reading aid, not a new proof or a proof-tree certificate. Checkpoint groups are consecutive commands, not inferred branch boundaries. Every step links to the preserved script.

Definition notation is shown below. Open the paired exact edition for the original native formulas. Source pairing is not a new equivalence certificate.

Named ingredients (1)
01Fix variables and assumptionsL1–10

Work with arbitrary variables or the premises of the current implication.

  1. L1
    intro a
  2. L2
    intro b
  3. L3
    intro s
  4. L4
    intro h
  5. L5
    intro e
  6. L6
    intro k
  7. L7
    intro u
  8. L8
    intro v
  9. L9
    intro ht
  10. L10
    intro hc
02Separate the logical casesL11–15

Follow the explicit conjunction, disjunction, witness, or contradiction step recorded below.

  1. L11
    cases hc
  2. L12
    cases hc_witness
  3. L13
    cases hc_witness_witness
  4. L14
    cases hc_witness_witness_witness
  5. L15
    cases hc_witness_witness_witness_witness
03Use earlier factsL16–25

Instantiate or apply named facts and discharge the corresponding proof obligations.

  1. L16
    specialize cf_convergent_full_matrix_is_exact (S k)
  2. L17
    specialize cf_convergent_full_matrix_is_exact (a)
  3. L18
    specialize cf_convergent_full_matrix_is_exact (b)
  4. L19
    specialize cf_convergent_full_matrix_is_exact (s)
  5. L20
    specialize cf_convergent_full_matrix_is_exact (h)
  6. L21
    specialize cf_convergent_full_matrix_is_exact (e)
  7. L22
    specialize cf_convergent_full_matrix_is_exact (x2)
  8. L23
    specialize cf_convergent_full_matrix_is_exact (x3)
  9. L24
    specialize cf_convergent_full_matrix_is_exact (u)
  10. L25
    specialize cf_convergent_full_matrix_is_exact (x)
04Use earlier factsL26–30

Instantiate or apply named facts and discharge the corresponding proof obligations.

  1. L26
    specialize cf_convergent_full_matrix_is_exact (v)
  2. L27
    specialize cf_convergent_full_matrix_is_exact (x1)
  3. L28
    apply cf_convergent_full_matrix_is_exact
  4. L29
    exact ht
  5. L30
    exact hc_witness_witness_witness_witness_right

Library-wide reading audit

Original defined command ledger · 30 lines
  1. 0001intro a
  2. 0002intro b
  3. 0003intro s
  4. 0004intro h
  5. 0005intro e
  6. 0006intro k
  7. 0007intro u
  8. 0008intro v
  9. 0009intro ht
  10. 0010intro hc
  11. 0011cases hc
  12. 0012cases hc_witness
  13. 0013cases hc_witness_witness
  14. 0014cases hc_witness_witness_witness
  15. 0015cases hc_witness_witness_witness_witness
  16. 0016specialize cf_convergent_full_matrix_is_exact (S k)
  17. 0017specialize cf_convergent_full_matrix_is_exact (a)
  18. 0018specialize cf_convergent_full_matrix_is_exact (b)
  19. 0019specialize cf_convergent_full_matrix_is_exact (s)
  20. 0020specialize cf_convergent_full_matrix_is_exact (h)
  21. 0021specialize cf_convergent_full_matrix_is_exact (e)
  22. 0022specialize cf_convergent_full_matrix_is_exact (x2)
  23. 0023specialize cf_convergent_full_matrix_is_exact (x3)
  24. 0024specialize cf_convergent_full_matrix_is_exact (u)
  25. 0025specialize cf_convergent_full_matrix_is_exact (x)
  26. 0026specialize cf_convergent_full_matrix_is_exact (v)
  27. 0027specialize cf_convergent_full_matrix_is_exact (x1)
  28. 0028apply cf_convergent_full_matrix_is_exact
  29. 0029exact ht
  30. 0030exact hc_witness_witness_witness_witness_right