(* La_inversa_de_una_funcion_biyectiva_es_biyectiva.thy -- La inversa de una función biyectiva es biyectiva. -- José A. Alonso Jiménez -- Sevilla, 19-junio-2024 -- ------------------------------------------------------------------ *) (* --------------------------------------------------------------------- -- En Isabelle se puede definir que g es una inversa de f por -- definition inversa :: "('a \ 'b) \ ('b \ 'a) \ bool" where -- "inversa f g \ (\ x. (g \ f) x = x) \ (\ y. (f \ g) y = y)" -- -- Demostrar que si la función f es biyectiva y g es una inversa de f, -- entonces g es biyectiva. -- ------------------------------------------------------------------- *) theory La_inversa_de_una_funcion_biyectiva_es_biyectiva imports Main begin definition inversa :: "('a \ 'b) \ ('b \ 'a) \ bool" where "inversa f g \ (\ x. (g \ f) x = x) \ (\ y. (f \ g) y = y)" (* 1\ demostración *) lemma fixes f :: "'a \ 'b" assumes "inversa g f" shows "bij g" proof (rule bijI) show "inj g" proof (rule injI) fix x y assume "g x = g y" have h1 : "\ y. (f \ g) y = y" by (meson assms inversa_def) then have "x = (f \ g) x" by (simp only: allE) also have "\ = f (g x)" by (simp only: o_apply) also have "\ = f (g y)" by (simp only: \g x = g y\) also have "\ = (f \ g) y" by (simp only: o_apply) also have "\ = y" using h1 by (simp only: allE) finally show "x = y" by this qed next show "surj g" proof (rule surjI) fix x have h2 : "\ x. (g \ f) x = x" by (meson assms inversa_def) then have "(g \ f) x = x" by (simp only: allE) then show "g (f x) = x" by (simp only: o_apply) qed qed (* 2\ demostración *) lemma fixes f :: "'a \ 'b" assumes "inversa g f" shows "bij g" proof (rule bijI) show "inj g" proof (rule injI) fix x y assume "g x = g y" have h1 : "\ y. (f \ g) y = y" by (meson assms inversa_def) then show "x = y" by (metis \g x = g y\ o_apply) qed next show "surj g" proof (rule surjI) fix x have h2 : "\ x. (g \ f) x = x" by (meson assms inversa_def) then show "g (f x) = x" by (simp only: o_apply) qed qed end