Definition data_beq a b :=
match a, b with
| fnil t1, fnil t2
| fcons t1, fcons t2
| fappend t1, fappend t2 => typ_beq t1 t2
| fnth_error t1 n1, fnth_error t2 n2
| freplace_nth t1 n1, freplace_nth t2 n2 => andb (beq_nat n1 n2) (typ_beq t1 t2)
| fmap ta1 tb1, fmap ta2 tb2
| ffold_right ta1 tb1, ffold_right ta2 tb2
| ffold_left ta1 tb1, ffold_left ta2 tb2 => andb (typ_beq ta1 ta2) (typ_beq tb1 tb2)
| fleaf t, fleaf t'
| fnode t, fnode t'
| fempty t, fempty t' => typ_beq t t'
| _ , _ => false
end.

Lemma data_beq_sound : forall a b, data_beq a b = true -> a = b.