-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathtree_bij.html
47 lines (37 loc) · 919 Bytes
/
tree_bij.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html>
<title> Representing trees with functions (continued) </title>
<body>
<h1> Representing trees with functions (continued) </h1>
Consider the following inductive types for binary trees (with nodes
labeled by integers).
<pre>
Require Import ZArith.
Inductive Z_btree : Set :=
Z_leaf : Z_btree |
Z_bnode : Z -> Z_btree -> Z_btree -> Z_btree.
Inductive Z_fbtree : Set :=
| Z_fleaf : Z_fbtree
| Z_fnode : Z -> (bool -> Z_fbtree) -> Z_fbtree.
</pre>
Define functions :
<pre>
f1 : Z_btree : Z_fbtree
f2 : Z_fbtree : Z_btree
</pre>
that establish the most natural bijection between the two types.
<br>
Prove the following theorem:
<pre>
Theorem f2_f1 : forall t: Z_btree, f2 (f1 t) = t.
</pre>
What is missing to prove the following statement?
<pre>
Theorem f1_f2 : forall t: Z_fbtree, f1 (f2 t) = t.
</pre>
<h2>Solution</h2>
<a href="SRC/tree_bij.v"> This file </a>
<br>
<br>
<hr>
</body>
</html>