@[instance_reducible]
Equations
Equations
- bs.prepend bs₀ = List.foldr (fun (b : Bit) (bs : RealEquiv.Bits) => bs.cons b) bs bs₀
Instances For
Equations
- RealEquiv.bitsToRat bs = ↑(Nat.ofBits (List.map Bit.toBool bs.reverse).toVec) / 2 ^ bs.length
Instances For
Equations
Instances For
Equations
- RealEquiv.ofBitsAux₂ neg bs = match bs.getNat with | (n, bs) => neg.ite (-1) 1 * (↑n + RealEquiv.ofBitsAux₁ bs)
Instances For
Equations
- RealEquiv.ofBits bs = match bs.end with | none => RealEquiv.ofBitsAux₂ (bs.get 0) bs.tail | some Bit.B₀ => RealEquiv.ofBitsAux₂ 0 bs | some Bit.B₁ => RealEquiv.ofBitsAux₂ 1 bs.invert.inc
Instances For
Equations
Instances For
Equations
- RealEquiv.toBits r = match (((RealEquiv.toBitsAux₁ (|r| - ↑⌊|r|⌋.toNat)).cons 0).prepend (List.replicate ⌊|r|⌋.toNat 1)).end with | none => (((RealEquiv.toBitsAux₁ (|r| - ↑⌊|r|⌋.toNat)).cons 0).prepend (List.replicate ⌊|r|⌋.toNat 1)).cons (Bit.ofBool (decide (r < 0))) | some Bit.B₀ => ((RealEquiv.toBitsAux₁ (|r| - ↑⌊|r|⌋.toNat)).cons 0).prepend (List.replicate ⌊|r|⌋.toNat 1) | some Bit.B₁ => (((RealEquiv.toBitsAux₁ (|r| - ↑⌊|r|⌋.toNat)).cons 0).prepend (List.replicate ⌊|r|⌋.toNat 1)).invert.inc