Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/Isabelle/HOL/Data_Structures/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 1 kB image not shown  

Quelle  Tree23.thy   Sprache: Isabelle

 
(* Author: Tobias Nipkow *)

section \<open>2-3 Trees\<close>

theory Tree23
imports Main
begin

class height =
fixes height :: "'a \ nat"

datatype 'a tree23 =
  Leaf (\<open>\<langle>\<rangle>\<close>) |
  Node2 "'a tree23" 'a "'a tree23" (\\_, _, _\\) |
  Node3 "'a tree23" 'a "'a tree23" 'a "'a tree23" (\\_, _, _, _, _\\)

fun inorder :: "'a tree23 \ 'a list" where
"inorder Leaf = []" |
"inorder(Node2 l a r) = inorder l @ a # inorder r" |
"inorder(Node3 l a m b r) = inorder l @ a # inorder m @ b # inorder r"


instantiation tree23 :: (type)height
begin

fun height_tree23 :: "'a tree23 \ nat" where
"height Leaf = 0" |
"height (Node2 l _ r) = Suc(max (height l) (height r))" |
"height (Node3 l _ m _ r) = Suc(max (height l) (max (height m) (height r)))"

instance ..

end

text \<open>Completeness:\<close>

fun complete :: "'a tree23 \ bool" where
"complete Leaf = True" |
"complete (Node2 l _ r) = (height l = height r \ complete l & complete r)" |
"complete (Node3 l _ m _ r) =
  (height l = height m & height m = height r & complete l & complete m & complete r)"

lemma ht_sz_if_complete: "complete t \ 2 ^ height t \ size t + 1"
by (induction t) auto

end

89%


¤ Dauer der Verarbeitung: 0.2 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.