lean4-htt/doc/examples/NFM2022/nfm15.lean
2022-05-23 18:20:37 -07:00

19 lines
702 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.

/- intro tactic variants -/
example (p q : α → Prop) : (∃ x, p x ∧ q x) → ∃ x, q x ∧ p x := by
intro h
match h with
| Exists.intro w (And.intro hp hq) => exact Exists.intro w (And.intro hq hp)
example (p q : α → Prop) : (∃ x, p x ∧ q x) → ∃ x, q x ∧ p x := by
intro (Exists.intro _ (And.intro hp hq))
exact Exists.intro _ (And.intro hq hp)
example (p q : α → Prop) : (∃ x, p x ∧ q x) → ∃ x, q x ∧ p x := by
intro ⟨_, hp, hq⟩
exact ⟨_, hq, hp⟩
example (α : Type) (p q : α → Prop) : (∃ x, p x q x) → ∃ x, q x p x := by
intro
| ⟨_, .inl h⟩ => exact ⟨_, .inr h⟩
| ⟨_, .inr h⟩ => exact ⟨_, .inl h⟩