Built with Alectryon. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
Hover-Settings: Show types: Show goals:
-- import Batteries.Tactic.Rcases
-- import Mathlib.Tactic.Cases
-- import Mathlib.Tactic.Use
import Mathlib.Logic.Basic
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Use

-- https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/rcases.20vs.20cases

-- ## Understanding `rintro` for 1 pattern

-- using `rintro`
example (p: Nat → Prop) : (∃ a, p a) → (∃ b, p b) → (∃ c, p c) := 

Goals accomplished! 🐙
p: Nat → Prop
a: Nat
ha: p a
b: Nat
hb: p b

∃ c, p c

Goals accomplished! 🐙
-- break `rintro` into `intro`s and `obtain`s example (p: Nat → Prop) : (∃ a, p a) → (∃ b, p b) → (∃ c, p c) :=

Goals accomplished! 🐙
Warning: Try this: intro h1 h2
p: Nat → Prop
h1: ∃ a, p a

(∃ b, p b) → ∃ c, p c
Warning: Try this: intro h1 h2
p: Nat → Prop
h1, h2: ∃ b, p b

∃ c, p c
Warning: Try this: intro h1 h2
p: Nat → Prop
h2: ∃ b, p b
a: Nat
ha: p a

∃ c, p c
p: Nat → Prop
a: Nat
ha: p a
b: Nat
hb: p b

∃ c, p c

Goals accomplished! 🐙
-- rewrite `obtain` to `cases'` example (p: Nat → Prop) : (∃ a, p a) → (∃ b, p b) → (∃ c, p c) :=

Goals accomplished! 🐙
Warning: Try this: intro h1 h2
p: Nat → Prop
h1: ∃ a, p a

(∃ b, p b) → ∃ c, p c
Warning: Try this: intro h1 h2
p: Nat → Prop
h1, h2: ∃ b, p b

∃ c, p c
Warning: Try this: intro h1 h2
p: Nat → Prop
h2: ∃ b, p b
a: Nat
ha: p a

intro
∃ c, p c
p: Nat → Prop
a✝: Nat
ha✝: p a✝
a: Nat
ha: p a

intro.intro
∃ c, p c

Goals accomplished! 🐙
-- ## Understanding `rintro` for 1+ patterns -- using `rintro` example (p: Nat → Nat → Prop) : (∃ a, (∃ b, p a b)) → (∃ c, (∃ d, p c d)) :=

Goals accomplished! 🐙
p: Nat → Nat → Prop
a, b: Nat
hb: p a b

∃ c d, p c d
p: Nat → Nat → Prop
a, b: Nat
hb: p a b

h
∃ d, p a d

Goals accomplished! 🐙
-- break `rintro` into `intro`s and `cases'`s example (p: Nat → Nat → Prop) : (∃ a, (∃ b, p a b)) → (∃ c, (∃ d, p c d)) :=

Goals accomplished! 🐙
p: Nat → Nat → Prop
h: ∃ a b, p a b

∃ c d, p c d
p: Nat → Nat → Prop
a: Nat
ha: ∃ b, p a b

intro
∃ c d, p c d
p: Nat → Nat → Prop
a, b: Nat
hb: p a b

intro.intro
∃ c d, p c d
p: Nat → Nat → Prop
a, b: Nat
hb: p a b

h
∃ d, p a d

Goals accomplished! 🐙
-- collapse `cases'`s into a single `rcases` example (p: Nat → Nat → Prop) : (∃ a, (∃ b, p a b)) → (∃ c, (∃ d, p c d)) :=

Goals accomplished! 🐙
p: Nat → Nat → Prop
h: ∃ a b, p a b

∃ c d, p c d
p: Nat → Nat → Prop
a, b: Nat
hb: p a b

∃ c d, p c d
p: Nat → Nat → Prop
a, b: Nat
hb: p a b

h
∃ d, p a d

Goals accomplished! 🐙
-- rewrite `rcases` to `obtain` then look at `rintro` above again example (p: Nat → Nat → Prop) : (∃ a, (∃ b, p a b)) → (∃ c, (∃ d, p c d)) :=

Goals accomplished! 🐙
p: Nat → Nat → Prop
h: ∃ a b, p a b

∃ c d, p c d
p: Nat → Nat → Prop
a, b: Nat
hb: p a b

∃ c d, p c d
p: Nat → Nat → Prop
a, b: Nat
hb: p a b

h
∃ d, p a d

Goals accomplished! 🐙
namespace Foo
eq_or_ne.{u_1} {α : Sort u_1} (x y : α) : x = y ∨ x ≠ y
eq_or_ne: ∀ {α : Sort u_1} (x y : α), x = y ∨ x ≠ y
eq_or_ne
variable (
p: Prop
p
q: Prop
q
r: Prop
r
:
Prop: Type
Prop
)
example: ∀ (p q : Prop), p ∨ q → q ∨ p
example
(
h: p ∨ q
h
:
p: Prop
p
∨
q: Prop
q
) :
q: Prop
q
∨
p: Prop
p
:=

Goals accomplished! 🐙
p, q, r: Prop
hp: p

inl
q ∨ p
p, q, r: Prop
hq: q
q ∨ p
p, q, r: Prop
hp: p

inl
q ∨ p

Goals accomplished! 🐙
p, q, r: Prop
hq: q

inr
q ∨ p

Goals accomplished! 🐙
example: ∀ (p q : Prop), p ∧ q → q ∧ p
example
(
h: p ∧ q
h
:
p: Prop
p
∧
q: Prop
q
) :
q: Prop
q
∧
p: Prop
p
:=

Goals accomplished! 🐙
p, q, r: Prop
hp: p
hq: q

q ∧ p

Goals accomplished! 🐙
example: ∀ (p q r : Prop), (p ∨ q) ∧ r → r ∧ (q ∨ p)
example
(
h: (p ∨ q) ∧ r
h
: (
p: Prop
p
∨
q: Prop
q
) ∧
r: Prop
r
) :
r: Prop
r
∧ (
q: Prop
q
∨
p: Prop
p
) :=

Goals accomplished! 🐙
p, q, r: Prop
hr: r
hp: p

inl
r ∧ (q ∨ p)
p, q, r: Prop
hr: r
hq: q
r ∧ (q ∨ p)
p, q, r: Prop
hr: r
hp: p

inl
r ∧ (q ∨ p)

Goals accomplished! 🐙
p, q, r: Prop
hr: r
hq: q

inr
r ∧ (q ∨ p)

Goals accomplished! 🐙
example: ∀ (p q : Prop), p ∨ q → q ∨ p
example
(
h: p ∨ q
h
:
p: Prop
p
∨
q: Prop
q
) :
q: Prop
q
∨
p: Prop
p
:=

Goals accomplished! 🐙

Goals accomplished! 🐙

Goals accomplished! 🐙

Goals accomplished! 🐙

Goals accomplished! 🐙

Goals accomplished! 🐙