I'm trying to prove:
AddTodoSetsNewCompletedToFalse :
∀ {n : ℕ} (todos : Vec Todo (1 + n)) (text : String) →
Todo.completed (last (AddTodo todos text)) ≡ false
AddTodoSetsNewCompletedToFalse todos text = ?
where
AddTodoLastAddedElementIsTodo :
∀ {a} {A : Set a} {n} (todos : Vec Todo n) (text : String) →
last (AddTodo todos text) ≡
record
{ id = 1
; completed = false
; text = text
}
AddTodoLastAddedElementIsTodo todos text = vecLast todos
and
vecLast : ∀ {a} {A : Set a} {l n} (xs : Vec A n) → last (xs ∷ʳ l) ≡ l
vecLast [] = refl
vecLast (_ ∷ xs) = P.trans (prop (xs ∷ʳ _)) (vecLast xs)
where
prop : ∀ {a} {A : Set a} {n x} (xs : Vec A (suc n)) → last (x ∷ xs) ≡ last xs
prop xs with initLast xs
... | _ , _ , refl = refl
I tried using rewrite
and got:
AddTodoSetsNewCompletedToFalse :
∀ {a} {A : Set a} {n} (todos : Vec Todo n) (text : String) →
Todo.completed (last (AddTodo todos text)) ≡ false
AddTodoSetsNewCompletedToFalse todos text rewrite AddTodoLastAddedElementIsTodo todos text = refl
but the error:
_a_100 : Agda.Primitive.Level
showed up.
I'm not sure how to resolve this. from here I understand that this is related to the implicit argument. But not sure how to fix it
This sort of error indicates an unsolved metavariable, which means that Agda has failed to infer an implicit argument
Thanks!