Zulip Chat Archive
Stream: new members
Topic: Nat.pair_unpair rewrite not working
Matt Diamond (Apr 27 2025 at 00:40):
Here's something mildly annoying I just ran into:
import Mathlib
def f (P : Set ℕ) : ℕ →. ℕ := fun m => Nat.rfind (fun n => Part.assert (m.pair n ∈ P) fun _ => Part.some true)
example (P : Set ℕ) (P_re : REPred P) : Partrec (f P) :=
by
apply Partrec.rfind
rw [← Partrec₂.unpaired]
unfold Nat.unpaired
beta_reduce
simp_rw [Nat.pair_unpair] -- why isn't this working?
sorry
Any idea why the rewrite isn't working? It would seem to match perfectly... the goal state is:
Partrec fun n => Part.assert (Nat.pair (Nat.unpair n).1 (Nat.unpair n).2 ∈ P) fun x => Part.some true
which you would think could be rewritten to:
Partrec fun n => Part.assert (n ∈ P) fun x => Part.some true
but no dice.
Aaron Liu (Apr 27 2025 at 00:41):
Part.assert
is dependent
Matt Diamond (Apr 27 2025 at 00:42):
ah
Matt Diamond (Apr 27 2025 at 00:42):
alright, maybe I just need to do a Partrec.of_eq
instead
Matt Diamond (Apr 27 2025 at 00:43):
(don't finish this for me, though hints are welcome)
Matt Diamond (Apr 27 2025 at 00:48):
yeah I just needed to go the Partrec.of_eq
route, thanks
Last updated: May 02 2025 at 03:31 UTC