Skip to content

Commit c2e5939

Browse files
committed
Update BinaryRec.lean
1 parent a54cb48 commit c2e5939

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Batteries/Data/Nat/BinaryRec.lean

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ universe u
2121
namespace Nat
2222

2323
/-- `bit b` appends the digit `b` to the little end of the binary representation of
24-
its natural number input. -/
24+
its natural number input. -/
2525
def bit (b : Bool) (n : Nat) : Nat :=
2626
cond b (2 * n + 1) (2 * n)
2727

@@ -63,7 +63,7 @@ def binaryRec {motive : Nat → Sort u} (z : motive 0) (f : ∀ b n, motive n
6363
decreasing_by exact bitwise_rec_lemma n0
6464

6565
/-- The same as `binaryRec`, but the induction step can assume that if `n=0`,
66-
the bit being appended is `true`-/
66+
the bit being appended is `true` -/
6767
@[elab_as_elim, specialize]
6868
def binaryRec' {motive : Nat → Sort u} (z : motive 0)
6969
(f : ∀ b n, (n = 0 → b = true) → motive n → motive (bit b n)) :
@@ -118,11 +118,11 @@ theorem bitCasesOn_bit (h : ∀ b n, motive (bit b n)) (b : Bool) (n : Nat) :
118118
rw [testBit_bit_zero, bit_shiftRight_one]
119119
intros; rfl
120120

121-
unseal binaryRec in
122121
@[simp]
123122
theorem binaryRec_zero (z : motive 0) (f : ∀ b n, motive n → motive (bit b n)) :
124-
binaryRec z f 0 = z :=
125-
rfl
123+
binaryRec z f 0 = z := by
124+
rw [binaryRec]
125+
simp
126126

127127
@[simp]
128128
theorem binaryRec_one (z : motive 0) (f : ∀ b n, motive n → motive (bit b n)) :

0 commit comments

Comments
 (0)