Discussion:
[Agda] type of []
Sergei Meshveliani
2018-04-17 12:22:13 UTC
Permalink
People,

In the proof

take-n-[] : {n : ℕ} → take n [] ≡ []
take-n-[] {0} = refl
take-n-[] {suc _} = refl

Agda cannot derive the type of [].
I can fix the signature in two ways.

(I)
take-n-[] : ∀ {α} {A : Set α} {n} → let []A : List A -- lenghty
[]A = []
in
take n []A ≡ []

(II)
El : ∀ {a} (A : Set a) → A → A -- for common usage
El A x = x --
--
syntax El A x = x ∈: A --

take-n-[] : ∀ {α} {A : Set α} {n} → take n ([] ∈: List A) ≡ []

What is a regular approach, please?

------
Sergei
Thorsten Altenkirch
2018-04-17 12:52:36 UTC
Permalink
Not sure what is the "regular" way but could you not just supply the implicit argument to [] (or to take)?

take-n-[] : ∀ {α} {A : Set α} {n} → take n ([] {A}) ≡ []

or

take-n-[] : ∀ {α} {A : Set α} {n} → take {A} n [] ≡ []


On 17/04/2018, 13:45, "Agda on behalf of Sergei Meshveliani" <agda-***@lists.chalmers.se on behalf of ***@botik.ru> wrote:

People,

In the proof

take-n-[] : {n : ℕ} → take n [] ≡ []
take-n-[] {0} = refl
take-n-[] {suc _} = refl

Agda cannot derive the type of [].
I can fix the signature in two ways.

(I)
take-n-[] : ∀ {α} {A : Set α} {n} → let []A : List A -- lenghty
[]A = []
in
take n []A ≡ []

(II)
El : ∀ {a} (A : Set a) → A → A -- for common usage
El A x = x --
--
syntax El A x = x ∈: A --

take-n-[] : ∀ {α} {A : Set α} {n} → take n ([] ∈: List A) ≡ []

What is a regular approach, please?

------
Sergei

_______________________________________________
Agda mailing list
***@lists.chalmers.se
https://lists.chalmers.se/mailman/listinfo/agda





This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment.

Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored
where permitted by law.
Sergei Meshveliani
2018-04-17 20:04:49 UTC
Permalink
Post by Thorsten Altenkirch
Not sure what is the "regular" way but could you not just supply the implicit argument to [] (or to take)?
take-n-[] : ∀ {α} {A : Set α} {n} → take n ([] {A}) ≡ []
or
take-n-[] : ∀ {α} {A : Set α} {n} → take {A} n [] ≡ []
Thank you.
This is exactly what is needed.
I knew that I was missing some simple point, but just did not recall
that `take' or [] can be given implicit argument!

------
Sergei
Post by Thorsten Altenkirch
People,
In the proof
take-n-[] : {n : ℕ} → take n [] ≡ []
take-n-[] {0} = refl
take-n-[] {suc _} = refl
Agda cannot derive the type of [].
I can fix the signature in two ways.
[..]
Loading...