Zulip Chat Archive

Stream: mathlib4

Topic: What does export do in Lean3


Chris Hughes (Mar 30 2023 at 14:53):

I'm trying to port model_theory/syntax. below the definition docs#first_order.language.term there is the line export term. What does this do and how do I port it to Lean4?

Yaël Dillies (Mar 30 2023 at 14:54):

It's like a perpetual open language (term). Not sure how to translate it.

Adam Topaz (Mar 30 2023 at 14:55):

https://leanprover.github.io/theorem_proving_in_lean/interacting_with_lean.html?highlight=export

Adam Topaz (Mar 30 2023 at 14:57):

And this suggests that it should work in lean4 as well: https://leanprover.github.io/theorem_proving_in_lean4/interacting_with_lean.html?highlight=export#more-on-namespaces

Adam Topaz (Mar 30 2023 at 14:59):

This works:

inductive Foo where | bar : Nat  Foo
--#check bar <-- error
export Foo (bar)
#check bar --<-- no error

Chris Hughes (Mar 30 2023 at 15:15):

Thanks

Kevin Buzzard (Mar 30 2023 at 16:54):

import category_theory.abelian.basic

namespace category_theory

export nat (succ)

#check succ -- succ : ℕ → ℕ

end category_theory

-- #check succ -- fails
-- #check category_theory.succ -- fails as well

open category_theory

#check succ -- succ : ℕ → ℕ

what a funny thing! I never knew you could do that.

Yaël Dillies (Mar 30 2023 at 16:56):

Oh, I knew it could do that, but I never considered whether we should. @Violeta Hernández, what do you think of export order (succ) in the namespace ordinal?

Violeta Hernández (Mar 30 2023 at 17:00):

Seems useful

Violeta Hernández (Mar 30 2023 at 17:00):

I think that's the only thing we use from that namespace


Last updated: Dec 20 2023 at 11:08 UTC