I have a bunch of sketches like this lying around in my home directory, and I'm sure that when I change computers again I will probably forget them. So I'm switching to github for my sketches.
This is a generalization of types, using propositions instead. Not intended as a high-assurance formal verification system, just as a guide like types. But more expressive than representation types.
In informal haskelly-mathematical language I might write something like this:
Definition: i is an index for xs if i is a natural number < length xs.
Definition: If i is an index for xs, then xs !! i is defined by:
(x:xs) !! 0 = x