There are a tree data structure and a flip
method for it. I want to write a proof that if you apply the flip
method to a tree twice you get initial tree. I've got a goal
⊢ flip_mytree (flip_mytree (mytree.branch t_ᾰ t_ᾰ_1 t_ᾰ_2)) = mytree.branch t_ᾰ t_ᾰ_1 t_ᾰ_2
and I want to replace flip_mytree (mytree.branch t_ᾰ t_ᾰ_1 t_ᾰ_2)
with result of flip_mytree
. How may I do that? Or how can I pull (mytree.branch a l r) := mytree.branch a (flip_mytree r) (flip_mytree l)
hypothesis from the flip_mytree
function definition into my theorem context?
I've read about rw
, apply
and have
tactics but they seems to be useless here.
A whole example is down below.
universes u
inductive mytree (A : Type u) : Type u
| leaf : A → mytree
| branch : A → mytree → mytree → mytree
def flip_mytree {A : Type u} : mytree A → mytree A
| t@(mytree.leaf _) := t
| (mytree.branch a l r) := mytree.branch a (flip_mytree r) (flip_mytree l)
theorem flip_flip {A : Type u} {t : mytree A} : flip_mytree (flip_mytree t) = t :=
begin
cases t,
end