Question: Agda module ind 1 where open import lib open import ntree thm 1 : ( n : ) - > list - any iszero (
Agda
module ind where
open import lib
open import ntree
thm : n : listany iszero repeat n ff
thm
treeMapId : t : Tree treeMap lambda x x t t
treeMapId
mirroring a tree twice gives you back the original tree
mirrormirror : t : Tree mirror mirror t t
mirrormirror
The number of leaves in a perfect tree of height n is to the n
I found I needed the theorem from natthmsagda
perfectnumLeaves : n : numLeaves perfect n pow n
perfectnumLeaves
the size of a perfect binary tree of depth n is to the n minus
I needed suc
perfectsize : n : suc size perfect n pow suc n
perfectsize
simple Tree type storing natural numbers
data Tree : Set where
Node : Tree Tree Tree
Leaf : Tree
a few functions on trees, used in problems in some of the indagda files
flip left and right subtrees throughout a tree
mirror : Tree Tree
mirror Node x t t Node x mirror tmirror t
mirror Leaf Leaf
construct the perfect binary tree whose depth is the input number
perfect : Tree
perfect zero Leaf
perfect suc n Node perfect nperfect n
count the number of leaves in a tree
numLeaves : Tree
numLeaves Node x t t numLeaves t numLeaves t
numLeaves Leaf
count the number of constructors either Leaf or Node in a Tree
size : Tree
size Node x t t size t size t
size Leaf
apply a function to every number stored in a tree, returning the resulting tree
treeMap : Tree Tree
treeMap f Leaf Leaf
treeMap f Node x t t Node f xtreeMap f ttreeMap f t
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
