Skip to content

Instantly share code, notes, and snippets.

@arademaker
Created February 26, 2021 16:43
Show Gist options
  • Save arademaker/d380c85c91a4f61391009f25a09ecf54 to your computer and use it in GitHub Desktop.
Save arademaker/d380c85c91a4f61391009f25a09ecf54 to your computer and use it in GitHub Desktop.
simple proof in Lean and show_term
import tactic
example (A B C : Prop) : A ∧ (B ∨ C) → (A ∧ B) ∨ (A ∧ C) :=
begin
show_term {
intro h,
have ha := h.left,
have hbc := h.right,
cases hbc with hb hc,
exact or.inl (and.intro ha hb),
exact or.inr (and.intro ha hc), },
end
example (A B C : Prop) : A ∧ (B ∨ C) → (A ∧ B) ∨ (A ∧ C) :=
begin
show_term {
intro h,
have ha := h.left,
have hbc := h.right,
cases hbc with hb hc,
left,
exact and.intro ha hb,
right,
exact and.intro ha hc, },
end
example (A B C : Prop) : A ∧ (B ∨ C) → (A ∧ B) ∨ (A ∧ C) :=
λ h, h.right.dcases_on (λ (hb : B), or.inl ⟨h.left, hb⟩) (λ (hc : C), or.inr ⟨h.left, hc⟩)
example (A B C : Prop) : A ∧ (B ∨ C) → (A ∧ B) ∨ (A ∧ C) :=
λ h, or.elim h.right
(λ hb, or.inl $ and.intro h.1 hb)
(λ hc, or.inr $ and.intro h.1 hc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment