Definition codeIn (a l : nat) : nat :=
  evalStrongRec 1
    (fun n Hrecs p1 : nat =>
     switchPR n
       (switchPR (charFunction 2 beq_nat (cPairPi1 (pred n)) p1) 1
          (codeNth (n - S (cPairPi2 (pred n))) Hrecs)) 0) l a.

Lemma codeInCorrect : forall (a : nat) (l : list nat), codeIn a (codeList l) = match In_dec eq_nat_dec a l with | left _ => 1 | right _ => 0 end.