[Merged by Bors] - chore: redefine Nat.bit#19666
[Merged by Bors] - chore: redefine Nat.bit#19666astrainfinita wants to merge 4 commits intomasterfrom
Nat.bit#19666Conversation
|
please_merge_master.md |
|
Could you please explain why you want to do this? I've never seen a Could you include some form of benchmark showing the |
def bit (b : Bool) (n : Nat) : Nat :=
cond b (2 * n + 1) (2 * n)
def bitImpl (b : Bool) (n : Nat) : Nat :=
cond b (n <<< 1 + 1) (n <<< 1)
def run_bit (n : Nat) (x : Nat) : IO Unit := do
let mut t := 0
for _ in [0 : n] do
t := bit false x
def run_bitImpl (n : Nat) (x : Nat) : IO Unit := do
let mut t := 0
for _ in [0 : n] do
t := bitImpl false x
def n := 10^4
def x := 11^1000000
#eval timeit "bit" (run_bit n x) -- bit 620ms
#eval timeit "bitImpl" (run_bitImpl n x) -- bitImpl 433ms |
|
Although I'm by no means an expert here (and never use |
|
I don’t have a strong take here, but it does seem marginal. For one thing the code is branching, but my guess is that there’s some other even faster version. |
|
@FR-vdash-bot, could you say a bit more about why you want this? Do you have a performance-critical compiled application that calls |
|
Then let's remove |
Nat.bit and csimp lemma for Nat.bitNat.bit
YaelDillies
left a comment
There was a problem hiding this comment.
I am happy to merge this since it makes two proofs easier, but really it's all quite marginal. Does your next PR #13649 really need to depend on this one?
maintainer merge
|
🚀 Pull request has been placed on the maintainer queue by YaelDillies. |
|
I'm not sure. I just split this part from #13649. It might simplify some other proofs. |
Co-authored-by: Yaël Dillies <[email protected]>
|
please_merge_master.md |
|
bors merge |
|
Pull request successfully merged into master. Build succeeded: |
Nat.bitNat.bit
split from #13649