entrytree_replace_f (e:et) (Loc (n:loc)) f
    | n>0 = (e:et2, x)
    where
        (et2, x) = entrytree_replace_f et (Loc ((n-1):loc)) f
entrytree_replace_f (e:et) (Loc (n:loc)) f
    | n>0 = (e:et2, x)
    where
        (et2, x) = entrytree_replace_f et (Loc ((n-1):loc)) f
entrytree_replace_f (e:et) (Loc (n:loc)) f
    | n>0 = (e:et2, x)
    where
        (et2, x) = entrytree_replace_f et (Loc ((n-1):loc)) f