# HG changeset patch # User wenzelm # Date 1461663499 -7200 # Node ID 1b237d147cc4c4982a26d142004d33388c43b85f # Parent 2cc4e85b46d450dcb8032c37eb1e0f8eee3d4090 misc tuning and modernization; diff -r 2cc4e85b46d4 -r 1b237d147cc4 src/HOL/ex/Abstract_NAT.thy --- a/src/HOL/ex/Abstract_NAT.thy Mon Apr 25 22:59:53 2016 +0200 +++ b/src/HOL/ex/Abstract_NAT.thy Tue Apr 26 11:38:19 2016 +0200 @@ -23,13 +23,13 @@ by (rule succ_neq_zero [symmetric]) -text \\medskip Primitive recursion as a (functional) relation -- polymorphic!\ +text \\<^medskip> Primitive recursion as a (functional) relation -- polymorphic!\ inductive Rec :: "'a \ ('n \ 'a \ 'a) \ 'n \ 'a \ bool" for e :: 'a and r :: "'n \ 'a \ 'a" where - Rec_zero: "Rec e r zero e" - | Rec_succ: "Rec e r m n \ Rec e r (succ m) (r m n)" + Rec_zero: "Rec e r zero e" +| Rec_succ: "Rec e r m n \ Rec e r (succ m) (r m n)" lemma Rec_functional: fixes x :: 'n @@ -42,26 +42,30 @@ show "\!y. ?R zero y" proof show "?R zero e" .. - fix y assume "?R zero y" - then show "y = e" by cases simp_all + show "y = e" if "?R zero y" for y + using that by cases simp_all qed next case (succ m) from \\!y. ?R m y\ - obtain y where y: "?R m y" - and yy': "\y'. ?R m y' \ y = y'" by blast + obtain y where y: "?R m y" and yy': "\y'. ?R m y' \ y = y'" + by blast show "\!z. ?R (succ m) z" proof from y show "?R (succ m) (r m y)" .. - fix z assume "?R (succ m) z" - then obtain u where "z = r m u" and "?R m u" by cases simp_all - with yy' show "z = r m y" by (simp only:) + next + fix z + assume "?R (succ m) z" + then obtain u where "z = r m u" and "?R m u" + by cases simp_all + with yy' show "z = r m y" + by (simp only:) qed qed qed -text \\medskip The recursion operator -- polymorphic!\ +text \\<^medskip> The recursion operator -- polymorphic!\ definition rec :: "'a \ ('n \ 'a \ 'a) \ 'n \ 'a" where "rec e r x = (THE y. Rec e r x y)" @@ -86,7 +90,7 @@ qed -text \\medskip Example: addition (monomorphic)\ +text \\<^medskip> Example: addition (monomorphic)\ definition add :: "'n \ 'n \ 'n" where "add m n = rec n (\_ k. succ k) m" @@ -109,7 +113,7 @@ by simp -text \\medskip Example: replication (polymorphic)\ +text \\<^medskip> Example: replication (polymorphic)\ definition repl :: "'n \ 'a \ 'a list" where "repl n x = rec [] (\_ xs. x # xs) n" @@ -124,17 +128,17 @@ end -text \\medskip Just see that our abstract specification makes sense \dots\ +text \\<^medskip> Just see that our abstract specification makes sense \dots\ interpretation NAT 0 Suc proof (rule NAT.intro) fix m n show "Suc m = Suc n \ m = n" by simp show "Suc m \ 0" by simp - fix P - assume zero: "P 0" + show "P n" + if zero: "P 0" and succ: "\n. P n \ P (Suc n)" - show "P n" + for P proof (induct n) case 0 show ?case by (rule zero) diff -r 2cc4e85b46d4 -r 1b237d147cc4 src/HOL/ex/CTL.thy --- a/src/HOL/ex/CTL.thy Mon Apr 25 22:59:53 2016 +0200 +++ b/src/HOL/ex/CTL.thy Tue Apr 26 11:38:19 2016 +0200 @@ -25,9 +25,8 @@ type_synonym 'a ctl = "'a set" -definition - imp :: "'a ctl \ 'a ctl \ 'a ctl" (infixr "\" 75) where - "p \ q = - p \ q" +definition imp :: "'a ctl \ 'a ctl \ 'a ctl" (infixr "\" 75) + where "p \ q = - p \ q" lemma [intro!]: "p \ p \ q \ q" unfolding imp_def by auto lemma [intro!]: "p \ (q \ p)" unfolding imp_def by rule @@ -86,8 +85,7 @@ proof show "lfp f \ - gfp (\s. - f (- s))" proof - fix x assume l: "x \ lfp f" - show "x \ - gfp (\s. - f (- s))" + show "x \ - gfp (\s. - f (- s))" if l: "x \ lfp f" for x proof assume "x \ gfp (\s. - f (- s))" then obtain u where "x \ u" and "u \ - f (- u)" @@ -100,7 +98,8 @@ qed show "- gfp (\s. - f (- s)) \ lfp f" proof (rule lfp_greatest) - fix u assume "f u \ u" + fix u + assume "f u \ u" then have "- u \ - f u" by auto then have "- u \ - f (- (- u))" by simp then have "- u \ gfp (\s. - f (- s))" by (rule gfp_upperbound) diff -r 2cc4e85b46d4 -r 1b237d147cc4 src/HOL/ex/Cartouche_Examples.thy --- a/src/HOL/ex/Cartouche_Examples.thy Mon Apr 25 22:59:53 2016 +0200 +++ b/src/HOL/ex/Cartouche_Examples.thy Tue Apr 26 11:38:19 2016 +0200 @@ -13,14 +13,14 @@ subsection \Regular outer syntax\ -text \Text cartouches may be used in the outer syntax category "text", - as alternative to the traditional "verbatim" tokens. An example is +text \Text cartouches may be used in the outer syntax category \text\, + as alternative to the traditional \verbatim\ tokens. An example is this text block.\ \ \The same works for small side-comments.\ notepad begin txt \Moreover, cartouches work as additional syntax in the - "altstring" category, for literal fact references. For example:\ + \altstring\ category, for literal fact references. For example:\ fix x y :: 'a assume "x = y" diff -r 2cc4e85b46d4 -r 1b237d147cc4 src/HOL/ex/Coherent.thy --- a/src/HOL/ex/Coherent.thy Mon Apr 25 22:59:53 2016 +0200 +++ b/src/HOL/ex/Coherent.thy Tue Apr 26 11:38:19 2016 +0200 @@ -16,65 +16,63 @@ relcomp (infixr "O" 75) lemma p1p2: - assumes - "col a b c l \ col d e f m" - "col b f g n \ col c e g o" - "col b d h p \ col a e h q" - "col c d i r \ col a f i s" - "el n o \ goal" - "el p q \ goal" - "el s r \ goal" - "\A. el A A \ pl g A \ pl h A \ pl i A \ goal" - "\A B C D. col A B C D \ pl A D" - "\A B C D. col A B C D \ pl B D" - "\A B C D. col A B C D \ pl C D" - "\A B. pl A B \ ep A A" - "\A B. ep A B \ ep B A" - "\A B C. ep A B \ ep B C \ ep A C" - "\A B. pl A B \ el B B" - "\A B. el A B \ el B A" - "\A B C. el A B \ el B C \ el A C" - "\A B C. ep A B \ pl B C \ pl A C" - "\A B C. pl A B \ el B C \ pl A C" - "\A B C D E F G H I J K L M N O P Q. - col A B C D \ col E F G H \ col B G I J \ col C F I K \ - col B E L M \ col A F L N \ col C E O P \ col A G O Q \ - (\ R. col I L O R) \ pl A H \ pl B H \ pl C H \ pl E D \ pl F D \ pl G D" - "\A B C D. pl A B \ pl A C \ pl D B \ pl D C \ ep A D \ el B C" - "\A B. ep A A \ ep B B \ \C. pl A C \ pl B C" + assumes "col a b c l \ col d e f m" + and "col b f g n \ col c e g o" + and "col b d h p \ col a e h q" + and "col c d i r \ col a f i s" + and "el n o \ goal" + and "el p q \ goal" + and "el s r \ goal" + and "\A. el A A \ pl g A \ pl h A \ pl i A \ goal" + and "\A B C D. col A B C D \ pl A D" + and "\A B C D. col A B C D \ pl B D" + and "\A B C D. col A B C D \ pl C D" + and "\A B. pl A B \ ep A A" + and "\A B. ep A B \ ep B A" + and "\A B C. ep A B \ ep B C \ ep A C" + and "\A B. pl A B \ el B B" + and "\A B. el A B \ el B A" + and "\A B C. el A B \ el B C \ el A C" + and "\A B C. ep A B \ pl B C \ pl A C" + and "\A B C. pl A B \ el B C \ pl A C" + and "\A B C D E F G H I J K L M N O P Q. + col A B C D \ col E F G H \ col B G I J \ col C F I K \ + col B E L M \ col A F L N \ col C E O P \ col A G O Q \ + (\ R. col I L O R) \ pl A H \ pl B H \ pl C H \ pl E D \ pl F D \ pl G D" + and "\A B C D. pl A B \ pl A C \ pl D B \ pl D C \ ep A D \ el B C" + and "\A B. ep A A \ ep B B \ \C. pl A C \ pl B C" shows goal using assms by coherent lemma p2p1: - assumes - "col a b c l \ col d e f m" - "col b f g n \ col c e g o" - "col b d h p \ col a e h q" - "col c d i r \ col a f i s" - "pl a m \ goal" - "pl b m \ goal" - "pl c m \ goal" - "pl d l \ goal" - "pl e l \ goal" - "pl f l \ goal" - "\A. pl g A \ pl h A \ pl i A \ goal" - "\A B C D. col A B C D \ pl A D" - "\A B C D. col A B C D \ pl B D" - "\A B C D. col A B C D \ pl C D" - "\A B. pl A B \ ep A A" - "\A B. ep A B \ ep B A" - "\A B C. ep A B \ ep B C \ ep A C" - "\A B. pl A B \ el B B" - "\A B. el A B \ el B A" - "\A B C. el A B \ el B C \ el A C" - "\A B C. ep A B \ pl B C \ pl A C" - "\A B C. pl A B \ el B C \ pl A C" - "\A B C D E F G H I J K L M N O P Q. - col A B C J \ col D E F K \ col B F G L \ col C E G M \ - col B D H N \ col A E H O \ col C D I P \ col A F I Q \ - (\ R. col G H I R) \ el L M \ el N O \ el P Q" - "\A B C D. pl C A \ pl C B \ pl D A \ pl D B \ ep C D \ el A B" - "\A B C. ep A A \ ep B B \ \C. pl A C \ pl B C" + assumes "col a b c l \ col d e f m" + and "col b f g n \ col c e g o" + and "col b d h p \ col a e h q" + and "col c d i r \ col a f i s" + and "pl a m \ goal" + and "pl b m \ goal" + and "pl c m \ goal" + and "pl d l \ goal" + and "pl e l \ goal" + and "pl f l \ goal" + and "\A. pl g A \ pl h A \ pl i A \ goal" + and "\A B C D. col A B C D \ pl A D" + and "\A B C D. col A B C D \ pl B D" + and "\A B C D. col A B C D \ pl C D" + and "\A B. pl A B \ ep A A" + and "\A B. ep A B \ ep B A" + and "\A B C. ep A B \ ep B C \ ep A C" + and "\A B. pl A B \ el B B" + and "\A B. el A B \ el B A" + and "\A B C. el A B \ el B C \ el A C" + and "\A B C. ep A B \ pl B C \ pl A C" + and "\A B C. pl A B \ el B C \ pl A C" + and "\A B C D E F G H I J K L M N O P Q. + col A B C J \ col D E F K \ col B F G L \ col C E G M \ + col B D H N \ col A E H O \ col C D I P \ col A F I Q \ + (\ R. col G H I R) \ el L M \ el N O \ el P Q" + and "\A B C D. pl C A \ pl C B \ pl D A \ pl D B \ ep C D \ el A B" + and "\A B C. ep A A \ ep B B \ \C. pl A C \ pl B C" shows goal using assms by coherent @@ -82,16 +80,15 @@ subsection \Preservation of the Diamond Property under reflexive closure\ lemma diamond: - assumes - "reflexive_rewrite a b" "reflexive_rewrite a c" - "\A. reflexive_rewrite b A \ reflexive_rewrite c A \ goal" - "\A. equalish A A" - "\A B. equalish A B \ equalish B A" - "\A B C. equalish A B \ reflexive_rewrite B C \ reflexive_rewrite A C" - "\A B. equalish A B \ reflexive_rewrite A B" - "\A B. rewrite A B \ reflexive_rewrite A B" - "\A B. reflexive_rewrite A B \ equalish A B \ rewrite A B" - "\A B C. rewrite A B \ rewrite A C \ \D. rewrite B D \ rewrite C D" + assumes "reflexive_rewrite a b" "reflexive_rewrite a c" + and "\A. reflexive_rewrite b A \ reflexive_rewrite c A \ goal" + and "\A. equalish A A" + and "\A B. equalish A B \ equalish B A" + and "\A B C. equalish A B \ reflexive_rewrite B C \ reflexive_rewrite A C" + and "\A B. equalish A B \ reflexive_rewrite A B" + and "\A B. rewrite A B \ reflexive_rewrite A B" + and "\A B. reflexive_rewrite A B \ equalish A B \ rewrite A B" + and "\A B C. rewrite A B \ rewrite A C \ \D. rewrite B D \ rewrite C D" shows goal using assms by coherent diff -r 2cc4e85b46d4 -r 1b237d147cc4 src/HOL/ex/Cubic_Quartic.thy --- a/src/HOL/ex/Cubic_Quartic.thy Mon Apr 25 22:59:53 2016 +0200 +++ b/src/HOL/ex/Cubic_Quartic.thy Tue Apr 26 11:38:19 2016 +0200 @@ -2,144 +2,160 @@ Author: Amine Chaieb *) -section "The Cubic and Quartic Root Formulas" +section \The Cubic and Quartic Root Formulas\ theory Cubic_Quartic imports Complex_Main begin -section "The Cubic Formula" +section \The Cubic Formula\ definition "ccbrt z = (SOME (w::complex). w^3 = z)" lemma ccbrt: "(ccbrt z) ^ 3 = z" -proof- - from rcis_Ex obtain r a where ra: "z = rcis r a" by blast +proof - + from rcis_Ex obtain r a where ra: "z = rcis r a" + by blast let ?r' = "if r < 0 then - root 3 (-r) else root 3 r" let ?a' = "a/3" - have "rcis ?r' ?a' ^ 3 = rcis r a" by (cases "r<0", simp_all add: DeMoivre2) - hence th: "\w. w^3 = z" unfolding ra by blast - from someI_ex[OF th] show ?thesis unfolding ccbrt_def by blast + have "rcis ?r' ?a' ^ 3 = rcis r a" + by (cases "r < 0") (simp_all add: DeMoivre2) + then have *: "\w. w^3 = z" + unfolding ra by blast + from someI_ex [OF *] show ?thesis + unfolding ccbrt_def by blast qed -text "The reduction to a simpler form:" + +text \The reduction to a simpler form:\ lemma cubic_reduction: fixes a :: complex - assumes H: "a \ 0 \ x = y - b / (3 * a) \ p = (3* a * c - b^2) / (9 * a^2) \ - q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d) / (54 * a^3)" + assumes + "a \ 0 \ x = y - b / (3 * a) \ p = (3* a * c - b^2) / (9 * a^2) \ + q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d) / (54 * a^3)" shows "a * x^3 + b * x^2 + c * x + d = 0 \ y^3 + 3 * p * y - 2 * q = 0" -proof- - from H have "3*a \ 0" "9*a^2 \ 0" "54*a^3 \ 0" by auto - hence th: "x = y - b / (3 * a) \ (3*a) * x = (3*a) * y - b" - "p = (3* a * c - b^2) / (9 * a^2) \ (9 * a^2) * p = (3* a * c - b^2)" - "q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d) / (54 * a^3) \ - (54 * a^3) * q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d)" +proof - + from assms have "3 * a \ 0" "9 * a^2 \ 0" "54 * a^3 \ 0" by auto + then have *: + "x = y - b / (3 * a) \ (3*a) * x = (3*a) * y - b" + "p = (3* a * c - b^2) / (9 * a^2) \ (9 * a^2) * p = (3* a * c - b^2)" + "q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d) / (54 * a^3) \ + (54 * a^3) * q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d)" by (simp_all add: field_simps) - from H[unfolded th] show ?thesis by algebra + from assms [unfolded *] show ?thesis + by algebra qed -text "The solutions of the special form:" -lemma cubic_basic: +text \The solutions of the special form:\ + +lemma cubic_basic: fixes s :: complex - assumes H: "s^2 = q^2 + p^3 \ - s1^3 = (if p = 0 then 2 * q else q + s) \ - s2 = -s1 * (1 + i * t) / 2 \ - s3 = -s1 * (1 - i * t) / 2 \ - i^2 + 1 = 0 \ - t^2 = 3" - shows + assumes + "s^2 = q^2 + p^3 \ + s1^3 = (if p = 0 then 2 * q else q + s) \ + s2 = -s1 * (1 + i * t) / 2 \ + s3 = -s1 * (1 - i * t) / 2 \ + i^2 + 1 = 0 \ + t^2 = 3" + shows "if p = 0 then y^3 + 3 * p * y - 2 * q = 0 \ y = s1 \ y = s2 \ y = s3 else s1 \ 0 \ - (y^3 + 3 * p * y - 2 * q = 0 \ (y = s1 - p / s1 \ y = s2 - p / s2 \ y = s3 - p / s3))" -proof- - { assume p0: "p = 0" - with H have ?thesis by (simp add: field_simps) algebra - } - moreover - { assume p0: "p \ 0" - with H have th1: "s1 \ 0" by (simp add: field_simps) algebra - from p0 H th1 have th0: "s2 \ 0" "s3 \0" - by (simp_all add: field_simps) algebra+ - from th1 th0 - have th: "y = s1 - p / s1 \ s1*y = s1^2 - p" - "y = s2 - p / s2 \ s2*y = s2^2 - p" - "y = s3 - p / s3 \ s3*y = s3^2 - p" - by (simp_all add: field_simps power2_eq_square) - from p0 H have ?thesis unfolding th by (simp add: field_simps) algebra - } - ultimately show ?thesis by blast + (y^3 + 3 * p * y - 2 * q = 0 \ (y = s1 - p / s1 \ y = s2 - p / s2 \ y = s3 - p / s3))" +proof (cases "p = 0") + case True + with assms show ?thesis + by (simp add: field_simps) algebra +next + case False + with assms have *: "s1 \ 0" by (simp add: field_simps) algebra + with assms False have "s2 \ 0" "s3 \ 0" + by (simp_all add: field_simps) algebra+ + with * have **: + "y = s1 - p / s1 \ s1 * y = s1^2 - p" + "y = s2 - p / s2 \ s2 * y = s2^2 - p" + "y = s3 - p / s3 \ s3 * y = s3^2 - p" + by (simp_all add: field_simps power2_eq_square) + from assms False show ?thesis + unfolding ** by (simp add: field_simps) algebra qed -text "Explicit formula for the roots:" + +text \Explicit formula for the roots:\ lemma cubic: assumes a0: "a \ 0" - shows " - let p = (3 * a * c - b^2) / (9 * a^2) ; + shows + "let + p = (3 * a * c - b^2) / (9 * a^2); q = (9 * a * b * c - 2 * b^3 - 27 * a^2 * d) / (54 * a^3); s = csqrt(q^2 + p^3); s1 = (if p = 0 then ccbrt(2 * q) else ccbrt(q + s)); s2 = -s1 * (1 + ii * csqrt 3) / 2; s3 = -s1 * (1 - ii * csqrt 3) / 2 - in if p = 0 then - a * x^3 + b * x^2 + c * x + d = 0 \ - x = s1 - b / (3 * a) \ - x = s2 - b / (3 * a) \ - x = s3 - b / (3 * a) + in + if p = 0 then + a * x^3 + b * x^2 + c * x + d = 0 \ + x = s1 - b / (3 * a) \ + x = s2 - b / (3 * a) \ + x = s3 - b / (3 * a) else s1 \ 0 \ - (a * x^3 + b * x^2 + c * x + d = 0 \ + (a * x^3 + b * x^2 + c * x + d = 0 \ x = s1 - p / s1 - b / (3 * a) \ x = s2 - p / s2 - b / (3 * a) \ x = s3 - p / s3 - b / (3 * a))" -proof- +proof - let ?p = "(3 * a * c - b^2) / (9 * a^2)" let ?q = "(9 * a * b * c - 2 * b^3 - 27 * a^2 * d) / (54 * a^3)" - let ?s = "csqrt(?q^2 + ?p^3)" + let ?s = "csqrt (?q^2 + ?p^3)" let ?s1 = "if ?p = 0 then ccbrt(2 * ?q) else ccbrt(?q + ?s)" let ?s2 = "- ?s1 * (1 + ii * csqrt 3) / 2" let ?s3 = "- ?s1 * (1 - ii * csqrt 3) / 2" let ?y = "x + b / (3 * a)" - from a0 have zero: "9 * a^2 \ 0" "a^3 * 54 \ 0" "(a*3)\ 0" by auto - have eq:"a * x^3 + b * x^2 + c * x + d = 0 \ ?y^3 + 3 * ?p * ?y - 2 * ?q = 0" + from a0 have zero: "9 * a^2 \ 0" "a^3 * 54 \ 0" "(a * 3) \ 0" + by auto + have eq: "a * x^3 + b * x^2 + c * x + d = 0 \ ?y^3 + 3 * ?p * ?y - 2 * ?q = 0" by (rule cubic_reduction) (auto simp add: field_simps zero a0) have "csqrt 3^2 = 3" by (rule power2_csqrt) - hence th0: "?s^2 = ?q^2 + ?p ^ 3 \ ?s1^ 3 = (if ?p = 0 then 2 * ?q else ?q + ?s) \ - ?s2 = - ?s1 * (1 + ii * csqrt 3) / 2 \ - ?s3 = - ?s1 * (1 - ii * csqrt 3) / 2 \ - ii^2 + 1 = 0 \ csqrt 3^2 = 3" + then have th0: + "?s^2 = ?q^2 + ?p ^ 3 \ ?s1^ 3 = (if ?p = 0 then 2 * ?q else ?q + ?s) \ + ?s2 = - ?s1 * (1 + ii * csqrt 3) / 2 \ + ?s3 = - ?s1 * (1 - ii * csqrt 3) / 2 \ + ii^2 + 1 = 0 \ csqrt 3^2 = 3" using zero by (simp add: field_simps ccbrt) from cubic_basic[OF th0, of ?y] - show ?thesis + show ?thesis apply (simp only: Let_def eq) using zero apply (simp add: field_simps ccbrt) using zero - apply (cases "a * (c * 3) = b^2", simp_all add: field_simps) + apply (cases "a * (c * 3) = b^2") + apply (simp_all add: field_simps) done qed -section "The Quartic Formula" +section \The Quartic Formula\ lemma quartic: - "(y::real)^3 - b * y^2 + (a * c - 4 * d) * y - a^2 * d + 4 * b * d - c^2 = 0 \ - R^2 = a^2 / 4 - b + y \ - s^2 = y^2 - 4 * d \ - (D^2 = (if R = 0 then 3 * a^2 / 4 - 2 * b + 2 * s - else 3 * a^2 / 4 - R^2 - 2 * b + (4 * a * b - 8 * c - a^3) / (4 * R))) \ - (E^2 = (if R = 0 then 3 * a^2 / 4 - 2 * b - 2 * s - else 3 * a^2 / 4 - R^2 - 2 * b - (4 * a * b - 8 * c - a^3) / (4 * R))) + "(y::real)^3 - b * y^2 + (a * c - 4 * d) * y - a^2 * d + 4 * b * d - c^2 = 0 \ + R^2 = a^2 / 4 - b + y \ + s^2 = y^2 - 4 * d \ + (D^2 = (if R = 0 then 3 * a^2 / 4 - 2 * b + 2 * s + else 3 * a^2 / 4 - R^2 - 2 * b + (4 * a * b - 8 * c - a^3) / (4 * R))) \ + (E^2 = (if R = 0 then 3 * a^2 / 4 - 2 * b - 2 * s + else 3 * a^2 / 4 - R^2 - 2 * b - (4 * a * b - 8 * c - a^3) / (4 * R))) \ x^4 + a * x^3 + b * x^2 + c * x + d = 0 \ x = -a / 4 + R / 2 + D / 2 \ x = -a / 4 + R / 2 - D / 2 \ x = -a / 4 - R / 2 + E / 2 \ x = -a / 4 - R / 2 - E / 2" -apply (cases "R=0", simp_all add: field_simps divide_minus_left[symmetric] del: divide_minus_left) - apply algebra -apply algebra -done + apply (cases "R = 0") + apply (simp_all add: field_simps divide_minus_left[symmetric] del: divide_minus_left) + apply algebra + apply algebra + done end