(**************************************************************)
(*   Copyright Dominique Larchey-Wendling [*]                 *)
(*                                                            *)
(*                             [*] Affiliation LORIA -- CNRS  *)
(**************************************************************)
(*      This file is distributed under the terms of the       *)
(*         CeCILL v2 FREE SOFTWARE LICENSE AGREEMENT          *)
(**************************************************************)
Set Implicit Arguments.
Section fin_reif.
Variable (X : Type) (R : nat -> X -> Prop).
Fact fin_reif n : (forall i, i < n -> exists x, R i x)
-> exists s, forall i (Hi : i < n), R i (s i Hi).
End fin_reif.
Fact fin_reif_nat (R : nat -> nat -> Prop) n :
(forall i, i < n -> ex (R i)) -> exists s, forall i, i < n -> R i (s i).
Section bounded_search.

Lemma first_non_zero (f : nat -> nat) n : f 0 = 0 -> f n <> 0 -> exists i, i < n /\ (forall k, k <= i -> f k = 0) /\ f (i+1) <> 0.
End bounded_search.