src/HOL/Imperative_HOL/ex/Imperative_Quicksort.thy
changeset 37806 a7679be14442
parent 37805 0f797d586ce5
child 37826 4c0a5e35931a
     1.1 --- a/src/HOL/Imperative_HOL/ex/Imperative_Quicksort.thy	Tue Jul 13 16:12:40 2010 +0200
     1.2 +++ b/src/HOL/Imperative_HOL/ex/Imperative_Quicksort.thy	Tue Jul 13 16:21:49 2010 +0200
     1.3 @@ -23,15 +23,15 @@
     1.4  
     1.5  lemma crel_swapI [crel_intros]:
     1.6    assumes "i < Array.length h a" "j < Array.length h a"
     1.7 -    "x = get_array h a ! i" "y = get_array h a ! j"
     1.8 +    "x = Array.get h a ! i" "y = Array.get h a ! j"
     1.9      "h' = Array.update a j x (Array.update a i y h)"
    1.10    shows "crel (swap a i j) h h' r"
    1.11    unfolding swap_def using assms by (auto intro!: crel_intros)
    1.12  
    1.13  lemma swap_permutes:
    1.14    assumes "crel (swap a i j) h h' rs"
    1.15 -  shows "multiset_of (get_array h' a) 
    1.16 -  = multiset_of (get_array h a)"
    1.17 +  shows "multiset_of (Array.get h' a) 
    1.18 +  = multiset_of (Array.get h a)"
    1.19    using assms
    1.20    unfolding swap_def
    1.21    by (auto simp add: Array.length_def multiset_of_swap dest: sym [of _ "h'"] elim!: crel_bindE crel_nthE crel_returnE crel_updE)
    1.22 @@ -55,8 +55,8 @@
    1.23  
    1.24  lemma part_permutes:
    1.25    assumes "crel (part1 a l r p) h h' rs"
    1.26 -  shows "multiset_of (get_array h' a) 
    1.27 -  = multiset_of (get_array h a)"
    1.28 +  shows "multiset_of (Array.get h' a) 
    1.29 +  = multiset_of (Array.get h a)"
    1.30    using assms
    1.31  proof (induct a l r p arbitrary: h h' rs rule:part1.induct)
    1.32    case (1 a l r p h h' rs)
    1.33 @@ -82,7 +82,7 @@
    1.34    next
    1.35      case False (* recursive case *)
    1.36      note rec_condition = this
    1.37 -    let ?v = "get_array h a ! l"
    1.38 +    let ?v = "Array.get h a ! l"
    1.39      show ?thesis
    1.40      proof (cases "?v \<le> p")
    1.41        case True
    1.42 @@ -130,7 +130,7 @@
    1.43  
    1.44  lemma part_outer_remains:
    1.45    assumes "crel (part1 a l r p) h h' rs"
    1.46 -  shows "\<forall>i. i < l \<or> r < i \<longrightarrow> get_array h (a::nat array) ! i = get_array h' a ! i"
    1.47 +  shows "\<forall>i. i < l \<or> r < i \<longrightarrow> Array.get h (a::nat array) ! i = Array.get h' a ! i"
    1.48    using assms
    1.49  proof (induct a l r p arbitrary: h h' rs rule:part1.induct)
    1.50    case (1 a l r p h h' rs)
    1.51 @@ -145,7 +145,7 @@
    1.52    next
    1.53      case False (* recursive case *)
    1.54      note rec_condition = this
    1.55 -    let ?v = "get_array h a ! l"
    1.56 +    let ?v = "Array.get h a ! l"
    1.57      show ?thesis
    1.58      proof (cases "?v \<le> p")
    1.59        case True
    1.60 @@ -163,7 +163,7 @@
    1.61          unfolding part1.simps[of a l r p]
    1.62          by (elim crel_bindE crel_nthE crel_ifE crel_returnE) auto
    1.63        from swp rec_condition have
    1.64 -        "\<forall>i. i < l \<or> r < i \<longrightarrow> get_array h a ! i = get_array h1 a ! i"
    1.65 +        "\<forall>i. i < l \<or> r < i \<longrightarrow> Array.get h a ! i = Array.get h1 a ! i"
    1.66          unfolding swap_def
    1.67          by (elim crel_bindE crel_nthE crel_updE crel_returnE) auto
    1.68        with 1(2) [OF rec_condition False rec2] show ?thesis by fastsimp
    1.69 @@ -174,8 +174,8 @@
    1.70  
    1.71  lemma part_partitions:
    1.72    assumes "crel (part1 a l r p) h h' rs"
    1.73 -  shows "(\<forall>i. l \<le> i \<and> i < rs \<longrightarrow> get_array h' (a::nat array) ! i \<le> p)
    1.74 -  \<and> (\<forall>i. rs < i \<and> i \<le> r \<longrightarrow> get_array h' a ! i \<ge> p)"
    1.75 +  shows "(\<forall>i. l \<le> i \<and> i < rs \<longrightarrow> Array.get h' (a::nat array) ! i \<le> p)
    1.76 +  \<and> (\<forall>i. rs < i \<and> i \<le> r \<longrightarrow> Array.get h' a ! i \<ge> p)"
    1.77    using assms
    1.78  proof (induct a l r p arbitrary: h h' rs rule:part1.induct)
    1.79    case (1 a l r p h h' rs)
    1.80 @@ -192,7 +192,7 @@
    1.81    next
    1.82      case False (* recursive case *)
    1.83      note lr = this
    1.84 -    let ?v = "get_array h a ! l"
    1.85 +    let ?v = "Array.get h a ! l"
    1.86      show ?thesis
    1.87      proof (cases "?v \<le> p")
    1.88        case True
    1.89 @@ -200,7 +200,7 @@
    1.90        have rec1: "crel (part1 a (l + 1) r p) h h' rs"
    1.91          unfolding part1.simps[of a l r p]
    1.92          by (elim crel_bindE crel_nthE crel_ifE crel_returnE) auto
    1.93 -      from True part_outer_remains[OF rec1] have a_l: "get_array h' a ! l \<le> p"
    1.94 +      from True part_outer_remains[OF rec1] have a_l: "Array.get h' a ! l \<le> p"
    1.95          by fastsimp
    1.96        have "\<forall>i. (l \<le> i = (l = i \<or> Suc l \<le> i))" by arith
    1.97        with 1(1)[OF False True rec1] a_l show ?thesis
    1.98 @@ -212,10 +212,10 @@
    1.99          and rec2: "crel (part1 a l (r - 1) p) h1 h' rs"
   1.100          unfolding part1.simps[of a l r p]
   1.101          by (elim crel_bindE crel_nthE crel_ifE crel_returnE) auto
   1.102 -      from swp False have "get_array h1 a ! r \<ge> p"
   1.103 +      from swp False have "Array.get h1 a ! r \<ge> p"
   1.104          unfolding swap_def
   1.105          by (auto simp add: Array.length_def elim!: crel_bindE crel_nthE crel_updE crel_returnE)
   1.106 -      with part_outer_remains [OF rec2] lr have a_r: "get_array h' a ! r \<ge> p"
   1.107 +      with part_outer_remains [OF rec2] lr have a_r: "Array.get h' a ! r \<ge> p"
   1.108          by fastsimp
   1.109        have "\<forall>i. (i \<le> r = (i = r \<or> i \<le> r - 1))" by arith
   1.110        with 1(2)[OF lr False rec2] a_r show ?thesis
   1.111 @@ -240,8 +240,8 @@
   1.112  
   1.113  lemma partition_permutes:
   1.114    assumes "crel (partition a l r) h h' rs"
   1.115 -  shows "multiset_of (get_array h' a) 
   1.116 -  = multiset_of (get_array h a)"
   1.117 +  shows "multiset_of (Array.get h' a) 
   1.118 +  = multiset_of (Array.get h a)"
   1.119  proof -
   1.120      from assms part_permutes swap_permutes show ?thesis
   1.121        unfolding partition.simps
   1.122 @@ -260,7 +260,7 @@
   1.123  lemma partition_outer_remains:
   1.124    assumes "crel (partition a l r) h h' rs"
   1.125    assumes "l < r"
   1.126 -  shows "\<forall>i. i < l \<or> r < i \<longrightarrow> get_array h (a::nat array) ! i = get_array h' a ! i"
   1.127 +  shows "\<forall>i. i < l \<or> r < i \<longrightarrow> Array.get h (a::nat array) ! i = Array.get h' a ! i"
   1.128  proof -
   1.129    from assms part_outer_remains part_returns_index_in_bounds show ?thesis
   1.130      unfolding partition.simps swap_def
   1.131 @@ -273,7 +273,7 @@
   1.132    shows "l \<le> rs \<and> rs \<le> r"
   1.133  proof -
   1.134    from crel obtain middle h'' p where part: "crel (part1 a l (r - 1) p) h h'' middle"
   1.135 -    and rs_equals: "rs = (if get_array h'' a ! middle \<le> get_array h a ! r then middle + 1
   1.136 +    and rs_equals: "rs = (if Array.get h'' a ! middle \<le> Array.get h a ! r then middle + 1
   1.137           else middle)"
   1.138      unfolding partition.simps
   1.139      by (elim crel_bindE crel_returnE crel_nthE crel_ifE crel_updE) simp 
   1.140 @@ -284,18 +284,18 @@
   1.141  lemma partition_partitions:
   1.142    assumes crel: "crel (partition a l r) h h' rs"
   1.143    assumes "l < r"
   1.144 -  shows "(\<forall>i. l \<le> i \<and> i < rs \<longrightarrow> get_array h' (a::nat array) ! i \<le> get_array h' a ! rs) \<and>
   1.145 -  (\<forall>i. rs < i \<and> i \<le> r \<longrightarrow> get_array h' a ! rs \<le> get_array h' a ! i)"
   1.146 +  shows "(\<forall>i. l \<le> i \<and> i < rs \<longrightarrow> Array.get h' (a::nat array) ! i \<le> Array.get h' a ! rs) \<and>
   1.147 +  (\<forall>i. rs < i \<and> i \<le> r \<longrightarrow> Array.get h' a ! rs \<le> Array.get h' a ! i)"
   1.148  proof -
   1.149 -  let ?pivot = "get_array h a ! r" 
   1.150 +  let ?pivot = "Array.get h a ! r" 
   1.151    from crel obtain middle h1 where part: "crel (part1 a l (r - 1) ?pivot) h h1 middle"
   1.152      and swap: "crel (swap a rs r) h1 h' ()"
   1.153 -    and rs_equals: "rs = (if get_array h1 a ! middle \<le> ?pivot then middle + 1
   1.154 +    and rs_equals: "rs = (if Array.get h1 a ! middle \<le> ?pivot then middle + 1
   1.155           else middle)"
   1.156      unfolding partition.simps
   1.157      by (elim crel_bindE crel_returnE crel_nthE crel_ifE crel_updE) simp
   1.158 -  from swap have h'_def: "h' = Array.update a r (get_array h1 a ! rs)
   1.159 -    (Array.update a rs (get_array h1 a ! r) h1)"
   1.160 +  from swap have h'_def: "h' = Array.update a r (Array.get h1 a ! rs)
   1.161 +    (Array.update a rs (Array.get h1 a ! r) h1)"
   1.162      unfolding swap_def
   1.163      by (elim crel_bindE crel_returnE crel_nthE crel_updE) simp
   1.164    from swap have in_bounds: "r < Array.length h1 a \<and> rs < Array.length h1 a"
   1.165 @@ -306,15 +306,15 @@
   1.166    from `l < r` have "l \<le> r - 1" by simp
   1.167    note middle_in_bounds = part_returns_index_in_bounds[OF part this]
   1.168    from part_outer_remains[OF part] `l < r`
   1.169 -  have "get_array h a ! r = get_array h1 a ! r"
   1.170 +  have "Array.get h a ! r = Array.get h1 a ! r"
   1.171      by fastsimp
   1.172    with swap
   1.173 -  have right_remains: "get_array h a ! r = get_array h' a ! rs"
   1.174 +  have right_remains: "Array.get h a ! r = Array.get h' a ! rs"
   1.175      unfolding swap_def
   1.176      by (auto simp add: Array.length_def elim!: crel_bindE crel_returnE crel_nthE crel_updE) (cases "r = rs", auto)
   1.177    from part_partitions [OF part]
   1.178    show ?thesis
   1.179 -  proof (cases "get_array h1 a ! middle \<le> ?pivot")
   1.180 +  proof (cases "Array.get h1 a ! middle \<le> ?pivot")
   1.181      case True
   1.182      with rs_equals have rs_equals: "rs = middle + 1" by simp
   1.183      { 
   1.184 @@ -324,8 +324,8 @@
   1.185        have i_props: "i < Array.length h' a" "i \<noteq> r" "i \<noteq> rs" by auto
   1.186        from i_is_left rs_equals have "l \<le> i \<and> i < middle \<or> i = middle" by arith
   1.187        with part_partitions[OF part] right_remains True
   1.188 -      have "get_array h1 a ! i \<le> get_array h' a ! rs" by fastsimp
   1.189 -      with i_props h'_def in_bounds have "get_array h' a ! i \<le> get_array h' a ! rs"
   1.190 +      have "Array.get h1 a ! i \<le> Array.get h' a ! rs" by fastsimp
   1.191 +      with i_props h'_def in_bounds have "Array.get h' a ! i \<le> Array.get h' a ! rs"
   1.192          unfolding Array.update_def Array.length_def by simp
   1.193      }
   1.194      moreover
   1.195 @@ -334,13 +334,13 @@
   1.196        assume "rs < i \<and> i \<le> r"
   1.197  
   1.198        hence "(rs < i \<and> i \<le> r - 1) \<or> (rs < i \<and> i = r)" by arith
   1.199 -      hence "get_array h' a ! rs \<le> get_array h' a ! i"
   1.200 +      hence "Array.get h' a ! rs \<le> Array.get h' a ! i"
   1.201        proof
   1.202          assume i_is: "rs < i \<and> i \<le> r - 1"
   1.203          with swap_length_remains in_bounds middle_in_bounds rs_equals
   1.204          have i_props: "i < Array.length h' a" "i \<noteq> r" "i \<noteq> rs" by auto
   1.205          from part_partitions[OF part] rs_equals right_remains i_is
   1.206 -        have "get_array h' a ! rs \<le> get_array h1 a ! i"
   1.207 +        have "Array.get h' a ! rs \<le> Array.get h1 a ! i"
   1.208            by fastsimp
   1.209          with i_props h'_def show ?thesis by fastsimp
   1.210        next
   1.211 @@ -348,7 +348,7 @@
   1.212          with rs_equals have "Suc middle \<noteq> r" by arith
   1.213          with middle_in_bounds `l < r` have "Suc middle \<le> r - 1" by arith
   1.214          with part_partitions[OF part] right_remains 
   1.215 -        have "get_array h' a ! rs \<le> get_array h1 a ! (Suc middle)"
   1.216 +        have "Array.get h' a ! rs \<le> Array.get h1 a ! (Suc middle)"
   1.217            by fastsimp
   1.218          with i_is True rs_equals right_remains h'_def
   1.219          show ?thesis using in_bounds
   1.220 @@ -366,8 +366,8 @@
   1.221        with swap_length_remains in_bounds middle_in_bounds rs_equals
   1.222        have i_props: "i < Array.length h' a" "i \<noteq> r" "i \<noteq> rs" by auto
   1.223        from part_partitions[OF part] rs_equals right_remains i_is_left
   1.224 -      have "get_array h1 a ! i \<le> get_array h' a ! rs" by fastsimp
   1.225 -      with i_props h'_def have "get_array h' a ! i \<le> get_array h' a ! rs"
   1.226 +      have "Array.get h1 a ! i \<le> Array.get h' a ! rs" by fastsimp
   1.227 +      with i_props h'_def have "Array.get h' a ! i \<le> Array.get h' a ! rs"
   1.228          unfolding Array.update_def by simp
   1.229      }
   1.230      moreover
   1.231 @@ -375,13 +375,13 @@
   1.232        fix i
   1.233        assume "rs < i \<and> i \<le> r"
   1.234        hence "(rs < i \<and> i \<le> r - 1) \<or> i = r" by arith
   1.235 -      hence "get_array h' a ! rs \<le> get_array h' a ! i"
   1.236 +      hence "Array.get h' a ! rs \<le> Array.get h' a ! i"
   1.237        proof
   1.238          assume i_is: "rs < i \<and> i \<le> r - 1"
   1.239          with swap_length_remains in_bounds middle_in_bounds rs_equals
   1.240          have i_props: "i < Array.length h' a" "i \<noteq> r" "i \<noteq> rs" by auto
   1.241          from part_partitions[OF part] rs_equals right_remains i_is
   1.242 -        have "get_array h' a ! rs \<le> get_array h1 a ! i"
   1.243 +        have "Array.get h' a ! rs \<le> Array.get h1 a ! i"
   1.244            by fastsimp
   1.245          with i_props h'_def show ?thesis by fastsimp
   1.246        next
   1.247 @@ -420,8 +420,8 @@
   1.248  
   1.249  lemma quicksort_permutes:
   1.250    assumes "crel (quicksort a l r) h h' rs"
   1.251 -  shows "multiset_of (get_array h' a) 
   1.252 -  = multiset_of (get_array h a)"
   1.253 +  shows "multiset_of (Array.get h' a) 
   1.254 +  = multiset_of (Array.get h a)"
   1.255    using assms
   1.256  proof (induct a l r arbitrary: h h' rs rule: quicksort.induct)
   1.257    case (1 a l r h h' rs)
   1.258 @@ -443,7 +443,7 @@
   1.259  
   1.260  lemma quicksort_outer_remains:
   1.261    assumes "crel (quicksort a l r) h h' rs"
   1.262 -   shows "\<forall>i. i < l \<or> r < i \<longrightarrow> get_array h (a::nat array) ! i = get_array h' a ! i"
   1.263 +   shows "\<forall>i. i < l \<or> r < i \<longrightarrow> Array.get h (a::nat array) ! i = Array.get h' a ! i"
   1.264    using assms
   1.265  proof (induct a l r arbitrary: h h' rs rule: quicksort.induct)
   1.266    case (1 a l r h h' rs)
   1.267 @@ -465,14 +465,14 @@
   1.268        assume pivot: "l \<le> p \<and> p \<le> r"
   1.269        assume i_outer: "i < l \<or> r < i"
   1.270        from  partition_outer_remains [OF part True] i_outer
   1.271 -      have "get_array h a !i = get_array h1 a ! i" by fastsimp
   1.272 +      have "Array.get h a !i = Array.get h1 a ! i" by fastsimp
   1.273        moreover
   1.274        with 1(1) [OF True pivot qs1] pivot i_outer
   1.275 -      have "get_array h1 a ! i = get_array h2 a ! i" by auto
   1.276 +      have "Array.get h1 a ! i = Array.get h2 a ! i" by auto
   1.277        moreover
   1.278        with qs2 1(2) [of p h2 h' ret2] True pivot i_outer
   1.279 -      have "get_array h2 a ! i = get_array h' a ! i" by auto
   1.280 -      ultimately have "get_array h a ! i= get_array h' a ! i" by simp
   1.281 +      have "Array.get h2 a ! i = Array.get h' a ! i" by auto
   1.282 +      ultimately have "Array.get h a ! i= Array.get h' a ! i" by simp
   1.283      }
   1.284      with cr show ?thesis
   1.285        unfolding quicksort.simps [of a l r]
   1.286 @@ -512,7 +512,7 @@
   1.287        have pivot: "l\<le> p \<and> p \<le> r" .
   1.288       note length_remains = length_remains[OF qs2] length_remains[OF qs1] partition_length_remains[OF part]
   1.289        from quicksort_outer_remains [OF qs2] quicksort_outer_remains [OF qs1] pivot quicksort_is_skip[OF qs1]
   1.290 -      have pivot_unchanged: "get_array h1 a ! p = get_array h' a ! p" by (cases p, auto)
   1.291 +      have pivot_unchanged: "Array.get h1 a ! p = Array.get h' a ! p" by (cases p, auto)
   1.292          (*-- First of all, by induction hypothesis both sublists are sorted. *)
   1.293        from 1(1)[OF True pivot qs1] length_remains pivot 1(5) 
   1.294        have IH1: "sorted (subarray l p a h2)"  by (cases p, auto simp add: subarray_Nil)
   1.295 @@ -525,35 +525,35 @@
   1.296          by (cases "Suc p \<le> r", auto simp add: subarray_Nil)
   1.297             (* -- Secondly, both sublists remain partitioned. *)
   1.298        from partition_partitions[OF part True]
   1.299 -      have part_conds1: "\<forall>j. j \<in> set (subarray l p a h1) \<longrightarrow> j \<le> get_array h1 a ! p "
   1.300 -        and part_conds2: "\<forall>j. j \<in> set (subarray (p + 1) (r + 1) a h1) \<longrightarrow> get_array h1 a ! p \<le> j"
   1.301 +      have part_conds1: "\<forall>j. j \<in> set (subarray l p a h1) \<longrightarrow> j \<le> Array.get h1 a ! p "
   1.302 +        and part_conds2: "\<forall>j. j \<in> set (subarray (p + 1) (r + 1) a h1) \<longrightarrow> Array.get h1 a ! p \<le> j"
   1.303          by (auto simp add: all_in_set_subarray_conv)
   1.304        from quicksort_outer_remains [OF qs1] quicksort_permutes [OF qs1] True
   1.305 -        length_remains 1(5) pivot multiset_of_sublist [of l p "get_array h1 a" "get_array h2 a"]
   1.306 +        length_remains 1(5) pivot multiset_of_sublist [of l p "Array.get h1 a" "Array.get h2 a"]
   1.307        have multiset_partconds1: "multiset_of (subarray l p a h2) = multiset_of (subarray l p a h1)"
   1.308          unfolding Array.length_def subarray_def by (cases p, auto)
   1.309        with left_subarray_remains part_conds1 pivot_unchanged
   1.310 -      have part_conds2': "\<forall>j. j \<in> set (subarray l p a h') \<longrightarrow> j \<le> get_array h' a ! p"
   1.311 +      have part_conds2': "\<forall>j. j \<in> set (subarray l p a h') \<longrightarrow> j \<le> Array.get h' a ! p"
   1.312          by (simp, subst set_of_multiset_of[symmetric], simp)
   1.313            (* -- These steps are the analogous for the right sublist \<dots> *)
   1.314        from quicksort_outer_remains [OF qs1] length_remains
   1.315        have right_subarray_remains: "subarray (p + 1) (r + 1) a h1 = subarray (p + 1) (r + 1) a h2"
   1.316          by (auto simp add: subarray_eq_samelength_iff)
   1.317        from quicksort_outer_remains [OF qs2] quicksort_permutes [OF qs2] True
   1.318 -        length_remains 1(5) pivot multiset_of_sublist [of "p + 1" "r + 1" "get_array h2 a" "get_array h' a"]
   1.319 +        length_remains 1(5) pivot multiset_of_sublist [of "p + 1" "r + 1" "Array.get h2 a" "Array.get h' a"]
   1.320        have multiset_partconds2: "multiset_of (subarray (p + 1) (r + 1) a h') = multiset_of (subarray (p + 1) (r + 1) a h2)"
   1.321          unfolding Array.length_def subarray_def by auto
   1.322        with right_subarray_remains part_conds2 pivot_unchanged
   1.323 -      have part_conds1': "\<forall>j. j \<in> set (subarray (p + 1) (r + 1) a h') \<longrightarrow> get_array h' a ! p \<le> j"
   1.324 +      have part_conds1': "\<forall>j. j \<in> set (subarray (p + 1) (r + 1) a h') \<longrightarrow> Array.get h' a ! p \<le> j"
   1.325          by (simp, subst set_of_multiset_of[symmetric], simp)
   1.326            (* -- Thirdly and finally, we show that the array is sorted
   1.327            following from the facts above. *)
   1.328 -      from True pivot 1(5) length_remains have "subarray l (r + 1) a h' = subarray l p a h' @ [get_array h' a ! p] @ subarray (p + 1) (r + 1) a h'"
   1.329 +      from True pivot 1(5) length_remains have "subarray l (r + 1) a h' = subarray l p a h' @ [Array.get h' a ! p] @ subarray (p + 1) (r + 1) a h'"
   1.330          by (simp add: subarray_nth_array_Cons, cases "l < p") (auto simp add: subarray_append subarray_Nil)
   1.331        with IH1' IH2 part_conds1' part_conds2' pivot have ?thesis
   1.332          unfolding subarray_def
   1.333          apply (auto simp add: sorted_append sorted_Cons all_in_set_sublist'_conv)
   1.334 -        by (auto simp add: set_sublist' dest: le_trans [of _ "get_array h' a ! p"])
   1.335 +        by (auto simp add: set_sublist' dest: le_trans [of _ "Array.get h' a ! p"])
   1.336      }
   1.337      with True cr show ?thesis
   1.338        unfolding quicksort.simps [of a l r]
   1.339 @@ -564,16 +564,16 @@
   1.340  
   1.341  lemma quicksort_is_sort:
   1.342    assumes crel: "crel (quicksort a 0 (Array.length h a - 1)) h h' rs"
   1.343 -  shows "get_array h' a = sort (get_array h a)"
   1.344 -proof (cases "get_array h a = []")
   1.345 +  shows "Array.get h' a = sort (Array.get h a)"
   1.346 +proof (cases "Array.get h a = []")
   1.347    case True
   1.348    with quicksort_is_skip[OF crel] show ?thesis
   1.349    unfolding Array.length_def by simp
   1.350  next
   1.351    case False
   1.352 -  from quicksort_sorts [OF crel] False have "sorted (sublist' 0 (List.length (get_array h a)) (get_array h' a))"
   1.353 +  from quicksort_sorts [OF crel] False have "sorted (sublist' 0 (List.length (Array.get h a)) (Array.get h' a))"
   1.354      unfolding Array.length_def subarray_def by auto
   1.355 -  with length_remains[OF crel] have "sorted (get_array h' a)"
   1.356 +  with length_remains[OF crel] have "sorted (Array.get h' a)"
   1.357      unfolding Array.length_def by simp
   1.358    with quicksort_permutes [OF crel] properties_for_sort show ?thesis by fastsimp
   1.359  qed