lean4-htt/doc/examples/Certora2022/ex18.lean
2022-11-21 17:02:28 -08:00

20 lines
530 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/- Structuring proofs (cont.) -/
example : p ∧ (q r) → (p ∧ q) (p ∧ r) := by
intro h
have hp : p := h.left
have hqr : q r := h.right
show (p ∧ q) (p ∧ r)
cases hqr with
| inl hq => exact Or.inl ⟨hp, hq⟩
| inr hr => exact Or.inr ⟨hp, hr⟩
example : p ∧ (q r) → (p ∧ q) (p ∧ r) := by
intro ⟨hp, hqr⟩
cases hqr with
| inl hq =>
have := And.intro hp hq
apply Or.inl; exact this
| inr hr =>
have := And.intro hp hr
apply Or.inr; exact this