AK
assert_eq([], reverse([]))
assert_eq([1], reverse([1]))
assert_eq([2,1], reverse([1,2]))
assert_eq([3,2,1], reverse([1,2,3]))
assert_eq([1,2,3,1], reverse([1,3,2,1]))
Дальше по индукции должно работать. А ну ломайте
Size: a a a
AK
AZ
AK
AZ
p
AZ
AZ
AZ
AZ
AZ
DS
DS
DS
DS
AK
AZ
AZ
AZ
foldlRhs : (f : b -> a -> b) ->
(init : b) ->
(x : a) ->
(xs : List a) ->
foldl f init (xs ++ [x]) = f (foldl f init xs) x
foldlRhs f init x [] = Refl
foldlRhs f init x (y :: xs) = foldlRhs f (f init y) x xs
revCorrect : (xs : List a) ->
(f : b -> a -> b) ->
(init : b) ->
foldl f init (revDumb xs) = foldr (flip f) init xs
revCorrect [] f init = Refl
revCorrect (x :: xs) f init = let rec = revCorrect xs f init in
rewrite sym rec in foldlRhs f init x (revDumb xs)
AZ
AZ