The equational compiler was failing to generate equational lemmas for equations such as: def f : nat → nat → nat | (x+1) (y+1) := f (x+10) y | _ _ := 1 It would fail when trying to prove the following equation: forall x, f 0 x = 1 using a "refl" proof. This equation does not hold definitionally. It is not blocked by the internal pattern matching based on the cases_on recursor, but it is blocked by the outer most brec_on used to implement structural recursion. The solution is to "complete" the set of equations. So, the structural_rec module will replace the equation above with def f : nat → nat → nat | (x+1) (y+1) := f (x+10) y | _ 0 := 1 | _ (y+1) := 1 and then (as before) def f : Pi (x y : nat), below y → nat | (x+1) (y+1) F := F^.fst^.fst (x+10) | _ 0 F := 1 | _ (y+1) F := 1
17 lines
246 B
Text
17 lines
246 B
Text
def f : nat → nat → nat
|
|
| (x+1) (y+1) := f (x+10) y
|
|
| _ _ := 1
|
|
|
|
vm_eval f 1 1000
|
|
|
|
example (x y) : f (x+1) (y+1) = f (x+10) y :=
|
|
rfl
|
|
|
|
example (y) : f 0 (y+1) = 1 :=
|
|
rfl
|
|
|
|
example (x) : f (x+1) 0 = 1 :=
|
|
rfl
|
|
|
|
example : f 0 0 = 1 :=
|
|
rfl
|