Zulip Chat Archive

Stream: lean4

Topic: Expected token


Dean Young (Dec 30 2022 at 22:27):

import Init.Data.ToString.Basic

does anyone know why the second line here gives "expected token"?

def Cat :=
Σ(Obj:Type 1),
Σ(Mor:Π(_:Obj),Π(_:Obj),(Type 1)),
Σ(Id:Π(X:Obj),Mor X X),
Σ(Mul:Π(X:Obj),Π(Y:Obj),Π(Z:Obj),Π(_:Mor X Y),Π(_:Mor Y Z),(Mor X Z)),
Σ(_:Π(X:Obj),Π(Y:Obj),Π(f:Mor X Y),Π(_:(Mul X Y Y) f (Id Y) = f),Unit),
Σ(_:Π(X:Obj),Π(Y:Obj),Π(f:Mor X Y),Π(_:(Mul X X Y) (Id X) f = f),Unit),
Σ(_:Π(X:Obj),Π(Y:Obj),Π(f:Mor X Y),Π(_:(Mul X X Y) (Id X) f = f),Unit),
Unit
def main := IO.println ""

Arthur Paulino (Dec 30 2022 at 22:37):

What's the type of Cat?

Reid Barton (Dec 30 2022 at 22:39):

You can't write pi types with a Π in Lean 4.

Dean Young (Dec 30 2022 at 22:40):

Reid Barton said:

You can't write pi types with a Π in Lean 4.

What is the correct way?

or if there isn't one how could I make notation like

notation Π => forall

Arthur Paulino (Dec 30 2022 at 22:43):

Is Cat a List? An Array? Prod?
I think that's a syntax error. You can't separate elements like that by just using comma and a linebreak

Dean Young (Dec 30 2022 at 22:45):

Arthur Paulino said:

Is Cat a List? An Array? Prod?
I think that's a syntax error. You can't separate elements like that by just using comma and a linebreak

I think it's Type 2

Arthur Paulino (Dec 30 2022 at 22:47):

Oh, wait, now I understood what you're trying to do

Dean Young (Dec 30 2022 at 22:52):

Arthur Paulino said:

Oh, wait, now I understood what you're trying to do

What do you think? Probably most people would have used structure, but I'm a bit of a purist :)

Arthur Paulino (Dec 30 2022 at 22:56):

I'm not sure. That's not the type of work that I usually do with Lean 4

Reid Barton (Dec 30 2022 at 23:00):

You can use instead, or the Agda-style (a : A) -> B a.

Reid Barton (Dec 30 2022 at 23:01):

Also, you can use spaces.


Last updated: Dec 20 2023 at 11:08 UTC