BT00Y1 · Bertrand theorem

bit_count_positive_last_one

Alpha v34 checked-use theorem · independently kernel and Lean verified; not Stable

A positive bit count has a one at an index at least its count.

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.

Statement with defined notation

∀ b. ∀ c. ∀ l. ∀ e. BitCount(b,c,l,S e) → ∃ x. Lt(x,l) ∧ (BetaAt(b,c,x,1)Lt(e,S x))

Every purple notation token opens its conservative definition. Expanding the displayed statement recovers the exact first-order Peano-arithmetic formula checked by the unchanged kernel.

Definitions used by this theorem

In the theorem statement

4 occurrences

In local proof propositions

5 occurrences

Exact expanded native-PA statement
forall b c l e. (((exists ff_u_b5ccbclo_count_sum ff_v_b5ccbclo_count_sum. ((((exists ff_h_b5ccbclo_count_sum_start. ff_h_b5ccbclo_count_sum_start + S (0) = S ((S (0)) * ff_v_b5ccbclo_count_sum)) /\ exists ff_q_b5ccbclo_count_sum_start. ff_u_b5ccbclo_count_sum = ff_q_b5ccbclo_count_sum_start * S ((S (0)) * ff_v_b5ccbclo_count_sum) + (0))) /\ ((((exists ff_h_b5ccbclo_count_sum_terminal. ff_h_b5ccbclo_count_sum_terminal + S ((S e)) = S ((S ((l))) * ff_v_b5ccbclo_count_sum)) /\ exists ff_q_b5ccbclo_count_sum_terminal. ff_u_b5ccbclo_count_sum = ff_q_b5ccbclo_count_sum_terminal * S ((S ((l))) * ff_v_b5ccbclo_count_sum) + ((S e)))) /\ forall ff_i_b5ccbclo_count_sum. (exists ff_lt_b5ccbclo_count_sum_bound. ff_lt_b5ccbclo_count_sum_bound + S ff_i_b5ccbclo_count_sum = (l)) -> exists ff_a_b5ccbclo_count_sum ff_r_b5ccbclo_count_sum ff_s_b5ccbclo_count_sum. ((((exists ff_h_b5ccbclo_count_sum_summand. ff_h_b5ccbclo_count_sum_summand + S (ff_a_b5ccbclo_count_sum) = S ((S (ff_i_b5ccbclo_count_sum)) * c)) /\ exists ff_q_b5ccbclo_count_sum_summand. b = ff_q_b5ccbclo_count_sum_summand * S ((S (ff_i_b5ccbclo_count_sum)) * c) + (ff_a_b5ccbclo_count_sum))) /\ ((((exists ff_h_b5ccbclo_count_sum_partial. ff_h_b5ccbclo_count_sum_partial + S (ff_r_b5ccbclo_count_sum) = S ((S (ff_i_b5ccbclo_count_sum)) * ff_v_b5ccbclo_count_sum)) /\ exists ff_q_b5ccbclo_count_sum_partial. ff_u_b5ccbclo_count_sum = ff_q_b5ccbclo_count_sum_partial * S ((S (ff_i_b5ccbclo_count_sum)) * ff_v_b5ccbclo_count_sum) + (ff_r_b5ccbclo_count_sum))) /\ ((((exists ff_h_b5ccbclo_count_sum_successor. ff_h_b5ccbclo_count_sum_successor + S (ff_s_b5ccbclo_count_sum) = S ((S (S ff_i_b5ccbclo_count_sum)) * ff_v_b5ccbclo_count_sum)) /\ exists ff_q_b5ccbclo_count_sum_successor. ff_u_b5ccbclo_count_sum = ff_q_b5ccbclo_count_sum_successor * S ((S (S ff_i_b5ccbclo_count_sum)) * ff_v_b5ccbclo_count_sum) + (ff_s_b5ccbclo_count_sum))) /\ ff_s_b5ccbclo_count_sum = ff_r_b5ccbclo_count_sum + ff_a_b5ccbclo_count_sum)))))) /\ (forall ff_i_b5ccbclo_count_bits. (exists ff_lt_b5ccbclo_count_bits_bound. ff_lt_b5ccbclo_count_bits_bound + S ff_i_b5ccbclo_count_bits = (l)) -> exists ff_bit_b5ccbclo_count_bits. ((((exists ff_h_b5ccbclo_count_bits_decoded. ff_h_b5ccbclo_count_bits_decoded + S (ff_bit_b5ccbclo_count_bits) = S ((S (ff_i_b5ccbclo_count_bits)) * c)) /\ exists ff_q_b5ccbclo_count_bits_decoded. b = ff_q_b5ccbclo_count_bits_decoded * S ((S (ff_i_b5ccbclo_count_bits)) * c) + (ff_bit_b5ccbclo_count_bits))) /\ (ff_bit_b5ccbclo_count_bits = 0 \/ ff_bit_b5ccbclo_count_bits = 1))))) -> exists i. (exists bcf_lt_gap_b5ccbclo_bound. bcf_lt_gap_b5ccbclo_bound + S (i) = l) /\ ((((exists fs_h_b5ccbclo_entry. fs_h_b5ccbclo_entry + S (1) = S ((S (i)) * c)) /\ exists fs_q_b5ccbclo_entry. b = fs_q_b5ccbclo_entry * S ((S (i)) * c) + (1))) /\ (exists bcf_le_gap_b5ccbclo_result. bcf_le_gap_b5ccbclo_result + (S e) = S i))

Proof neighborhood

Direct theorem prerequisites

Direct theorem dependents

Definition-aware tactic body

Only local propositions introduced by have or suffices are compacted. Every changed line has an exact-AST conservative-expansion receipt; the kernel still receives the immutable original tactic script.

Read the argument

Proof checkpoints

69 script commands · 22 reading checkpoints · 4 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 (5)
01Fix variables and assumptionsL1–2

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

  1. L1
    intro b
  2. L2
    intro c
02Induction on lL3–5

Split the argument into the base and successor obligations. The induction hypothesis is available only in the successor branch.

  1. L3
    induction l
  2. L4
    intro e
  3. L5
    intro hcount
03Establish himpossibleL6–13

Establish this local claim before using it. It is not an additional assumption. The following proof commands apply bit count zero.

  1. L6
    have himpossible : S e = 0
  2. L7
    specialize bit_count_zero b
  3. L8
    specialize bit_count_zero c
  4. L9
    specialize bit_count_zero 0
  5. L10
    specialize bit_count_zero (S e)
  6. L11
    apply bit_count_zero
  7. L12
    refl
  8. L13
    exact hcount
04Separate the logical casesL14–14

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

  1. L14
    exfalso
05Use earlier factsL15–16

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

  1. L15
    apply PA1
  2. L16
    exact himpossible
06Fix variables and assumptionsL17–18

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

  1. L17
    intro e
  2. L18
    intro hcount
07Establish hdecompL19–27

Establish this local claim before using it. It is not an additional assumption. The following proof commands apply bit count succ decompose.

  1. L19
    have hdecomp : ∃ a. ∃ r. BetaAt(b,c,l,a) ∧ (BitCount(b,c,l,r) ∧ ((a = 0 ∨ a = 1) ∧ S e = r + a))Definitions: BetaAt(b,c,l,a)BitCount(b,c,l,r)Original native command in the exact edition
  2. L20
    specialize bit_count_succ_decompose b
  3. L21
    specialize bit_count_succ_decompose c
  4. L22
    specialize bit_count_succ_decompose l
  5. L23
    specialize bit_count_succ_decompose (S l)
  6. L24
    specialize bit_count_succ_decompose (S e)
  7. L25
    apply bit_count_succ_decompose
  8. L26
    refl
  9. L27
    exact hcount
08Separate the logical casesL28–33

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

  1. L28
    cases hdecomp
  2. L29
    cases hdecomp_witness
  3. L30
    cases hdecomp_witness_witness
  4. L31
    cases hdecomp_witness_witness_right
  5. L32
    cases hdecomp_witness_witness_right_right
  6. L33
    cases hdecomp_witness_witness_right_right_left
09Establish hprefix_valueL34–39

Establish this local claim before using it. It is not an additional assumption.

  1. L34
    have hprefix_value : S e = x1
  2. L35
    rewrite hdecomp_witness_witness_right_right_left_left at hdecomp_witness_witness_right_right_right
  3. L36
    rewrite PA3 at hdecomp_witness_witness_right_right_right
  4. L37
    exact hdecomp_witness_witness_right_right_right
  5. L38
    rewrite <- hprefix_value at hdecomp_witness_witness_right_left
  6. L39
    rewrite <- hprefix_value at hdecomp_witness_witness_right_left
10Establish hpreviousL40–43

Establish this local claim before using it. It is not an additional assumption. The following proof commands apply IH.

  1. L40
    have hprevious : ∃ i. Lt(i,l) ∧ (BetaAt(b,c,i,1) ∧ Lt(e,S i))Definitions: Lt(i,l)BetaAt(b,c,i,1)Lt(e,S i)Original native command in the exact edition
  2. L41
    specialize IH e
  3. L42
    apply IH
  4. L43
    exact hdecomp_witness_witness_right_left
11Separate the logical casesL44–46

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

  1. L44
    cases hprevious
  2. L45
    cases hprevious_witness
  3. L46
    cases hprevious_witness_right
12Construct an explicit witnessL47–47

Supply the displayed value, then prove that it has the required property.

  1. L47
    exists x2
13Separate the logical casesL48–48

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

  1. L48
    split
14Use earlier factsL49–52

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

  1. L49
    specialize le_succ (S x2)
  2. L50
    specialize le_succ l
  3. L51
    apply le_succ
  4. L52
    exact hprevious_witness_left
15Separate the logical casesL53–53

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

  1. L53
    split
16Use earlier factsL54–55

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

  1. L54
    exact hprevious_witness_right_left
  2. L55
    exact hprevious_witness_right_right
17Construct an explicit witnessL56–56

Supply the displayed value, then prove that it has the required property.

  1. L56
    exists l
18Separate the logical casesL57–57

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

  1. L57
    split
19Use earlier factsL58–59

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

  1. L58
    specialize le_refl (S l)
  2. L59
    exact le_refl
20Separate the logical casesL60–60

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

  1. L60
    split
21Calculate and transport equalitiesL61–62

Carry out the recorded arithmetic or equality steps; inspect the exact commands for their direction and premises.

  1. L61
    rewrite hdecomp_witness_witness_right_right_left_right at hdecomp_witness_witness_left
  2. L62
    rewrite hdecomp_witness_witness_right_right_left_right at hdecomp_witness_witness_left
22Use earlier factsL63–69

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

  1. L63
    exact hdecomp_witness_witness_left
  2. L64
    specialize bit_count_bounded b
  3. L65
    specialize bit_count_bounded c
  4. L66
    specialize bit_count_bounded (S l)
  5. L67
    specialize bit_count_bounded (S e)
  6. L68
    apply bit_count_bounded
  7. L69
    exact hcount

Library-wide reading audit

Original defined command ledger · 69 lines
  1. 0001intro b
  2. 0002intro c
  3. 0003induction l
  4. 0004intro e
  5. 0005intro hcount
  6. 0006have himpossible : S e = 0
  7. 0007specialize bit_count_zero b
  8. 0008specialize bit_count_zero c
  9. 0009specialize bit_count_zero 0
  10. 0010specialize bit_count_zero (S e)
  11. 0011apply bit_count_zero
  12. 0012refl
  13. 0013exact hcount
  14. 0014exfalso
  15. 0015apply PA1
  16. 0016exact himpossible
  17. 0017intro e
  18. 0018intro hcount
  19. 0019have hdecomp : ∃ a. ∃ r. BetaAt(b,c,l,a) ∧ (BitCount(b,c,l,r) ∧ ((a = 0 ∨ a = 1) ∧ S e = r + a))
    Exact native replay linehave hdecomp : exists a r. (((exists fs_h_b5ccbclo_last. fs_h_b5ccbclo_last + S (a) = S ((S (l)) * c)) /\ exists fs_q_b5ccbclo_last. b = fs_q_b5ccbclo_last * S ((S (l)) * c) + (a))) /\ ((((exists ff_u_b5ccbclo_prefix_sum ff_v_b5ccbclo_prefix_sum. ((((exists ff_h_b5ccbclo_prefix_sum_start. ff_h_b5ccbclo_prefix_sum_start + S (0) = S ((S (0)) * ff_v_b5ccbclo_prefix_sum)) /\ exists ff_q_b5ccbclo_prefix_sum_start. ff_u_b5ccbclo_prefix_sum = ff_q_b5ccbclo_prefix_sum_start * S ((S (0)) * ff_v_b5ccbclo_prefix_sum) + (0))) /\ ((((exists ff_h_b5ccbclo_prefix_sum_terminal. ff_h_b5ccbclo_prefix_sum_terminal + S (r) = S ((S (l)) * ff_v_b5ccbclo_prefix_sum)) /\ exists ff_q_b5ccbclo_prefix_sum_terminal. ff_u_b5ccbclo_prefix_sum = ff_q_b5ccbclo_prefix_sum_terminal * S ((S (l)) * ff_v_b5ccbclo_prefix_sum) + (r))) /\ forall ff_i_b5ccbclo_prefix_sum. (exists ff_lt_b5ccbclo_prefix_sum_bound. ff_lt_b5ccbclo_prefix_sum_bound + S ff_i_b5ccbclo_prefix_sum = l) -> exists ff_a_b5ccbclo_prefix_sum ff_r_b5ccbclo_prefix_sum ff_s_b5ccbclo_prefix_sum. ((((exists ff_h_b5ccbclo_prefix_sum_summand. ff_h_b5ccbclo_prefix_sum_summand + S (ff_a_b5ccbclo_prefix_sum) = S ((S (ff_i_b5ccbclo_prefix_sum)) * c)) /\ exists ff_q_b5ccbclo_prefix_sum_summand. b = ff_q_b5ccbclo_prefix_sum_summand * S ((S (ff_i_b5ccbclo_prefix_sum)) * c) + (ff_a_b5ccbclo_prefix_sum))) /\ ((((exists ff_h_b5ccbclo_prefix_sum_partial. ff_h_b5ccbclo_prefix_sum_partial + S (ff_r_b5ccbclo_prefix_sum) = S ((S (ff_i_b5ccbclo_prefix_sum)) * ff_v_b5ccbclo_prefix_sum)) /\ exists ff_q_b5ccbclo_prefix_sum_partial. ff_u_b5ccbclo_prefix_sum = ff_q_b5ccbclo_prefix_sum_partial * S ((S (ff_i_b5ccbclo_prefix_sum)) * ff_v_b5ccbclo_prefix_sum) + (ff_r_b5ccbclo_prefix_sum))) /\ ((((exists ff_h_b5ccbclo_prefix_sum_successor. ff_h_b5ccbclo_prefix_sum_successor + S (ff_s_b5ccbclo_prefix_sum) = S ((S (S ff_i_b5ccbclo_prefix_sum)) * ff_v_b5ccbclo_prefix_sum)) /\ exists ff_q_b5ccbclo_prefix_sum_successor. ff_u_b5ccbclo_prefix_sum = ff_q_b5ccbclo_prefix_sum_successor * S ((S (S ff_i_b5ccbclo_prefix_sum)) * ff_v_b5ccbclo_prefix_sum) + (ff_s_b5ccbclo_prefix_sum))) /\ ff_s_b5ccbclo_prefix_sum = ff_r_b5ccbclo_prefix_sum + ff_a_b5ccbclo_prefix_sum)))))) /\ (forall ff_i_b5ccbclo_prefix_bits. (exists ff_lt_b5ccbclo_prefix_bits_bound. ff_lt_b5ccbclo_prefix_bits_bound + S ff_i_b5ccbclo_prefix_bits = l) -> exists ff_bit_b5ccbclo_prefix_bits. ((((exists ff_h_b5ccbclo_prefix_bits_decoded. ff_h_b5ccbclo_prefix_bits_decoded + S (ff_bit_b5ccbclo_prefix_bits) = S ((S (ff_i_b5ccbclo_prefix_bits)) * c)) /\ exists ff_q_b5ccbclo_prefix_bits_decoded. b = ff_q_b5ccbclo_prefix_bits_decoded * S ((S (ff_i_b5ccbclo_prefix_bits)) * c) + (ff_bit_b5ccbclo_prefix_bits))) /\ (ff_bit_b5ccbclo_prefix_bits = 0 \/ ff_bit_b5ccbclo_prefix_bits = 1))))) /\ ((a = 0 \/ a = 1) /\ S e = r + a))
  20. 0020specialize bit_count_succ_decompose b
  21. 0021specialize bit_count_succ_decompose c
  22. 0022specialize bit_count_succ_decompose l
  23. 0023specialize bit_count_succ_decompose (S l)
  24. 0024specialize bit_count_succ_decompose (S e)
  25. 0025apply bit_count_succ_decompose
  26. 0026refl
  27. 0027exact hcount
  28. 0028cases hdecomp
  29. 0029cases hdecomp_witness
  30. 0030cases hdecomp_witness_witness
  31. 0031cases hdecomp_witness_witness_right
  32. 0032cases hdecomp_witness_witness_right_right
  33. 0033cases hdecomp_witness_witness_right_right_left
  34. 0034have hprefix_value : S e = x1
  35. 0035rewrite hdecomp_witness_witness_right_right_left_left at hdecomp_witness_witness_right_right_right
  36. 0036rewrite PA3 at hdecomp_witness_witness_right_right_right
  37. 0037exact hdecomp_witness_witness_right_right_right
  38. 0038rewrite <- hprefix_value at hdecomp_witness_witness_right_left
  39. 0039rewrite <- hprefix_value at hdecomp_witness_witness_right_left
  40. 0040have hprevious : ∃ i. Lt(i,l) ∧ (BetaAt(b,c,i,1)Lt(e,S i))
    Exact native replay linehave hprevious : exists i. (exists bcf_lt_gap_b5ccbclo_previous_bound. bcf_lt_gap_b5ccbclo_previous_bound + S (i) = l) /\ ((((exists fs_h_b5ccbclo_previous_entry. fs_h_b5ccbclo_previous_entry + S (1) = S ((S (i)) * c)) /\ exists fs_q_b5ccbclo_previous_entry. b = fs_q_b5ccbclo_previous_entry * S ((S (i)) * c) + (1))) /\ (exists bcf_le_gap_b5ccbclo_previous_result. bcf_le_gap_b5ccbclo_previous_result + (S e) = S i))
  41. 0041specialize IH e
  42. 0042apply IH
  43. 0043exact hdecomp_witness_witness_right_left
  44. 0044cases hprevious
  45. 0045cases hprevious_witness
  46. 0046cases hprevious_witness_right
  47. 0047exists x2
  48. 0048split
  49. 0049specialize le_succ (S x2)
  50. 0050specialize le_succ l
  51. 0051apply le_succ
  52. 0052exact hprevious_witness_left
  53. 0053split
  54. 0054exact hprevious_witness_right_left
  55. 0055exact hprevious_witness_right_right
  56. 0056exists l
  57. 0057split
  58. 0058specialize le_refl (S l)
  59. 0059exact le_refl
  60. 0060split
  61. 0061rewrite hdecomp_witness_witness_right_right_left_right at hdecomp_witness_witness_left
  62. 0062rewrite hdecomp_witness_witness_right_right_left_right at hdecomp_witness_witness_left
  63. 0063exact hdecomp_witness_witness_left
  64. 0064specialize bit_count_bounded b
  65. 0065specialize bit_count_bounded c
  66. 0066specialize bit_count_bounded (S l)
  67. 0067specialize bit_count_bounded (S e)
  68. 0068apply bit_count_bounded
  69. 0069exact hcount