diff --git a/examples/Example_tree_weight.thy b/examples/Example_tree_weight.thy index 74f32bf..b0d5b57 100644 --- a/examples/Example_tree_weight.thy +++ b/examples/Example_tree_weight.thy @@ -12,13 +12,16 @@ fun ins :: "'a::linorder \ 'a tree \ 'a tree" where else Node l y r)" definition root_or :: "'a \ 'a tree \ 'a list" where - "root_or d t = [case t of Leaf \ d | Node _ x _ \ x]" + "root_or d t = [case t of Leaf \ d + | Node _ x _ \ x]" -fun fold_tree :: "('b \ 'a \ 'b \ 'b) \ 'b \ 'a tree \ 'b" where +fun fold_tree :: "('b \ 'a \ 'b \ 'b) \ 'b \ 'a tree + \ 'b" where "fold_tree f e Leaf = e" | "fold_tree f e (Node l x r) = f (fold_tree f e l) x (fold_tree f e r)" -definition from_list :: "'a::linorder list \ 'a tree" where +definition from_list :: "'a::linorder list + \ 'a tree" where "from_list xs = foldr ins xs Leaf" class weight = @@ -39,7 +42,8 @@ begin end definition example_weight :: nat where - "example_weight = calc_weight (Node Leaf (Node Leaf (7::nat) Leaf) Leaf)" + "example_weight = calc_weight (Node Leaf + (Node Leaf (7::nat) Leaf) Leaf)" export_code ins root_or fold_tree from_list example_weight