Goal:
  
  A : Type
  B : Type
  f : nat -> A -> option B
  a : A
  l : list A
  t : B
  IHl : forall (l' : list B) (i n : nat),
        map_option_out (mapi_rec f l n) = Some l' ->
        nth_error l' i = Some t ->
        ∑ x : A, nth_error l i = Some x /\ f (i + n)%nat x = Some t
  n : nat
  Heq : f n a = Some t
  l0 : list B
  Heq' : map_option_out (mapi_rec f l (S n)) = Some l0
  ============================
   (Some a = Some a /\ f n a = Some t)


DEBUG:Going to execute:
let rec use_hyp H :=
            match type of H with
            | _ /\ _ => exact H || destruct_hyp H
            | _ * _ => exact H || destruct_hyp H
            | _ => try (solve [ inversion H ])
            end
           with do_intro := let H := fresh in
                            intro H; use_hyp H
           with destruct_hyp H := case H; clear H; do_intro; do_intro
           in
           let rec use_hyps :=
            match goal with
            | H:_ /\ _ |- _ => exact H || (destruct_hyp H; use_hyps)
            | H:_ * _ |- _ => exact H || (destruct_hyp H; use_hyps)
            | H:_ |- _ => solve [ inversion H ]
            | _ => idtac
            end
           in
           let do_atom := solve
           [ trivial
           with eq_true
           | Init.reflexivity
           | Init.symmetry; trivial
           | contradiction
           | congruence ]
           in
           let rec do_ccl :=
            try do_atom; repeat (do_intro; try do_atom); try arith_congr;
             (solve [ Init.split; do_ccl ])
           in
           (solve [ do_atom | use_hyps; do_ccl ]) ||
             fail "Cannot solve this goal"