src/HOL/SPARK/Examples/Sqrt/Sqrt.thy
changeset 63167 0909deb8059b
parent 58130 5e9170812356
child 66453 cc19f7ca2ed6
equal deleted inserted replaced
63166:143f58bb34f9 63167:0909deb8059b
     9 
     9 
    10 spark_open "sqrt/isqrt"
    10 spark_open "sqrt/isqrt"
    11 
    11 
    12 spark_vc function_isqrt_4
    12 spark_vc function_isqrt_4
    13 proof -
    13 proof -
    14   from `0 \<le> r` have "(r = 0 \<or> r = 1 \<or> r = 2) \<or> 2 < r" by auto
    14   from \<open>0 \<le> r\<close> have "(r = 0 \<or> r = 1 \<or> r = 2) \<or> 2 < r" by auto
    15   then show "2 * r \<le> 2147483646"
    15   then show "2 * r \<le> 2147483646"
    16   proof
    16   proof
    17     assume "2 < r"
    17     assume "2 < r"
    18     then have "0 < r" by simp
    18     then have "0 < r" by simp
    19     with `2 < r` have "2 * r < r * r" by (rule mult_strict_right_mono)
    19     with \<open>2 < r\<close> have "2 * r < r * r" by (rule mult_strict_right_mono)
    20     with `r * r \<le> n` and `n \<le> 2147483647` show ?thesis
    20     with \<open>r * r \<le> n\<close> and \<open>n \<le> 2147483647\<close> show ?thesis
    21       by simp
    21       by simp
    22   qed auto
    22   qed auto
    23   then show "2 * r \<le> 2147483647" by simp
    23   then show "2 * r \<le> 2147483647" by simp
    24 qed
    24 qed
    25 
    25