(* Las_particiones_definen_relaciones_transitivas.thy -- Las particiones definen relaciones transitivas. -- José A. Alonso Jiménez -- Sevilla, 8-julio-2024 -- ------------------------------------------------------------------ *) (* --------------------------------------------------------------------- -- Cada familia de conjuntos P define una relación de forma que dos -- elementos están relacionados si algún conjunto de P contiene a ambos -- elementos. Se puede definir en Isabelle por -- definition relacion :: "('a set) set \ 'a \ 'a \ bool" where -- "relacion P x y \ (\A\P. x \ A \ y \ A)" -- -- Una familia de subconjuntos de X es una partición de X si cada elemento -- de X pertenece a un único conjunto de P y todos los elementos de P -- son no vacíos. Se puede definir en Isabelle por -- definition particion :: "('a set) set \ bool" where -- "particion P \ (\x. (\B\P. x \ B \ (\C\P. x \ C \ B = C))) \ {} \ P" -- -- Demostrar que si P es una partición de X, entonces la relación -- definida por P es transitiva. -- ------------------------------------------------------------------ *) theory Las_particiones_definen_relaciones_transitivas imports Main begin definition relacion :: "('a set) set \ 'a \ 'a \ bool" where "relacion P x y \ (\A\P. x \ A \ y \ A)" definition particion :: "('a set) set \ bool" where "particion P \ (\x. (\B\P. x \ B \ (\C\P. x \ C \ B = C))) \ {} \ P" (* 1\ demostración *) lemma assumes "particion P" shows "transp (relacion P)" proof (rule transpI) fix x y z assume "relacion P x y" and "relacion P y z" have "\A\P. x \ A \ y \ A" using \relacion P x y\ by (simp only: relacion_def) then obtain A where "A \ P" and hA : "x \ A \ y \ A" by (rule bexE) have "\B\P. y \ B \ z \ B" using \relacion P y z\ by (simp only: relacion_def) then obtain B where "B \ P" and hB : "y \ B \ z \ B" by (rule bexE) have "A = B" proof - have "\C \ P. y \ C \ (\D\P. y \ D \ C = D)" using assms by (simp only: particion_def) then obtain C where "C \ P" and hC : "y \ C \ (\D\P. y \ D \ C = D)" by (rule bexE) have hC' : "\D\P. y \ D \ C = D" using hC by (rule conjunct2) have "C = A" using \A \ P\ hA hC' by simp moreover have "C = B" using \B \ P\ hB hC by simp ultimately show "A = B" by (rule subst) qed then have "x \ A \ z \ A" using hA hB by simp then have "\A\P. x \ A \ z \ A" using \A \ P\ by (rule bexI) then show "relacion P x z" using \A = B\ \A \ P\ by (unfold relacion_def) qed (* 2\ demostración *) lemma assumes "particion P" shows "transp (relacion P)" proof (rule transpI) fix x y z assume "relacion P x y" and "relacion P y z" obtain A where "A \ P" and hA : "x \ A \ y \ A" using \relacion P x y\ by (meson relacion_def) obtain B where "B \ P" and hB : "y \ B \ z \ B" using \relacion P y z\ by (meson relacion_def) have "A = B" proof - obtain C where "C \ P" and hC : "y \ C \ (\D\P. y \ D \ C = D)" using assms particion_def by metis have "C = A" using \A \ P\ hA hC by auto moreover have "C = B" using \B \ P\ hB hC by auto ultimately show "A = B" by simp qed then have "x \ A \ z \ A" using hA hB by auto then show "relacion P x z" using \A = B\ \A \ P\ relacion_def by metis qed (* 3\ demostración *) lemma assumes "particion P" shows "transp (relacion P)" using assms particion_def relacion_def by (smt (verit) transpI) end