Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
kustosz committed Jan 18, 2024
1 parent 89c7fd1 commit b523809
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ProvenZk/Binary.lean
Original file line number Diff line number Diff line change
Expand Up @@ -648,3 +648,22 @@ theorem SubVector_lift_lower : SubVector.lower (SubVector.lift v) = v := by
unfold SubVector.lower
apply Subtype.eq
simp [GetElem.getElem]

lemma recover_binary_nat_snoc {n : Nat} {v : Vector Bit n} {b : Bit}:
recover_binary_nat (v.snoc b) = recover_binary_nat v + 2^n * b.toNat := by
induction n with
| zero =>
cases v using Vector.casesOn
simp [recover_binary_nat]
| succ n ih =>
cases v using Vector.casesOn with | cons hd tl =>
unfold recover_binary_nat
simp [ih]
rw [Nat.add_assoc,
Nat.add_left_cancel_iff,
Nat.mul_add,
Nat.add_left_cancel_iff,
Nat.mul_left_comm,
← Nat.mul_assoc,
Nat.pow_succ
]

0 comments on commit b523809

Please sign in to comment.