Zulip Chat Archive
Stream: mathlib4
Topic: List notation is broken by conditional probability
Eric Wieser (Mar 07 2025 at 17:48):
import Mathlib
open scoped ProbabilityTheory
theorem help : Nat.ofDigits 10 [0, 1] = 10 := rfl -- syntax error
Eric Wieser (Mar 07 2025 at 17:49):
This is caused by notations like
/-- The conditional probability measure of measure `μ` on set `{ω | X ω = x}`.
It is `μ` restricted to `{ω | X ω = x}` and scaled by the inverse of `μ {ω | X ω = x}`
(to make it a probability measure): `(μ {ω | X ω = x})⁻¹ • μ.restrict {ω | X ω = x}`. -/
scoped notation:max μ "[" s " | " X " in " t "]" => μ[s | X ⁻¹' t]
Eric Wieser (Mar 07 2025 at 17:55):
#22699 has a fix, but it loses all the delaborators
Eric Wieser (Mar 07 2025 at 17:55):
@Kyle Miller, could notation
or notation3
be taught to accept noWs
?
Eric Wieser (Mar 07 2025 at 18:24):
(deleted)
Eric Wieser (Mar 07 2025 at 18:27):
cc @Yaël Dillies for #18663
Eric Wieser (Mar 07 2025 at 18:29):
Oh whoops, I forgot to open the scope for that one, sorry
Eric Wieser (Mar 07 2025 at 18:47):
Eric Wieser said:
#22699 has a fix, but it loses all the delaborators
I've added back the delaborators now.
Kyle Miller (Mar 07 2025 at 19:00):
Eric Wieser said:
Kyle Miller, could
notation
ornotation3
be taught to acceptnoWs
?
I think so, but it might take re-imagining how they work to some degree.
By the way, in your PR, it looks like you can use an app unexpander for everything but DFunLike.coe
. App unexpanders are nice because they look like the inverse of the macro. (notation
defines app unexpanders)
Eric Wieser (Mar 07 2025 at 19:05):
Done, thanks for the reminder than unexpanders exist
Eric Wieser (Mar 09 2025 at 22:07):
Would it be possible for errors like "expected |" to appear as "expected | (from parser Foo.bar and Bar.baz)" to make this kind of trap easier to track down in future
Edward van de Meent (Mar 10 2025 at 12:21):
or at least an option to enable this kind of debug message
Aaron Liu (Mar 10 2025 at 12:29):
Eric Wieser said:
Would it be possible for errors like "expected |" to appear as "expected | (from parser Foo.bar and Bar.baz)" to make this kind of trap easier to track down in future
the code is docs#Lean.Parser.Error.toString
Last updated: May 02 2025 at 03:31 UTC