Zulip Chat Archive

Stream: new members

Topic: reserved words


Patrick Thomas (Feb 12 2022 at 21:42):

Is there a way to have forall as a constructor, by requiring it to be used as formula.forall or something similar?

inductive formula : Type
| false : formula
| true : formula
| var : string  formula
| not : formula  formula
| and : formula  formula  formula
| or : formula  formula  formula
| imp : formula  formula  formula
| iff : formula  formula  formula
| forall : string  formula  formula
| exists : string  formula  formula

Yaël Dillies (Feb 12 2022 at 21:46):

Write it «forall», with \f<< and \f>>

Yaël Dillies (Feb 12 2022 at 21:47):

You'll probably have to write «exists»as well.

Patrick Thomas (Feb 12 2022 at 22:01):

Thank you!

Eric Wieser (Feb 12 2022 at 22:13):

Or \f<<>> which will type both at once

Yaël Dillies (Feb 12 2022 at 22:14):

Oh, didn't know about that one!

Patrick Thomas (Feb 12 2022 at 22:14):

What does this syntax mean? Is it just for this purpose or something more general?

Kyle Miller (Feb 12 2022 at 22:26):

It's the quotation notation for names in Lean. It lets you use characters that aren't permitted for unquoted names:

namespace «zulip people»

def «Patrick Thomas» : string := "that is Patrick's name"

end «zulip people»

#eval «zulip people».«Patrick Thomas»

Patrick Thomas (Feb 12 2022 at 22:27):

I see. Thank you.


Last updated: Dec 20 2023 at 11:08 UTC