Zulip Chat Archive

Stream: general

Topic: fruitUniverse


Phiroc (Apr 06 2020 at 07:04):

Hello,
in the below code, why is Π of type fruitUniverse, not, say, fruitType,
because it is a Proposition? What does the universe have to do
with the proposition?

Many thanks.

Phiroc

universe fruitUniverse
constant fruitType : Type
constants ft1 ft2 : fruitType

-- Prop = Statement
-- apple and apple are equal atoms
#check ft1 = ft2

namespace hidden
constant list : Type fruitUniverse → Type fruitUniverse
-- variables l : list fruitType
namespace list
    constant cons' : Π fruitType : Type fruitUniverse, fruitType → list fruitType → list fruitType
    constant nil' : Π fruitType  : Type fruitUniverse, list fruitType
    constant append' : Π fruitType : Type fruitUniverse, list fruitType → list fruitType → list fruitType
end list
end hidden

lean

Yury G. Kudryashov (Apr 06 2020 at 07:07):

Please add "lean" after opening "```", then syntax highlighting will work.

Kenny Lau (Apr 06 2020 at 07:08):

also I didn't understand the question

Yury G. Kudryashov (Apr 06 2020 at 07:11):

Note that fruitType in Π fruitType ... has nothing to do with constant fruitType : Type

Phiroc (Apr 06 2020 at 07:11):

I'm trying to create a cons' function which I can later use to create a list of Fruits. The only way to make Lean validate the above code is to make Π fruitType of type fruitUniverse.

Phiroc (Apr 06 2020 at 07:12):

What is Π? A Prop?

Phiroc (Apr 06 2020 at 07:13):

If I understand Lean, to create a cons function, you need to create a Proposal, Π.

Yury G. Kudryashov (Apr 06 2020 at 07:20):

  1. universe is a way to deal with "type of all types"; most probably you don't need it.
  2. Π is a pi type, not a proposition. E.g., Π n : nat, {m : nat // n < m} means "a function that takes a natural number n and returns another natural number m together with a proof of the fact n < m.
  3. constant is like an axiom, not a variable. When you declare constant list, it declares a type named hidden.list with no extra information about this type.

Kenny Lau (Apr 06 2020 at 07:20):

this isn’t C; there is no preamble

Kenny Lau (Apr 06 2020 at 09:29):

y'all like tomatos very much even though it isn't a fruit fruit

Marc Huisinga (Apr 06 2020 at 09:30):

i did my best to counteract the bias for tomatoes

Sebastian Ullrich (Apr 06 2020 at 09:45):

Does the fruit universe also contain fruit Pies, or is it predicative?


Last updated: Dec 20 2023 at 11:08 UTC