(* La_paradoja_del_barbero.lean -- La paradoja del barbero. -- José A. Alonso Jiménez -- Sevilla, 29-mayo-2024 -- ------------------------------------------------------------------ *) (* --------------------------------------------------------------------- -- Demostrar la paradoja del barbero https://bit.ly/3eWyvVw es decir, -- que no existe un hombre que afeite a todos los que no se afeitan a sí -- mismo y sólo a los que no se afeitan a sí mismo. -- ------------------------------------------------------------------ *) theory La_paradoja_del_barbero imports Main begin (* 1\ demostración *) lemma "\(\ x::'H. \ y::'H. afeita x y \ \ afeita y y)" proof (rule notI) assume "\ x. \ y. afeita x y \ \ afeita y y" then obtain b where "\ y. afeita b y \ \ afeita y y" by (rule exE) then have h : "afeita b b \ \ afeita b b" by (rule allE) show False proof (cases "afeita b b") assume "afeita b b" then have "\ afeita b b" using h by (rule rev_iffD1) then show False using \afeita b b\ by (rule notE) next assume "\ afeita b b" then have "afeita b b" using h by (rule rev_iffD2) with \\ afeita b b\ show False by (rule notE) qed qed (* 2\ demostración *) lemma "\(\ x::'H. \ y::'H. afeita x y \ \ afeita y y)" proof assume "\ x. \ y. afeita x y \ \ afeita y y" then obtain b where "\ y. afeita b y \ \ afeita y y" by (rule exE) then have h : "afeita b b \ \ afeita b b" by (rule allE) then show False by simp qed (* 3\ demostración *) lemma "\(\ x::'H. \ y::'H. afeita x y \ \ afeita y y)" by auto end