从匹配中提取相等性证据

extracting evidence of equality from match

我正在努力完成以下工作:

    Definition gen `{A:Type}
           {i o: nat}
           (f: nat -> (option nat))
           {ibound: forall (n n':nat), f n = Some n' -> n' < i}
           (x: svector A i) (t:nat) (ti: t < o): option A
  := match (f t) with
     | None => None
     | Some t' => Vnth x (ibound t t' _)
     end.

代替最后一个“_”,我需要 "f t" 等于 "Some t'" 的证据。我不知道如何从比赛中得到它。 Vnth 定义为:

Vnth
     : ∀ (A : Type) (n : nat), vector A n → ∀ i : nat, i < n → A

编写此函数需要一个所谓的 convoy 模式 的实例(参见 here)。我相信以下内容应该有效,但我无法对其进行测试,因为我没有您的其余定义。

Definition gen `{A:Type}
           {i o: nat}
           (f: nat -> (option nat))
           {ibound: forall (n n':nat), f n = Some n' -> n' < i}
           (x: svector A i) (t:nat) (ti: t < o): option A
  := match f t as x return f t = x -> option A with
     | None => fun _ => None
     | Some t' => fun p => Vnth x (ibound t t' p)
     end (eq_refl (f t)).