(* Title: Geometric torus loops and certified winding coordinates Author: Carles Marín and OpenAI (AI-assisted proof engineering) License: BSD-2-Clause AFP dependency: Circle_Torus_Algebraic_Topology, by A. Freitas Ramos, D. Barros Hulak and R. J. G. B. de Queiroz. *) theory Torus_Geometric_Loops imports Torus_Word_Machinebegin definition circle_from_lift :: "(real \<Rightarrow> real) \<Rightarrow> real \<Rightarrow> complex" where "circle_from_lift q = circle_cover \<circ> q" lemma circle_from_lift_loop: assumes qpath: "path q" and q0: "q 0 = 0" and q1: "q 1 = of_int n" shows "is_loop (circle_from_lift q)"proof - have qcont: "continuous_on {0..1} q" using qpath by (simp add: path_def) have ppath: "path (circle_from_lift q)" unfolding path_def circle_from_lift_def o_def circle_cover_exp using qcont by (intro continuous_intros) have pimage: "path_image (circle_from_lift q) \<subseteq> circle" using circle_cover_into_circle by (auto simp: circle_from_lift_def path_image_def) have pstart: "pathstart (circle_from_lift q) = 1" using q0 by (simp add: circle_from_lift_def pathstart_def) have c1: "circle_cover (of_int n) = (1::complex)" using circle_cover_periodic_int[of 0 n] by simp have pfinish: "pathfinish (circle_from_lift q) = 1" using q1 c1 by (simp add: circle_from_lift_def pathfinish_def) show ?thesis using ppath pimage pstart pfinish by (simp add: is_loop_def)qed lemma circle_from_lift_degree: assumes qpath: "path q" and q0: "q 0 = 0" and q1: "q 1 = of_int n" shows "circle_lift_endpoint (circle_from_lift q) = n"proof - let ?p = "circle_from_lift q" have loop: "is_loop ?p" by (rule circle_from_lift_loop[OF assms]) have lift: "circle_path_lift ?p q" using qpath q0 by (simp add: circle_path_lift_def circle_from_lift_def pathstart_def o_def) have chosen: "circle_path_lift ?p (circle_lift ?p)" using loop by (intro circle_lift_spec) (simp_all add: is_loop_def) have same: "circle_lift ?p 1 = q 1" using circle_path_lift_unique [OF chosen lift is_loop_path[OF loop] is_loop_image[OF loop]] by simp have endpoint: "circle_lift ?p 1 = of_int (circle_lift_endpoint ?p)" by (rule circle_lift_endpoint_spec[OF loop]) show ?thesis using same endpoint q1 by simpqed definition torus_from_lifts :: "(real \<Rightarrow> real) \<Rightarrow> (real \<Rightarrow> real) \<Rightarrow> real \<Rightarrow> complex \<times> complex" where "torus_from_lifts q r = product_path (circle_from_lift q) (circle_from_lift r)" lemma torus_from_lifts_loop: assumes "path q" "q 0 = 0" "q 1 = of_int m" and "path r" "r 0 = 0" "r 1 = of_int n" shows "torus_loop (torus_from_lifts q r)" unfolding torus_from_lifts_def by (rule torus_loop_product) (use assms in \<open>auto intro: circle_from_lift_loop\<close>) theorem torus_from_lifts_degree: assumes "path q" "q 0 = 0" "q 1 = of_int m" and "path r" "r 0 = 0" "r 1 = of_int n" shows "torus_lift_endpoint (torus_from_lifts q r) = (m, n)" using assms by (simp add: torus_from_lifts_def torus_endpoint_product circle_from_lift_degree) theorem geometric_word_classification: assumes "path q" "q 0 = 0" "q 1 = of_int m" and "path r" "r 0 = 0" "r 1 = of_int n" shows "homotopic_paths (circle \<times> circle) (torus_from_lifts q r) (loop_path e) \<longleftrightarrow> (m, n) = word_degree e" using torus_loop_homotopic_iff [OF torus_from_lifts_loop[OF assms] loop_path_valid[of e]] by (simp add: torus_from_lifts_degree[OF assms] word_degree_correct) definition bent_horizontal :: "real \<Rightarrow> real" where "bent_horizontal t = 2*t + t*(1-t)*(t-1/2)" definition bent_vertical :: "real \<Rightarrow> real" where "bent_vertical t = -t + t*(1-t)*t" lemma bent_lifts: "path bent_horizontal" "bent_horizontal 0 = 0" "bent_horizontal 1 = of_int 2" "path bent_vertical" "bent_vertical 0 = 0" "bent_vertical 1 = of_int (-1)" unfolding bent_horizontal_def bent_vertical_def path_def by (auto intro!: continuous_intros) theorem bent_loop_degree: "torus_lift_endpoint (torus_from_lifts bent_horizontal bent_vertical) = (2, -1)" by (rule torus_from_lifts_degree[OF bent_lifts]) theorem bent_loop_matches_word: "homotopic_paths (circle \<times> circle) (torus_from_lifts bent_horizontal bent_vertical) (loop_path (Join (Join Horizontal Horizontal) (Inverse Vertical)))" using geometric_word_classification[OF bent_lifts, of "Join (Join Horizontal Horizontal) (Inverse Vertical)"] by simp end