Instance list_PCM (P : Ghost) : Ghost := { valid a := True; Join_G := list_join }.

(* up *)
Lemma replace_nth_app : forall {A} n l1 l2 (a : A),
replace_nth n (l1 ++ l2) a = if lt_dec n (length l1) then replace_nth n l1 a ++ l2
else l1 ++ replace_nth (n - length l1) l2 a.