0
lemma ejercicio_36o:
    "(p ∨ q) ∧ (p ∨ r) ⟹ p ∨ (q ∧ r)"
      apply (frule conjunct1)
      apply (frule conjunct2)
      apply (erule disjE)
       apply (erule disjI1)
      apply (erule disjE)
       apply (erule disjI1)
      apply (rule disjI2)
      apply (erule conjI)
      apply assumption
      done

I managed to prove the one above, but not the one below. It should be possible to do it with just those rules.

lemma ejercicio_36:
  assumes "(p ∨ q) ∧ (p ∨ r)"
  shows "p ∨ (q ∧ r)"
proof - 
  have "p ∨ q" using assms(1) by (rule conjunct1)
  have "p ∨ r" using assms(1) by (rule conjunct2)
  moreover 
  {assume "p"
    hence "p ∨ (q ∧ r)" by (rule disjI1)}
  moreover 
  {assume "q ∧ r"
    hence "p ∨ (q ∧ r)" by (rule disjI2)}
  ultimately show "p ∨ (q ∧ r)" by (rule disjE)
  oops 

Thank you.

1 Answers1

1

Thanks to Patrick Browne I got what I was looking for.

lemma exercise:
  assumes "(p ∨ q) ∧ (p ∨ r)"
  shows "p ∨ (q ∧ r)"
proof - 
  have "p ∨ q" and "p ∨ r" using assms by (rule conjunct1, rule conjunct2)
  note ‹p ∨ q›
  moreover 
  {assume "p" 
    hence "p ∨ (q ∧ r)" by (rule disjI1)}
  moreover 
  {assume "q"
    note ‹p ∨ r›
    moreover 
    {assume "p"
      hence "p ∨ (q ∧ r)" by (rule disjI1)}
    moreover 
    {assume "r" 
      with ‹q› have "q ∧ r" by (rule conjI)
      hence "p ∨ (q ∧ r)" by (rule disjI2)}
    ultimately have "p ∨ (q ∧ r)" by (rule disjE)}
  ultimately show "p ∨ (q ∧ r)" by (rule disjE)
qed

enter image description here