(* Union_con_su_diferencia.thy -- s ∪ (s ∩ t) = s -- José A. Alonso Jiménez -- Sevilla, 26-mayo-2021 -- ------------------------------------------------------------------ *) (* --------------------------------------------------------------------- Demostrar que (s \ t) \ t = s \ t ------------------------------------------------------------------- *) theory Union_con_su_diferencia imports Main begin (* 1\ demostración *) lemma "(s - t) \ t = s \ t" proof (rule equalityI) show "(s - t) \ t \ s \ t" proof (rule subsetI) fix x assume "x \ (s - t) \ t" then show "x \ s \ t" proof (rule UnE) assume "x \ s - t" then have "x \ s" by (simp only: DiffD1) then show "x \ s \ t" by (simp only: UnI1) next assume "x \ t" then show "x \ s \ t" by (simp only: UnI2) qed qed next show "s \ t \ (s - t) \ t" proof (rule subsetI) fix x assume "x \ s \ t" then show "x \ (s - t) \ t" proof (rule UnE) assume "x \ s" show "x \ (s - t) \ t" proof (cases \x \ t\) assume "x \ t" then show "x \ (s - t) \ t" by (simp only: UnI2) next assume "x \ t" with \x \ s\ have "x \ s - t" by (rule DiffI) then show "x \ (s - t) \ t" by (simp only: UnI1) qed next assume "x \ t" then show "x \ (s - t) \ t" by (simp only: UnI2) qed qed qed (* 2\ demostración *) lemma "(s - t) \ t = s \ t" proof show "(s - t) \ t \ s \ t" proof fix x assume "x \ (s - t) \ t" then show "x \ s \ t" proof assume "x \ s - t" then have "x \ s" by simp then show "x \ s \ t" by simp next assume "x \ t" then show "x \ s \ t" by simp qed qed next show "s \ t \ (s - t) \ t" proof fix x assume "x \ s \ t" then show "x \ (s - t) \ t" proof assume "x \ s" show "x \ (s - t) \ t" proof assume "x \ t" with \x \ s\ show "x \ s - t" by simp qed next assume "x \ t" then show "x \ (s - t) \ t" by simp qed qed qed (* 3\ demostración *) lemma "(s - t) \ t = s \ t" by (fact Un_Diff_cancel2) (* 4\ demostración *) lemma "(s - t) \ t = s \ t" by auto end