on-internet
← Community

Agda list last of a generic list of naturals concatenated with a list of 1

Stack Overflow ·

I have the function: natListLast : List ℕ → ℕ natListLast [] = 0 natListLast nats@(x ∷ xs) = v.last (v.fromList nats) When I do _ : natListLast (2 l.∷ l.[] l.++ 1 l.∷ l.[]) ≡ 1 _ = refl I don't get any error. But when I try to generalize this to an arbitrary List nat like so: natListConcatLast : (nats : List ℕ) → natListLast (nats l.++ 1 l.∷ l.[]) ≡ 1 natListConcatLast [] = refl natListConcatLast nats@(x ∷ xs) = ? I'm not sure what to replace ? with. I tried starting with begin: natListConcatLast : (nats : List ℕ) → natListLast (nats l.++ 1 l.∷ l.[]) ≡ 1 natListConcatLast [] = refl natListConc

Comments

Sign in or sign up to comment and upvote.

No comments yet.