Definition singleton {A} k (x : A) : list (option A) := repeat None k ++ Some x :: nil.Definition gname := nat.Definition list_set {A} (m : list (option A)) k v : list (option A) :=
  firstn k m ++ repeat None (k - length m) ++ Some v :: skipn (S k) m.

Lemma ghost_fmap_singleton_inv : forall f g a k v, ghost_fmap f g a = singleton k v -> exists v', a = singleton k v' /\ v = let (a, b) := v' in (a, preds_fmap f g b).