Zulip Chat Archive
Stream: lean4
Topic: Regarding open ... in
Ioannis Konstantoulas (Aug 11 2023 at 18:26):
I would like to open Nat
in a theorem I am writing, but it seems like open ... in
does not work as I expected. As a mwe, I want to remove the Nat
prefix in the following:
theorem exampl : 0 < 1 :=
Nat.zero_lt_of_ne_zero Nat.one_ne_zero
If I preface with open Nat in
, I get
open Nat in
theorem exampl : 0 < 1 :=
zero_lt_of_ne_zero one_ne_zero
unknown identifier 'one_ne_zero'
The first identifier is understood correctly as Nat. zero_lt_of_ne_zero
, but the second one is not. Why is this, and what is the right way to open namespaces in restricted contexts?
Ruben Van de Velde (Aug 11 2023 at 18:29):
I suspect one_ne_zero is protected
Ioannis Konstantoulas (Aug 11 2023 at 18:30):
Ruben Van de Velde said:
I suspect one_ne_zero is protected
Ooh, thanks Ruben! I had forgotten about this possibility; I am sure that is why.
Eric Wieser (Aug 11 2023 at 20:25):
This works:
open Nat in
open Nat (one_ne_zero) in
theorem exampl : 0 < 1 :=
zero_lt_of_ne_zero one_ne_zero
Ioannis Konstantoulas (Aug 11 2023 at 21:32):
Thanks for letting me know about this functionality!
Last updated: Dec 20 2023 at 11:08 UTC