
theory TestBv32

  use bv.BV32

  lemma Test1:
    let b = bw_and zeros ones in nth b 1 = False

  lemma Test2:
    let b = lsr ones 16 in nth b 15 = True

  lemma Test3:
    let b = lsr ones 16 in nth b 16 = False

  lemma Test4:
    let b = asr ones 16 in nth b 15 = True

  lemma Test5:
    let b = asr ones 16 in nth b 16 = True

  lemma Test6:
    let b = asr (lsr ones 1) 16 in nth b 16 = False

end

theory NthConvert

  use mach.int.Int

  use bv.BV8 as BV8
  use bv.BV64 as BV64
  use bv.BVConverter_8_64 as BVC

  lemma bv8_to_bv64_low:
    forall x i. 0 <= i < 8 -> BV64.nth (BVC.toBig x) i = BV8.nth x i
        by forall i.
             BV64.nth_bv (BVC.toBig x) (BVC.toBig i) = BV8.nth_bv x i

  lemma bv8_to_bv64_high:
    forall x i. 8 <= i < 64 -> BV64.nth (BVC.toBig x) i = false
end
