(* Title: Example_Metric.thy Author: Maximilian Schäffeler *) theory Example_Metric imports"HOL-Analysis.Metric_Arith""HOL-Eisbach.Eisbach_Tools" begin
text‹An Eisbach implementation of the method @{method metric}. Slower than the Isabelle/ML implementation but arguably more readable.›
method rewr_maxdist for ps::"'a::metric_space set"uses pos_thms =
match conclusion in "?P (dist x y)" (cut) for x y::'a ==>‹ simp only: maxdist_thm[where s=ps and x=x and y=y] simp_thms finite.emptyI finite_insert empty_iff insert_iff; rewr_maxdist ps pos_thms: pos_thms zero_le_dist[of x y]› ∣ _ ==>‹ ball_simp?; dist_refl_sym?; elim_sup?; pre_arith argo_thms: pos_thms›
lemmas metric_eq_thm = metric_eq_thm🍋‹normalizes indexnames›
method rewr_metric_eq for ps::"'a::metric_space set" =
match conclusion in "?P (x = y)" (cut) for x y::'a ==>‹ simp only: metric_eq_thm[where s=ps and x=x and y=y] simp_thms empty_iff insert_iff; rewr_metric_eq ps› ∣ _ ==>‹-›
method find_points for ps::"'a::metric_space set"and t::bool =
match (t) in "Q p" (cut) for p::'a and Q::"'a==>bool"==>‹ find_points ‹insert p ps›‹∀p. Q p›\› ∣ _ ==>‹ rewr_metric_eq ps; rewr_maxdist ps›
method basic_metric_arith for p::"'a::metric_space" =
dist_refl_sym?;
match conclusion in "Q q" (cut) for q::'a and Q ==>‹ find_points ‹{q}›‹∀p. Q p›\› ∣ _ ==>‹ rewr_metric_eq ‹{}::'a set›; rewr_maxdist ‹{}::'a set›\›
method elim_exists for p::"'a::metric_space" =
elim_exists_loop p;
basic_metric_arith p
method find_type =
match conclusion in (* exists in front *) "∃x::'a::metric_space. ?P x"==>‹ match conclusion in "?Q x" (cut) for x::"'a::metric_space" ==>‹elim_exists x› ∣ _ ==>‹ rule exI; match conclusion in "?Q x" (cut) for x::"'a::metric_space" ==>‹elim_exists x›\›\ (* no exists *) ∣"?P (λy. (dist x y))" (cut) for x::"'a::metric_space"==>‹elim_exists x› ∣"?P (λx. (dist x y))" (cut) for y::"'a::metric_space"==>‹elim_exists y› ∣"?P (λy. (x = y))" (cut) for x::"'a::metric_space"==>‹elim_exists x› ∣"?P (λx. (x = y))" (cut) for y::"'a::metric_space"==>‹elim_exists y› ∣ _ ==>‹ rule exI; find_type›
lemma"∃x::'a::metric_space. x=x" by metric_eisbach
lemma"∀(x::'a::metric_space). ∃y. x = y" by metric_eisbach
lemma"∃x y. dist x y = 0" by metric_eisbach
lemma"∃y. dist x y = 0" by metric_eisbach
lemma"0 = dist x y ==> x = y" by metric_eisbach
lemma"x ≠ y ==> dist x y ≠ 0" by metric_eisbach
lemma"∃y. dist x y ≠ 1" by metric_eisbach
lemma"x = y ⟷ dist x x = dist y x ∧ dist x y = dist y y" by metric_eisbach
lemma"dist a b ≠ dist a c ==> b ≠ c" by metric_eisbach
lemma"dist y x + c ≥ c" by metric_eisbach
lemma"dist x y + dist x z ≥ 0" by metric_eisbach
lemma"dist x y ≥ v ==> dist x y + dist (a::'a) b ≥ v"for x::"('a::metric_space)" by metric_eisbach
lemma"dist x y < 0 ⟶ P" by metric_eisbach
text‹reasoning with the triangle inequality›
lemma"dist a d ≤ dist a b + dist b c + dist c d" by metric_eisbach
lemma"dist a e ≤ dist a b + dist b c + dist c d + dist d e" by metric_eisbach
lemma"max (dist x y) ∣dist x z - dist z y∣ = dist x y" by metric_eisbach
lemma "dist w x < e/3 ==> dist x y < e/3 ==> dist y z < e/3 ==> dist w x < e" by metric_eisbach
lemma"dist w x < e/4 ==> dist x y < e/4 ==> dist y z < e/2 ==> dist w z < e" by metric_eisbach
lemma"dist x y = r / 2 ==> (∀z. dist x z < r / 4 ⟶ dist y z ≤ 3 * r / 4)" by metric_eisbach
lemma"∃x. ∀r≤0. ∃z. dist x z ≥ r" by metric_eisbach
lemma"∧a r x y. dist x a + dist a y = r ==>∀z. r ≤ dist x z + dist z y ==> dist x y = r" by metric_eisbach
end
Messung V0.5 in Prozent
¤ 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.0.11Bemerkung:
(vorverarbeitet am 2026-04-26)
¤
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 und die Messung sind noch experimentell.