Zulip Chat Archive
Stream: new members
Topic: Is it possible to prove anything about IO calls?
Dan Abramov (Aug 31 2025 at 22:46):
This isn't anything practical but I'm curious if it's possible to prove anything about a program like this.
def main := do
IO.println "Hello"
Or is it fully opaque to theorems?
Eric Wieser (Aug 31 2025 at 23:26):
Well, you can prove main = main, or something like
def main := do
IO.println "Hello"
def main2 := do
IO.println ("H" ++ "ello")
example : main = main2 := rfl
Eric Wieser (Aug 31 2025 at 23:28):
But IO.println ultimately calls docs#IO.getStdout, which is opaque
Alfredo Moreira-Rosa (Aug 31 2025 at 23:30):
or even :
theorem exist_string_printed_main :
∃ (s : String), main = IO.println s := by
use "Hello"
rfl
Alfredo Moreira-Rosa (Aug 31 2025 at 23:33):
so definitely not opaque
Dan Abramov (Aug 31 2025 at 23:56):
I see, so I guess I can't unfold getStdout (which makes sense) but I can in principle unfold other stuff (including main itself and even some intermediate functions before we get too deep, though maybe that breaks encapsulation too much).
Last updated: Dec 20 2025 at 21:32 UTC