With enough experience at Haskell, I recently started using Idris to prove the theorem. This is a minimal example illustrating the problem that I encountered when trying to prove fairly simple statements.
Consider that we have a complete function test:
total test : Integer -> Integer
test 1 = 1
test n = n
Of course, we see that the function can be simplified to test n = n, but let it prove. I just look through all the cases:
total lemma_test : (n : Integer) -> test n = n
lemma_test 1 = Refl
lemma_test n = Refl
But this does not check the type:
Type mismatch between
n = n (Type of Refl) and
test n = n (Expected type)
Specifically:
Type mismatch between
n
and
test n
So the problem is that Idris cannot conclude the second case lemma_test, which is nnot the same 1and that the second case should also apply test.
, , , , Integer s:
total lemma_test : (n : Integer) -> test n = n
lemma_test 1 = Refl
lemma_test 2 = Refl
lemma_test 3 = Refl
...
, , , , test ?
, , , , .