Diferencia entre revisiones de «Relación 8»
De Razonamiento automático (2016-17)
Línea 104: | Línea 104: | ||
¬(¬p ∨ ¬q) ⊢ p ∧ q | ¬(¬p ∨ ¬q) ⊢ p ∧ q | ||
------------------------------------------------------------------ *} | ------------------------------------------------------------------ *} | ||
− | + | (* marcarmor13 *) | |
+ | --"usando un supuesto ¬p ∨ ¬q" | ||
+ | lemma ejercicio_3: | ||
+ | assumes 1: "¬(¬p ∨ ¬q)" and | ||
+ | 2:"¬p ∨ ¬q" | ||
+ | shows "p ∧ q" | ||
+ | proof- | ||
+ | have 3: "p"using 1 2 by (rule notE) | ||
+ | have 4: "q"using 1 2 by (rule notE) | ||
+ | show "p ∧ q" using 3 4 by (rule conjI) | ||
+ | qed | ||
text {* --------------------------------------------------------------- | text {* --------------------------------------------------------------- | ||
Ejercicio 4. Demostrar | Ejercicio 4. Demostrar |
Revisión del 17:03 13 ene 2017
chapter {* R8: Deducción natural proposicional en Isabelle/HOL *}
theory R8_Deduccion_natural_proposicional
imports Main
begin
text {*
Demostrar o refutar los siguientes lemas usando sólo las reglas
básicas de deducción natural de la lógica proposicional, de los
cuantificadores y de la igualdad:
· conjI: ⟦P; Q⟧ ⟹ P ∧ Q
· conjunct1: P ∧ Q ⟹ P
· conjunct2: P ∧ Q ⟹ Q
· notnotD: ¬¬ P ⟹ P
· mp: ⟦P ⟶ Q; P⟧ ⟹ Q
· impI: (P ⟹ Q) ⟹ P ⟶ Q
· disjI1: P ⟹ P ∨ Q
· disjI2: Q ⟹ P ∨ Q
· disjE: ⟦P ∨ Q; P ⟹ R; Q ⟹ R⟧ ⟹ R
· FalseE: False ⟹ P
· notE: ⟦¬P; P⟧ ⟹ R
· notI: (P ⟹ False) ⟹ ¬P
· iffI: ⟦P ⟹ Q; Q ⟹ P⟧ ⟹ P = Q
· iffD1: ⟦Q = P; Q⟧ ⟹ P
· iffD2: ⟦P = Q; Q⟧ ⟹ P
· ccontr: (¬P ⟹ False) ⟹ P
· allI: ⟦∀x. P x; P x ⟹ R⟧ ⟹ R
· allE: (⋀x. P x) ⟹ ∀x. P x
· exI: P x ⟹ ∃x. P x
· exE: ⟦∃x. P x; ⋀x. P x ⟹ Q⟧ ⟹ Q
· refl: t = t
· subst: ⟦s = t; P s⟧ ⟹ P t
· trans: ⟦r = s; s = t⟧ ⟹ r = t
· sym: s = t ⟹ t = s
· not_sym: t ≠ s ⟹ s ≠ t
· ssubst: ⟦t = s; P s⟧ ⟹ P t
· box_equals: ⟦a = b; a = c; b = d⟧ ⟹ a: = d
· arg_cong: x = y ⟹ f x = f y
· fun_cong: f = g ⟹ f x = g x
· cong: ⟦f = g; x = y⟧ ⟹ f x = g y
*}
text {*
Se usarán las reglas notnotI, mt y not_ex que demostramos a continuación.
*}
lemma notnotI: "P ⟹ ¬¬ P"
by auto
lemma mt: "⟦F ⟶ G; ¬G⟧ ⟹ ¬F"
by auto
lemma no_ex: "¬(∃x. P(x)) ⟹ ∀x. ¬P(x)"
by auto
text {* ---------------------------------------------------------------
Ejercicio 1. Demostrar
¬q ⟶ ¬p ⊢ p ⟶ q
------------------------------------------------------------------ *}
(* marcarmor13 *)
--"usando un supuesto ¬¬p"
lemma ejercicio_1:
assumes 1: "¬q ⟶ ¬p" and
2: "¬¬p"
shows "p ⟶ q"
proof -
have 3: "¬¬q" using 1 2 by (rule mt)
have 4: "q" using 3 by (rule notnotD)
show "p ⟶ q" using 4 by (rule impI)
qed
(*pablucoto*)
lemma ejercicio_1_2:
assumes "¬q ⟶ ¬p"
shows "p ⟶ q"
proof -
{assume "p"
hence "¬¬p" by (rule notnotI)
with `¬q ⟶ ¬p` have "¬¬q" by (rule mt)
hence "q" by (rule notnotD)}
then show "p ⟶ q" by (rule impI)
qed
text {* ---------------------------------------------------------------
Ejercicio 2. Demostrar
¬(¬p ∧ ¬q) ⊢ p ∨ q
------------------------------------------------------------------ *}
(* marcarmor13 *)
--"usando un supuesto ¬p ∧ ¬q"
lemma ejercicio_2:
assumes 1: "¬(¬p ∧ ¬q)" and
2:"¬p ∧ ¬q"
shows "p ∨ q"
proof-
have 3: "p"using 1 2 by (rule notE)
show "p ∨ q" using 3 by (rule disjI1)
qed
text {* ---------------------------------------------------------------
Ejercicio 3. Demostrar
¬(¬p ∨ ¬q) ⊢ p ∧ q
------------------------------------------------------------------ *}
(* marcarmor13 *)
--"usando un supuesto ¬p ∨ ¬q"
lemma ejercicio_3:
assumes 1: "¬(¬p ∨ ¬q)" and
2:"¬p ∨ ¬q"
shows "p ∧ q"
proof-
have 3: "p"using 1 2 by (rule notE)
have 4: "q"using 1 2 by (rule notE)
show "p ∧ q" using 3 4 by (rule conjI)
qed
text {* ---------------------------------------------------------------
Ejercicio 4. Demostrar
¬(p ∧ q) ⊢ ¬p ∨ ¬q
------------------------------------------------------------------ *}
text {* ---------------------------------------------------------------
Ejercicio 5. Demostrar
⊢ (p ⟶ q) ∨ (q ⟶ p)
------------------------------------------------------------------ *}
end