Mul_Collector_def: fixes n :: "nat" shows "Mul_Collector n \<equiv> \<lbrace>\<acute>Mul_Proper n\<rbrace>  WHILE True INV \<lbrace>\<acute>Mul_Proper n\<rbrace>  DO Mul_Blacken_Roots n;; \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M\<rbrace> \<acute>obc := {};; \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>obc = {}\<rbrace> \<acute>bc := Roots;; \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>obc = {} \<and> \<acute>bc = Roots\<rbrace> \<acute>l := 0;; \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>obc = {} \<and> \<acute>bc = Roots \<and> \<acute>l = 0\<rbrace>  WHILE \<acute>l < n + 1 INV \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>bc \<subseteq> Blacks \<acute>M \<and> (\<acute>Safe \<or> (\<acute>l \<le> \<acute>Queue \<or> \<acute>bc \<subset> Blacks \<acute>M) \<and> \<acute>l < n + 1)\<rbrace>  DO \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>bc \<subseteq> Blacks \<acute>M \<and> (\<acute>Safe \<or> \<acute>l \<le> \<acute>Queue \<or> \<acute>bc \<subset> Blacks \<acute>M)\<rbrace> \<acute>obc := \<acute>bc;; Mul_Propagate_Black n;; \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>obc \<subseteq> Blacks \<acute>M \<and> \<acute>bc \<subseteq> Blacks \<acute>M \<and> (\<acute>Safe \<or> \<acute>obc \<subset> Blacks \<acute>M \<or> \<acute>l < \<acute>Queue \<and> (\<acute>l \<le> \<acute>Queue \<or> \<acute>obc \<subset> Blacks \<acute>M))\<rbrace> \<acute>bc := {};; \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>obc \<subseteq> Blacks \<acute>M \<and> \<acute>bc \<subseteq> Blacks \<acute>M \<and> (\<acute>Safe \<or> \<acute>obc \<subset> Blacks \<acute>M \<or> \<acute>l < \<acute>Queue \<and> (\<acute>l \<le> \<acute>Queue \<or> \<acute>obc \<subset> Blacks \<acute>M)) \<and> \<acute>bc = {}\<rbrace> \<langle>\<acute>Ma := \<acute>M,, \<acute>q := \<acute>Queue\<rangle>;; Mul_Count n;; \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>obc \<subseteq> Blacks \<acute>Ma \<and> Blacks \<acute>Ma \<subseteq> Blacks \<acute>M \<and> \<acute>bc \<subseteq> Blacks \<acute>M \<and> length \<acute>Ma = length \<acute>M \<and> Blacks \<acute>Ma \<subseteq> \<acute>bc \<and> (\<acute>Safe \<or> \<acute>obc \<subset> Blacks \<acute>Ma \<or> \<acute>l < \<acute>q \<and> (\<acute>q \<le> \<acute>Queue \<or> \<acute>obc \<subset> Blacks \<acute>M)) \<and> \<acute>q < n + 1\<rbrace>  IF \<acute>obc = \<acute>bc THEN \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>obc \<subseteq> Blacks \<acute>Ma \<and> Blacks \<acute>Ma \<subseteq> Blacks \<acute>M \<and> \<acute>bc \<subseteq> Blacks \<acute>M \<and> length \<acute>Ma = length \<acute>M \<and> Blacks \<acute>Ma \<subseteq> \<acute>bc \<and> (\<acute>Safe \<or> \<acute>obc \<subset> Blacks \<acute>Ma \<or> \<acute>l < \<acute>q \<and> (\<acute>q \<le> \<acute>Queue \<or> \<acute>obc \<subset> Blacks \<acute>M)) \<and> \<acute>q < n + 1 \<and> \<acute>obc = \<acute>bc\<rbrace> \<acute>l := \<acute>l + 1 ELSE \<lbrace>\<acute>Mul_Proper n \<and> Roots \<subseteq> Blacks \<acute>M \<and> \<acute>obc \<subseteq> Blacks \<acute>Ma \<and> Blacks \<acute>Ma \<subseteq> Blacks \<acute>M \<and> \<acute>bc \<subseteq> Blacks \<acute>M \<and> length \<acute>Ma = length \<acute>M \<and> Blacks \<acute>Ma \<subseteq> \<acute>bc \<and> (\<acute>Safe \<or> \<acute>obc \<subset> Blacks \<acute>Ma \<or> \<acute>l < \<acute>q \<and> (\<acute>q \<le> \<acute>Queue \<or> \<acute>obc \<subset> Blacks \<acute>M)) \<and> \<acute>q < n + 1 \<and> \<acute>obc \<noteq> \<acute>bc\<rbrace> \<acute>l := 0 FI OD;; Mul_Append n OD"