Skip to content

Commit

Permalink
proof sorry
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkeizer committed Feb 24, 2024
1 parent cf52dd8 commit b5d0ab0
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/Lean/Meta/Tactic/NormBv.lean
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ import Lean.Elab.Tactic.Basic
import Lean.Meta.Tactic.Apply
import Init.Data.BitVec

namespace Std.BitVec

def lsb (x : BitVec w) := x.getLsb 0

@[simp] theorem getLsb_extractLsb' (x : BitVec w) (start len i : Nat) :
(x.extractLsb' start len).getLsb i = (decide (i < len) && x.getLsb (i + start)) := by
simp [extractLsb', getLsb, Nat.add_comm]

@[simp] theorem concat_extractLsb_lsb (x : BitVec (w+1)) :
concat (x.extractLsb' 1 w) x.lsb = x := by
ext i
cases i using Fin.succRecOn <;> simp [lsb, getLsb_concat]

end Std.BitVec

namespace Lean.Meta

open Lean.Elab.Tactic
Expand All @@ -21,8 +36,9 @@ theorem BitVec.concatCases
{motive : {w : Nat} → BitVec w → Sort u}
(nil : motive BitVec.nil)
(concat : ∀ {w : Nat} (x : BitVec w) (b : Bool), motive (concat x b) ) :
∀ {w} (x : BitVec w), motive x :=
sorry
∀ {w} (x : BitVec w), motive x
| 0, x => cast (by simp) nil
| w+1, x => cast (by simp) <| concat (x.extractLsb' 1 w) x.lsb

-- TODO: this is copied from `evalCases`, surely there's a better way to do this
-- It's just doing the equivalent of `cases $target using BitVec.concatCases`
Expand Down

0 comments on commit b5d0ab0

Please sign in to comment.