internlm/Lean-Github huggingface dataset:
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false
Tactic:
case succ i =>
  cases Nat.mod_two_eq_zero_or_one n
  case inl heven =>
    have := calc
      n+2 = (n/2)*2 + 2 := by rw [Nat.div_mul_cancel (Nat.dvd_of_mod_eq_zero heven)]
      _   = (n/2 + 1)*2 := Eq.symm $ Nat.add_mul ..
      _   = (n/2 + 1) <<< 1 := by rw [Nat.mul_comm, Nat.shiftLeft_one]
    simp only [
      this, ←Nat.lsb_shiftLeft,
      Nat.succ_eq_add_one,
      ←Nat.shiftRight_getBit,
      Nat.shiftLeft_shiftRight_self,
      Nat.shiftLeft_getBit
    ]
    suffices ∀ (m : Nat), (∀ j, j < i → m.getBit j = false) ↔ (∀ j, j < i.succ → (decide (j≥1) && m.getBit (j-1)) = false) by
      rw [←this]; exact h_ind
    intro m; constructor
    show (∀ j, j < i → m.getBit j = false) → (∀ j, j < i.succ → (decide (j≥ 1) && m.getBit (j-1)) = false)
    . intro h j hj
      cases j
      case zero =>
        rw [decide_eq_false (p:=zero ≥ 1) (by decide), Bool.false_and]
      case succ j =>
        have : j < i := lt_of_succ_lt_succ hj
        rw [decide_eq_true (p:=j.succ ≥ 1) j.zero_lt_succ, Bool.true_and, Nat.succ_sub_one]
        exact h j this
    show (∀ j, j < i.succ → (decide (j ≥ 1) && m.getBit (j-1)) = false) → _
    . intro h j hj
      have h_succ := h j.succ (Nat.succ_lt_succ hj)
      conv at h_succ =>
        rw [decide_eq_true (p:=j.succ≥1) j.zero_lt_succ, Bool.true_and, Nat.succ_sub_one]
      exact h_succ
  case inr hodd =>
    have := calc
      (n+2) % 2
        = n%2 := Nat.add_mod_right ..
      _ = 1 := hodd
    conv =>
      lhs; lhs
      rw [Nat.lsb_of_odd this]; dsimp [getBit]
      change getBit 0 i; rw [zero_getBit]
    suffices (n+2).getBit 0 = true by
      constructor
      . intro h; cases h
      . intro h; calc
          false = getBit (n+2) 0 := Eq.symm $ h.right 0 i.zero_lt_succ
          _     = true := this
    rw [Nat.getBit, decide_eq_true ‹(n+2)%2 = 1›]
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ getBit (Nat.lsb (n + 2)) zero = true ↔ getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false
Tactic:
rw [Nat.lsb_getBit_zero]
Proof state after:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ getBit (n + 2) 0 = true ↔ getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ getBit (n + 2) 0 = true ↔ getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false
Tactic:
constructor
Proof state after:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ getBit (n + 2) 0 = true → getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false

case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) 0 = true
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ getBit (n + 2) 0 = true → getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false

case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) 0 = true
Tactic:
show (n+2).getBit 0 = true → (n+2).getBit zero = true ∧ ∀ j, j < 0 → _
Proof state after:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ getBit (n + 2) 0 = true → getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < 0 → getBit (n + 2) j = false

case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) 0 = true
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ getBit (n + 2) 0 = true → getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < 0 → getBit (n + 2) j = false

case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) 0 = true
Tactic:
. intro h; apply And.intro h ?_
  intro _ hj; cases hj
Proof state after:
case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) 0 = true
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) 0 = true
Tactic:
show (n+2).getBit zero = true ∧ _ → (n+2).getBit zero = true
Proof state after:
case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) zero = true
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) zero = true
Tactic:
. exact And.left
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ getBit (n + 2) 0 = true → getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < 0 → getBit (n + 2) j = false
Tactic:
intro h
Proof state after:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
h : getBit (n + 2) 0 = true
⊢ getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < 0 → getBit (n + 2) j = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
h : getBit (n + 2) 0 = true
⊢ getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < 0 → getBit (n + 2) j = false
Tactic:
apply And.intro h ?_
Proof state after:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
h : getBit (n + 2) 0 = true
⊢ ∀ (j : Nat), j < 0 → getBit (n + 2) j = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
h : getBit (n + 2) 0 = true
⊢ ∀ (j : Nat), j < 0 → getBit (n + 2) j = false
Tactic:
intro _ hj
Proof state after:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
h : getBit (n + 2) 0 = true
j✝ : Nat
hj : j✝ < 0
⊢ getBit (n + 2) j✝ = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
h : getBit (n + 2) 0 = true
j✝ : Nat
hj : j✝ < 0
⊢ getBit (n + 2) j✝ = false
Tactic:
cases hj
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
⊢ (getBit (n + 2) zero = true ∧ ∀ (j : Nat), j < zero → getBit (n + 2) j = false) → getBit (n + 2) zero = true
Tactic:
exact And.left
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false
Tactic:
cases Nat.mod_two_eq_zero_or_one n
Proof state after:
case inl
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
h✝ : n % 2 = 0
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false

case inr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
h✝ : n % 2 = 1
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false
Tactic:
case inl heven =>
  have := calc
    n+2 = (n/2)*2 + 2 := by rw [Nat.div_mul_cancel (Nat.dvd_of_mod_eq_zero heven)]
    _   = (n/2 + 1)*2 := Eq.symm $ Nat.add_mul ..
    _   = (n/2 + 1) <<< 1 := by rw [Nat.mul_comm, Nat.shiftLeft_one]
  simp only [
    this, ←Nat.lsb_shiftLeft,
    Nat.succ_eq_add_one,
    ←Nat.shiftRight_getBit,
    Nat.shiftLeft_shiftRight_self,
    Nat.shiftLeft_getBit
  ]
  suffices ∀ (m : Nat), (∀ j, j < i → m.getBit j = false) ↔ (∀ j, j < i.succ → (decide (j≥1) && m.getBit (j-1)) = false) by
    rw [←this]; exact h_ind
  intro m; constructor
  show (∀ j, j < i → m.getBit j = false) → (∀ j, j < i.succ → (decide (j≥ 1) && m.getBit (j-1)) = false)
  . intro h j hj
    cases j
    case zero =>
      rw [decide_eq_false (p:=zero ≥ 1) (by decide), Bool.false_and]
    case succ j =>
      have : j < i := lt_of_succ_lt_succ hj
      rw [decide_eq_true (p:=j.succ ≥ 1) j.zero_lt_succ, Bool.true_and, Nat.succ_sub_one]
      exact h j this
  show (∀ j, j < i.succ → (decide (j ≥ 1) && m.getBit (j-1)) = false) → _
  . intro h j hj
    have h_succ := h j.succ (Nat.succ_lt_succ hj)
    conv at h_succ =>
      rw [decide_eq_true (p:=j.succ≥1) j.zero_lt_succ, Bool.true_and, Nat.succ_sub_one]
    exact h_succ
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
hodd : n % 2 = 1
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false
Tactic:
case inr hodd =>
  have := calc
    (n+2) % 2
      = n%2 := Nat.add_mod_right ..
    _ = 1 := hodd
  conv =>
    lhs; lhs
    rw [Nat.lsb_of_odd this]; dsimp [getBit]
    change getBit 0 i; rw [zero_getBit]
  suffices (n+2).getBit 0 = true by
    constructor
    . intro h; cases h
    . intro h; calc
        false = getBit (n+2) 0 := Eq.symm $ h.right 0 i.zero_lt_succ
        _     = true := this
  rw [Nat.getBit, decide_eq_true ‹(n+2)%2 = 1›]
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false
Tactic:
have := calc
  n+2 = (n/2)*2 + 2 := by rw [Nat.div_mul_cancel (Nat.dvd_of_mod_eq_zero heven)]
  _   = (n/2 + 1)*2 := Eq.symm $ Nat.add_mul ..
  _   = (n/2 + 1) <<< 1 := by rw [Nat.mul_comm, Nat.shiftLeft_one]
Proof state after:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
⊢ getBit (Nat.lsb (n + 2)) (succ i) = true ↔
    getBit (n + 2) (succ i) = true ∧ ∀ (j : Nat), j < succ i → getBit (n + 2) j = false
Tactic:
simp only [
  this, ←Nat.lsb_shiftLeft,
  Nat.succ_eq_add_one,
  ←Nat.shiftRight_getBit,
  Nat.shiftLeft_shiftRight_self,
  Nat.shiftLeft_getBit
]
Proof state after:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
⊢ getBit (Nat.lsb (n / 2 + 1)) i = true ↔
    getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i + 1 → (decide (j ≥ 1) && getBit (n / 2 + 1) (j - 1)) = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
⊢ getBit (Nat.lsb (n / 2 + 1)) i = true ↔
    getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i + 1 → (decide (j ≥ 1) && getBit (n / 2 + 1) (j - 1)) = false
Tactic:
suffices ∀ (m : Nat), (∀ j, j < i → m.getBit j = false) ↔ (∀ j, j < i.succ → (decide (j≥1) && m.getBit (j-1)) = false) by
  rw [←this]; exact h_ind
Proof state after:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
⊢ ∀ (m : Nat),
    (∀ (j : Nat), j < i → getBit m j = false) ↔ ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
⊢ ∀ (m : Nat),
    (∀ (j : Nat), j < i → getBit m j = false) ↔ ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false
Tactic:
intro m
Proof state after:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < i → getBit m j = false) ↔ ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < i → getBit m j = false) ↔ ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false
Tactic:
constructor
Proof state after:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < i → getBit m j = false) → ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false

case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false) → ∀ (j : Nat), j < i → getBit m j = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < i → getBit m j = false) → ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false

case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false) → ∀ (j : Nat), j < i → getBit m j = false
Tactic:
. intro h j hj
  cases j
  case zero =>
    rw [decide_eq_false (p:=zero ≥ 1) (by decide), Bool.false_and]
  case succ j =>
    have : j < i := lt_of_succ_lt_succ hj
    rw [decide_eq_true (p:=j.succ ≥ 1) j.zero_lt_succ, Bool.true_and, Nat.succ_sub_one]
    exact h j this
Proof state after:
case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false) → ∀ (j : Nat), j < i → getBit m j = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mpr
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false) → ∀ (j : Nat), j < i → getBit m j = false
Tactic:
. intro h j hj
  have h_succ := h j.succ (Nat.succ_lt_succ hj)
  conv at h_succ =>
    rw [decide_eq_true (p:=j.succ≥1) j.zero_lt_succ, Bool.true_and, Nat.succ_sub_one]
  exact h_succ
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
⊢ n + 2 = n / 2 * 2 + 2
Tactic:
rw [Nat.div_mul_cancel (Nat.dvd_of_mod_eq_zero heven)]
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
⊢ (n / 2 + 1) * 2 = (n / 2 + 1) <<< 1
Tactic:
rw [Nat.mul_comm, Nat.shiftLeft_one]
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this✝ : n + 2 = (n / 2 + 1) <<< 1
this :
  ∀ (m : Nat),
    (∀ (j : Nat), j < i → getBit m j = false) ↔ ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false
⊢ getBit (Nat.lsb (n / 2 + 1)) i = true ↔
    getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i + 1 → (decide (j ≥ 1) && getBit (n / 2 + 1) (j - 1)) = false
Tactic:
rw [←this]
Proof state after:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this✝ : n + 2 = (n / 2 + 1) <<< 1
this :
  ∀ (m : Nat),
    (∀ (j : Nat), j < i → getBit m j = false) ↔ ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false
⊢ getBit (Nat.lsb (n / 2 + 1)) i = true ↔
    getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this✝ : n + 2 = (n / 2 + 1) <<< 1
this :
  ∀ (m : Nat),
    (∀ (j : Nat), j < i → getBit m j = false) ↔ ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false
⊢ getBit (Nat.lsb (n / 2 + 1)) i = true ↔
    getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
Tactic:
exact h_ind
Proof state after:
no goals
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
⊢ (∀ (j : Nat), j < i → getBit m j = false) → ∀ (j : Nat), j < succ i → (decide (j ≥ 1) && getBit m (j - 1)) = false
Tactic:
intro h j hj
Proof state after:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
h : ∀ (j : Nat), j < i → getBit m j = false
j : Nat
hj : j < succ i
⊢ (decide (j ≥ 1) && getBit m (j - 1)) = false
Theorem: Nat.lsb_getBit_iff
Proof state before:
case mp
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
h : ∀ (j : Nat), j < i → getBit m j = false
j : Nat
hj : j < succ i
⊢ (decide (j ≥ 1) && getBit m (j - 1)) = false
Tactic:
cases j
Proof state after:
case mp.zero
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
h : ∀ (j : Nat), j < i → getBit m j = false
hj : zero < succ i
⊢ (decide (zero ≥ 1) && getBit m (zero - 1)) = false

case mp.succ
n : Nat
h_ind :
  ∀ {i : Nat},
    getBit (Nat.lsb (n / 2 + 1)) i = true ↔
      getBit (n / 2 + 1) i = true ∧ ∀ (j : Nat), j < i → getBit (n / 2 + 1) j = false
i : Nat
heven : n % 2 = 0
this : n + 2 = (n / 2 + 1) <<< 1
m : Nat
h : ∀ (j : Nat), j < i → getBit m j = false
n✝ : Nat
hj : succ n✝ < succ i
⊢ (decide (succ n✝ ≥ 1) && getBit m (succ n✝ - 1)) = false