(* Imagen_de_la_union.thy -- f[s ∪ t] = f[s] ∪ f[t] -- José A. Alonso Jiménez -- Sevilla, 6-junio-2021 -- ------------------------------------------------------------------ *) (* --------------------------------------------------------------------- En Isabelle, la imagen de un conjunto s por una función f se representa por f ` s = {y | \ x, x \ s \ f x = y} Demostrar que f ` (s \ t) = f ` s \ f ` t ------------------------------------------------------------------- *) theory Imagen_de_la_union imports Main begin (* 1\ demostración *) lemma "f ` (s \ t) = f ` s \ f ` t" proof (rule equalityI) show "f ` (s \ t) \ f ` s \ f ` t" proof (rule subsetI) fix y assume "y \ f ` (s \ t)" then show "y \ f ` s \ f ` t" proof (rule imageE) fix x assume "y = f x" assume "x \ s \ t" then show "y \ f ` s \ f ` t" proof (rule UnE) assume "x \ s" with \y = f x\ have "y \ f ` s" by (simp only: image_eqI) then show "y \ f ` s \ f ` t" by (rule UnI1) next assume "x \ t" with \y = f x\ have "y \ f ` t" by (simp only: image_eqI) then show "y \ f ` s \ f ` t" by (rule UnI2) qed qed qed next show "f ` s \ f ` t \ f ` (s \ t)" proof (rule subsetI) fix y assume "y \ f ` s \ f ` t" then show "y \ f ` (s \ t)" proof (rule UnE) assume "y \ f ` s" then show "y \ f ` (s \ t)" proof (rule imageE) fix x assume "y = f x" assume "x \ s" then have "x \ s \ t" by (rule UnI1) with \y = f x\ show "y \ f ` (s \ t)" by (simp only: image_eqI) qed next assume "y \ f ` t" then show "y \ f ` (s \ t)" proof (rule imageE) fix x assume "y = f x" assume "x \ t" then have "x \ s \ t" by (rule UnI2) with \y = f x\ show "y \ f ` (s \ t)" by (simp only: image_eqI) qed qed qed qed (* 2\ demostración *) lemma "f ` (s \ t) = f ` s \ f ` t" proof show "f ` (s \ t) \ f ` s \ f ` t" proof fix y assume "y \ f ` (s \ t)" then show "y \ f ` s \ f ` t" proof fix x assume "y = f x" assume "x \ s \ t" then show "y \ f ` s \ f ` t" proof assume "x \ s" with \y = f x\ have "y \ f ` s" by simp then show "y \ f ` s \ f ` t" by simp next assume "x \ t" with \y = f x\ have "y \ f ` t" by simp then show "y \ f ` s \ f ` t" by simp qed qed qed next show "f ` s \ f ` t \ f ` (s \ t)" proof fix y assume "y \ f ` s \ f ` t" then show "y \ f ` (s \ t)" proof assume "y \ f ` s" then show "y \ f ` (s \ t)" proof fix x assume "y = f x" assume "x \ s" then have "x \ s \ t" by simp with \y = f x\ show "y \ f ` (s \ t)" by simp qed next assume "y \ f ` t" then show "y \ f ` (s \ t)" proof fix x assume "y = f x" assume "x \ t" then have "x \ s \ t" by simp with \y = f x\ show "y \ f ` (s \ t)" by simp qed qed qed qed (* 3\ demostración *) lemma "f ` (s \ t) = f ` s \ f ` t" by (simp only: image_Un) (* 4\ demostración *) lemma "f ` (s \ t) = f ` s \ f ` t" by auto end