l3lab/ntp-mathlib huggingface dataset:
/-- The language of the map is the map of the language. -/
@[simp]
theorem matches'_map (f : α → β) :
    ∀ P : RegularExpression α, (P.map f).matches' = Language.map f P.matches'
  | 0 => (map_zero _).symm
  | 1 => (map_one _).symm
  | char a => by
    rw [eq_comm]
    exact image_singleton
  -- porting note: the following close with last `rw` but not with `simp`?
  | R + S => by simp only [matches'_map, map, matches'_add]; rw [map_add]
  | R * S => by simp only [matches'_map, map, matches'_mul]; rw [map_mul]
  | star R => by
    simp_rw [map, matches', matches'_map]
    rw [Language.kstar_eq_iSup_pow, Language.kstar_eq_iSup_pow]
    simp_rw [← map_pow]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
f : α → β
R : RegularExpression α
⊢ ⨆ i, (Language.map f) (matches' R ^ i) = (Language.map f) (⨆ i, matches' R ^ i)

Next tactic:
exact image_iUnion.symm
theorem birkhoffAverage_zero (f : α → α) (g : α → M) (x : α) :
    birkhoffAverage R f g 0 x = 0 := by 

Proof state:
R : Type u_1
α : Type u_2
M : Type u_3
inst✝² : DivisionSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : α → α
g : α → M
x : α
⊢ birkhoffAverage R f g 0 x = 0

Next tactic:
simp [birkhoffAverage]
theorem birkhoffAverage_one (f : α → α) (g : α → M) (x : α) :
    birkhoffAverage R f g 1 x = g x := by 

Proof state:
R : Type u_1
α : Type u_2
M : Type u_3
inst✝² : DivisionSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : α → α
g : α → M
x : α
⊢ birkhoffAverage R f g 1 x = g x

Next tactic:
simp [birkhoffAverage]
theorem map_birkhoffAverage (S : Type*) {F N : Type*}
    [DivisionSemiring S] [AddCommMonoid N] [Module S N]
    [AddMonoidHomClass F M N] (g' : F) (f : α → α) (g : α → M) (n : ℕ) (x : α) :
    g' (birkhoffAverage R f g n x) = birkhoffAverage S f (g' ∘ g) n x := by
  

Proof state:
R : Type u_1
α : Type u_2
M : Type u_3
inst✝⁶ : DivisionSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
S : Type u_4
F : Type u_5
N : Type u_6
inst✝³ : DivisionSemiring S
inst✝² : AddCommMonoid N
inst✝¹ : Module S N
inst✝ : AddMonoidHomClass F M N
g' : F
f : α → α
g : α → M
n : ℕ
x : α
⊢ g' (birkhoffAverage R f g n x) = birkhoffAverage S f (⇑g' ∘ g) n x

Next tactic:
simp only [birkhoffAverage, map_inv_nat_cast_smul g' R S, map_birkhoffSum]
theorem birkhoffAverage_congr_ring' (S : Type*) [DivisionSemiring S] [Module S M] :
    birkhoffAverage (α := α) (M := M) R = birkhoffAverage S := by
  

Proof state:
R : Type u_1
α : Type u_2
M : Type u_3
inst✝⁴ : DivisionSemiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
S : Type u_4
inst✝¹ : DivisionSemiring S
inst✝ : Module S M
⊢ birkhoffAverage R = birkhoffAverage S

Next tactic:
ext
theorem birkhoffAverage_congr_ring' (S : Type*) [DivisionSemiring S] [Module S M] :
    birkhoffAverage (α := α) (M := M) R = birkhoffAverage S := by
  ext; 

Proof state:
case h.h.h.h
R : Type u_1
α : Type u_2
M : Type u_3
inst✝⁴ : DivisionSemiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
S : Type u_4
inst✝¹ : DivisionSemiring S
inst✝ : Module S M
x✝³ : α → α
x✝² : α → M
x✝¹ : ℕ
x✝ : α
⊢ birkhoffAverage R x✝³ x✝² x✝¹ x✝ = birkhoffAverage S x✝³ x✝² x✝¹ x✝

Next tactic:
apply birkhoffAverage_congr_ring
theorem Function.IsFixedPt.birkhoffAverage_eq [CharZero R] {f : α → α} {x : α} (h : IsFixedPt f x)
    (g : α → M) {n : ℕ} (hn : n ≠ 0) : birkhoffAverage R f g n x = g x := by
  

Proof state:
R : Type u_1
α : Type u_2
M : Type u_3
inst✝³ : DivisionSemiring R
inst✝² : AddCommMonoid M
inst✝¹ : Module R M
inst✝ : CharZero R
f : α → α
x : α
h : IsFixedPt f x
g : α → M
n : ℕ
hn : n ≠ 0
⊢ birkhoffAverage R f g n x = g x

Next tactic:
rw [birkhoffAverage, h.birkhoffSum_eq, nsmul_eq_smul_cast R, inv_smul_smul₀]
theorem Function.IsFixedPt.birkhoffAverage_eq [CharZero R] {f : α → α} {x : α} (h : IsFixedPt f x)
    (g : α → M) {n : ℕ} (hn : n ≠ 0) : birkhoffAverage R f g n x = g x := by
  rw [birkhoffAverage, h.birkhoffSum_eq, nsmul_eq_smul_cast R, inv_smul_smul₀]
  

Proof state:
case hc
R : Type u_1
α : Type u_2
M : Type u_3
inst✝³ : DivisionSemiring R
inst✝² : AddCommMonoid M
inst✝¹ : Module R M
inst✝ : CharZero R
f : α → α
x : α
h : IsFixedPt f x
g : α → M
n : ℕ
hn : n ≠ 0
⊢ ↑n ≠ 0

Next tactic:
rwa [Nat.cast_ne_zero]
/-- Birkhoff average is "almost invariant" under `f`:
the difference between `birkhoffAverage R f g n (f x)` and `birkhoffAverage R f g n x`
is equal to `(n : R)⁻¹ • (g (f^[n] x) - g x)`. -/
theorem birkhoffAverage_apply_sub_birkhoffAverage {α M : Type*} (R : Type*) [DivisionRing R]
    [AddCommGroup M] [Module R M] (f : α → α) (g : α → M) (n : ℕ) (x : α) :
    birkhoffAverage R f g n (f x) - birkhoffAverage R f g n x =
      (n : R)⁻¹ • (g (f^[n] x) - g x) := by
  

Proof state:
α : Type u_1
M : Type u_2
R : Type u_3
inst✝² : DivisionRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
f : α → α
g : α → M
n : ℕ
x : α
⊢ birkhoffAverage R f g n (f x) - birkhoffAverage R f g n x = (↑n)⁻¹ • (g (f^[n] x) - g x)

Next tactic:
simp only [birkhoffAverage, birkhoffSum_apply_sub_birkhoffSum, ← smul_sub]
theorem Pairwise.forall_of_forall (H : Symmetric R) (H₁ : ∀ x ∈ l, R x x) (H₂ : l.Pairwise R) :
    ∀ ⦃x⦄, x ∈ l → ∀ ⦃y⦄, y ∈ l → R x y :=
  H₂.forall_of_forall_of_flip H₁ <| by 

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l : List α
H : Symmetric R
H₁ : ∀ (x : α), x ∈ l → R x x
H₂ : Pairwise R l
⊢ Pairwise (flip fun x => R x) l

Next tactic:
rwa [H.flip_eq]
theorem Pairwise.forall (hR : Symmetric R) (hl : l.Pairwise R) :
    ∀ ⦃a⦄, a ∈ l → ∀ ⦃b⦄, b ∈ l → a ≠ b → R a b := by
  

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l : List α
hR : Symmetric R
hl : Pairwise R l
⊢ ∀ ⦃a : α⦄, a ∈ l → ∀ ⦃b : α⦄, b ∈ l → a ≠ b → R a b

Next tactic:
apply Pairwise.forall_of_forall
theorem Pairwise.forall (hR : Symmetric R) (hl : l.Pairwise R) :
    ∀ ⦃a⦄, a ∈ l → ∀ ⦃b⦄, b ∈ l → a ≠ b → R a b := by
  apply Pairwise.forall_of_forall
  · 

Proof state:
case H
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l : List α
hR : Symmetric R
hl : Pairwise R l
⊢ Symmetric fun x y => x ≠ y → R x y

Next tactic:
exact fun a b h hne => hR (h hne.symm)
theorem Pairwise.forall (hR : Symmetric R) (hl : l.Pairwise R) :
    ∀ ⦃a⦄, a ∈ l → ∀ ⦃b⦄, b ∈ l → a ≠ b → R a b := by
  apply Pairwise.forall_of_forall
  · exact fun a b h hne => hR (h hne.symm)
  · 

Proof state:
case H₁
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l : List α
hR : Symmetric R
hl : Pairwise R l
⊢ ∀ (x : α), x ∈ l → x ≠ x → R x x

Next tactic:
exact fun _ _ hx => (hx rfl).elim
theorem Pairwise.forall (hR : Symmetric R) (hl : l.Pairwise R) :
    ∀ ⦃a⦄, a ∈ l → ∀ ⦃b⦄, b ∈ l → a ≠ b → R a b := by
  apply Pairwise.forall_of_forall
  · exact fun a b h hne => hR (h hne.symm)
  · exact fun _ _ hx => (hx rfl).elim
  · 

Proof state:
case H₂
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l : List α
hR : Symmetric R
hl : Pairwise R l
⊢ Pairwise (fun x y => x ≠ y → R x y) l

Next tactic:
exact hl.imp (@fun a b h _ => by exact h)
theorem Pairwise.forall (hR : Symmetric R) (hl : l.Pairwise R) :
    ∀ ⦃a⦄, a ∈ l → ∀ ⦃b⦄, b ∈ l → a ≠ b → R a b := by
  apply Pairwise.forall_of_forall
  · exact fun a b h hne => hR (h hne.symm)
  · exact fun _ _ hx => (hx rfl).elim
  · exact hl.imp (@fun a b h _ => by 

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l : List α
hR : Symmetric R
hl : Pairwise R l
a b : α
h : R a b
x✝ : a ≠ b
⊢ R a b

Next tactic:
exact h
@[deprecated] theorem pairwise_map' (f : β → α) :
    ∀ {l : List β}, Pairwise R (map f l) ↔ Pairwise (fun a b : β => R (f a) (f b)) l
  | [] => by 

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l : List α
f : β → α
⊢ Pairwise R (map f []) ↔ Pairwise (fun a b => R (f a) (f b)) []

Next tactic:
simp only [map, Pairwise.nil]
@[deprecated] theorem pairwise_map' (f : β → α) :
    ∀ {l : List β}, Pairwise R (map f l) ↔ Pairwise (fun a b : β => R (f a) (f b)) l
  | [] => by simp only [map, Pairwise.nil]
  | b :: l => by
    

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l✝ : List α
f : β → α
b : β
l : List β
⊢ Pairwise R (map f (b :: l)) ↔ Pairwise (fun a b => R (f a) (f b)) (b :: l)

Next tactic:
simp only [map, pairwise_cons, mem_map, forall_exists_index, and_imp,
      forall_apply_eq_imp_iff₂, pairwise_map]
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) :
    Pairwise R (l.pmap f h) ↔
      Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
  

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l✝ : List α
p : β → Prop
f : (b : β) → p b → α
l : List β
h : ∀ (x : β), x ∈ l → p x
⊢ Pairwise R (pmap f l h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l

Next tactic:
induction' l with a l ihl
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) :
    Pairwise R (l.pmap f h) ↔
      Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
  induction' l with a l ihl
  · 

Proof state:
case nil
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l : List α
p : β → Prop
f : (b : β) → p b → α
h : ∀ (x : β), x ∈ [] → p x
⊢ Pairwise R (pmap f [] h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) []

Next tactic:
simp
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) :
    Pairwise R (l.pmap f h) ↔
      Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
  induction' l with a l ihl
  · simp
  

Proof state:
case cons
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ : List α
p : β → Prop
f : (b : β) → p b → α
a : β
l : List β
ihl :
  ∀ (h : ∀ (x : β), x ∈ l → p x),
    Pairwise R (pmap f l h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l
h : ∀ (x : β), x ∈ a :: l → p x
⊢ Pairwise R (pmap f (a :: l) h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) (a :: l)

Next tactic:
obtain ⟨_, hl⟩ : p a ∧ ∀ b, b ∈ l → p b := by simpa using h
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) :
    Pairwise R (l.pmap f h) ↔
      Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
  induction' l with a l ihl
  · simp
  obtain ⟨_, hl⟩ : p a ∧ ∀ b, b ∈ l → p b := by 

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ : List α
p : β → Prop
f : (b : β) → p b → α
a : β
l : List β
ihl :
  ∀ (h : ∀ (x : β), x ∈ l → p x),
    Pairwise R (pmap f l h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l
h : ∀ (x : β), x ∈ a :: l → p x
⊢ p a ∧ ∀ (b : β), b ∈ l → p b

Next tactic:
simpa using h
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) :
    Pairwise R (l.pmap f h) ↔
      Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
  induction' l with a l ihl
  · simp
  obtain ⟨_, hl⟩ : p a ∧ ∀ b, b ∈ l → p b := by simpa using h
  

Proof state:
case cons.intro
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ : List α
p : β → Prop
f : (b : β) → p b → α
a : β
l : List β
ihl :
  ∀ (h : ∀ (x : β), x ∈ l → p x),
    Pairwise R (pmap f l h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l
h : ∀ (x : β), x ∈ a :: l → p x
left✝ : p a
hl : ∀ (b : β), b ∈ l → p b
⊢ Pairwise R (pmap f (a :: l) h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) (a :: l)

Next tactic:
simp only [ihl hl, pairwise_cons, bex_imp, pmap, and_congr_left_iff, mem_pmap]
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) :
    Pairwise R (l.pmap f h) ↔
      Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
  induction' l with a l ihl
  · simp
  obtain ⟨_, hl⟩ : p a ∧ ∀ b, b ∈ l → p b := by simpa using h
  simp only [ihl hl, pairwise_cons, bex_imp, pmap, and_congr_left_iff, mem_pmap]
  

Proof state:
case cons.intro
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ : List α
p : β → Prop
f : (b : β) → p b → α
a : β
l : List β
ihl :
  ∀ (h : ∀ (x : β), x ∈ l → p x),
    Pairwise R (pmap f l h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l
h : ∀ (x : β), x ∈ a :: l → p x
left✝ : p a
hl : ∀ (b : β), b ∈ l → p b
⊢ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l →
    ((∀ (a' : α) (x : β) (h_1 : x ∈ l), f x (_ : p x) = a' → R (f a (_ : p a)) a') ↔
      ∀ (a' : β), a' ∈ l → ∀ (h₁ : p a) (h₂ : p a'), R (f a h₁) (f a' h₂))

Next tactic:
refine' fun _ => ⟨fun H b hb _ hpb => H _ _ hb rfl, _⟩
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) :
    Pairwise R (l.pmap f h) ↔
      Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
  induction' l with a l ihl
  · simp
  obtain ⟨_, hl⟩ : p a ∧ ∀ b, b ∈ l → p b := by simpa using h
  simp only [ihl hl, pairwise_cons, bex_imp, pmap, and_congr_left_iff, mem_pmap]
  refine' fun _ => ⟨fun H b hb _ hpb => H _ _ hb rfl, _⟩
  

Proof state:
case cons.intro
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ : List α
p : β → Prop
f : (b : β) → p b → α
a : β
l : List β
ihl :
  ∀ (h : ∀ (x : β), x ∈ l → p x),
    Pairwise R (pmap f l h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l
h : ∀ (x : β), x ∈ a :: l → p x
left✝ : p a
hl : ∀ (b : β), b ∈ l → p b
x✝ : Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l
⊢ (∀ (a' : β), a' ∈ l → ∀ (h₁ : p a) (h₂ : p a'), R (f a h₁) (f a' h₂)) →
    ∀ (a' : α) (x : β) (h_1 : x ∈ l), f x (_ : p x) = a' → R (f a (_ : p a)) a'

Next tactic:
rintro H _ b hb rfl
theorem pairwise_pmap {p : β → Prop} {f : ∀ b, p b → α} {l : List β} (h : ∀ x ∈ l, p x) :
    Pairwise R (l.pmap f h) ↔
      Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l := by
  induction' l with a l ihl
  · simp
  obtain ⟨_, hl⟩ : p a ∧ ∀ b, b ∈ l → p b := by simpa using h
  simp only [ihl hl, pairwise_cons, bex_imp, pmap, and_congr_left_iff, mem_pmap]
  refine' fun _ => ⟨fun H b hb _ hpb => H _ _ hb rfl, _⟩
  rintro H _ b hb rfl
  

Proof state:
case cons.intro
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ : List α
p : β → Prop
f : (b : β) → p b → α
a : β
l : List β
ihl :
  ∀ (h : ∀ (x : β), x ∈ l → p x),
    Pairwise R (pmap f l h) ↔ Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l
h : ∀ (x : β), x ∈ a :: l → p x
left✝ : p a
hl : ∀ (b : β), b ∈ l → p b
x✝ : Pairwise (fun b₁ b₂ => ∀ (h₁ : p b₁) (h₂ : p b₂), R (f b₁ h₁) (f b₂ h₂)) l
H : ∀ (a' : β), a' ∈ l → ∀ (h₁ : p a) (h₂ : p a'), R (f a h₁) (f a' h₂)
b : β
hb : b ∈ l
⊢ R (f a (_ : p a)) (f b (_ : p b))

Next tactic:
exact H b hb _ _
theorem Pairwise.pmap {l : List α} (hl : Pairwise R l) {p : α → Prop} {f : ∀ a, p a → β}
    (h : ∀ x ∈ l, p x) {S : β → β → Prop}
    (hS : ∀ ⦃x⦄ (hx : p x) ⦃y⦄ (hy : p y), R x y → S (f x hx) (f y hy)) :
    Pairwise S (l.pmap f h) := by
  

Proof state:
α : Type u_1
β : Type u_2
R S✝ T : α → α → Prop
a : α
l✝ l : List α
hl : Pairwise R l
p : α → Prop
f : (a : α) → p a → β
h : ∀ (x : α), x ∈ l → p x
S : β → β → Prop
hS : ∀ ⦃x : α⦄ (hx : p x) ⦃y : α⦄ (hy : p y), R x y → S (f x hx) (f y hy)
⊢ Pairwise S (List.pmap f l h)

Next tactic:
refine' (pairwise_pmap h).2 (Pairwise.imp_of_mem _ hl)
theorem Pairwise.pmap {l : List α} (hl : Pairwise R l) {p : α → Prop} {f : ∀ a, p a → β}
    (h : ∀ x ∈ l, p x) {S : β → β → Prop}
    (hS : ∀ ⦃x⦄ (hx : p x) ⦃y⦄ (hy : p y), R x y → S (f x hx) (f y hy)) :
    Pairwise S (l.pmap f h) := by
  refine' (pairwise_pmap h).2 (Pairwise.imp_of_mem _ hl)
  

Proof state:
α : Type u_1
β : Type u_2
R S✝ T : α → α → Prop
a : α
l✝ l : List α
hl : Pairwise R l
p : α → Prop
f : (a : α) → p a → β
h : ∀ (x : α), x ∈ l → p x
S : β → β → Prop
hS : ∀ ⦃x : α⦄ (hx : p x) ⦃y : α⦄ (hy : p y), R x y → S (f x hx) (f y hy)
⊢ ∀ {a b : α}, a ∈ l → b ∈ l → R a b → ∀ (h₁ : p a) (h₂ : p b), S (f a h₁) (f b h₂)

Next tactic:
intros
theorem Pairwise.pmap {l : List α} (hl : Pairwise R l) {p : α → Prop} {f : ∀ a, p a → β}
    (h : ∀ x ∈ l, p x) {S : β → β → Prop}
    (hS : ∀ ⦃x⦄ (hx : p x) ⦃y⦄ (hy : p y), R x y → S (f x hx) (f y hy)) :
    Pairwise S (l.pmap f h) := by
  refine' (pairwise_pmap h).2 (Pairwise.imp_of_mem _ hl)
  intros; 

Proof state:
α : Type u_1
β : Type u_2
R S✝ T : α → α → Prop
a : α
l✝ l : List α
hl : Pairwise R l
p : α → Prop
f : (a : α) → p a → β
h : ∀ (x : α), x ∈ l → p x
S : β → β → Prop
hS : ∀ ⦃x : α⦄ (hx : p x) ⦃y : α⦄ (hy : p y), R x y → S (f x hx) (f y hy)
a✝³ b✝ : α
a✝² : a✝³ ∈ l
a✝¹ : b✝ ∈ l
a✝ : R a✝³ b✝
h₁✝ : p a✝³
h₂✝ : p b✝
⊢ S (f a✝³ h₁✝) (f b✝ h₂✝)

Next tactic:
apply hS
theorem Pairwise.pmap {l : List α} (hl : Pairwise R l) {p : α → Prop} {f : ∀ a, p a → β}
    (h : ∀ x ∈ l, p x) {S : β → β → Prop}
    (hS : ∀ ⦃x⦄ (hx : p x) ⦃y⦄ (hy : p y), R x y → S (f x hx) (f y hy)) :
    Pairwise S (l.pmap f h) := by
  refine' (pairwise_pmap h).2 (Pairwise.imp_of_mem _ hl)
  intros; apply hS; 

Proof state:
case a
α : Type u_1
β : Type u_2
R S✝ T : α → α → Prop
a : α
l✝ l : List α
hl : Pairwise R l
p : α → Prop
f : (a : α) → p a → β
h : ∀ (x : α), x ∈ l → p x
S : β → β → Prop
hS : ∀ ⦃x : α⦄ (hx : p x) ⦃y : α⦄ (hy : p y), R x y → S (f x hx) (f y hy)
a✝³ b✝ : α
a✝² : a✝³ ∈ l
a✝¹ : b✝ ∈ l
a✝ : R a✝³ b✝
h₁✝ : p a✝³
h₂✝ : p b✝
⊢ R a✝³ b✝

Next tactic:
assumption
theorem pairwise_of_forall_mem_list {l : List α} {r : α → α → Prop} (h : ∀ a ∈ l, ∀ b ∈ l, r a b) :
    l.Pairwise r := by
  

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l✝ l : List α
r : α → α → Prop
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → r a b
⊢ Pairwise r l

Next tactic:
apply pairwise_iff_forall_sublist.mpr
theorem pairwise_of_forall_mem_list {l : List α} {r : α → α → Prop} (h : ∀ a ∈ l, ∀ b ∈ l, r a b) :
    l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l✝ l : List α
r : α → α → Prop
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → r a b
⊢ ∀ {a b : α}, [a, b] <+ l → r a b

Next tactic:
intro a b hab
theorem pairwise_of_forall_mem_list {l : List α} {r : α → α → Prop} (h : ∀ a ∈ l, ∀ b ∈ l, r a b) :
    l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → r a b
a b : α
hab : [a, b] <+ l
⊢ r a b

Next tactic:
apply h
theorem pairwise_of_forall_mem_list {l : List α} {r : α → α → Prop} (h : ∀ a ∈ l, ∀ b ∈ l, r a b) :
    l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  apply h <;> (

Proof state:
case a
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → r a b
a b : α
hab : [a, b] <+ l
⊢ a ∈ l

Next tactic:
apply hab.subset
theorem pairwise_of_forall_mem_list {l : List α} {r : α → α → Prop} (h : ∀ a ∈ l, ∀ b ∈ l, r a b) :
    l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  apply h <;> (apply hab.subset; 

Proof state:
case a.a
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → r a b
a b : α
hab : [a, b] <+ l
⊢ a ∈ [a, b]

Next tactic:
simp
theorem pairwise_of_forall_mem_list {l : List α} {r : α → α → Prop} (h : ∀ a ∈ l, ∀ b ∈ l, r a b) :
    l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  apply h <;> (

Proof state:
case a
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → r a b
a b : α
hab : [a, b] <+ l
⊢ b ∈ l

Next tactic:
apply hab.subset
theorem pairwise_of_forall_mem_list {l : List α} {r : α → α → Prop} (h : ∀ a ∈ l, ∀ b ∈ l, r a b) :
    l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  apply h <;> (apply hab.subset; 

Proof state:
case a.a
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → r a b
a b : α
hab : [a, b] <+ l
⊢ b ∈ [a, b]

Next tactic:
simp
theorem pairwise_of_reflexive_of_forall_ne {l : List α} {r : α → α → Prop} (hr : Reflexive r)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l✝ l : List α
r : α → α → Prop
hr : Reflexive r
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → a ≠ b → r a b
⊢ Pairwise r l

Next tactic:
apply pairwise_iff_forall_sublist.mpr
theorem pairwise_of_reflexive_of_forall_ne {l : List α} {r : α → α → Prop} (hr : Reflexive r)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a : α
l✝ l : List α
r : α → α → Prop
hr : Reflexive r
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → a ≠ b → r a b
⊢ ∀ {a b : α}, [a, b] <+ l → r a b

Next tactic:
intro a b hab
theorem pairwise_of_reflexive_of_forall_ne {l : List α} {r : α → α → Prop} (hr : Reflexive r)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
hr : Reflexive r
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → a ≠ b → r a b
a b : α
hab : [a, b] <+ l
⊢ r a b

Next tactic:
if heq : a = b then
    cases heq; apply hr
  else
    apply h <;> try (apply hab.subset; simp)
    exact heq
theorem pairwise_of_reflexive_of_forall_ne {l : List α} {r : α → α → Prop} (hr : Reflexive r)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
hr : Reflexive r
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : a = b
⊢ r a b

Next tactic:
cases heq
theorem pairwise_of_reflexive_of_forall_ne {l : List α} {r : α → α → Prop} (hr : Reflexive r)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; 

Proof state:
case refl
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
hr : Reflexive r
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → a ≠ b → r a b
a : α
hab : [a, a] <+ l
⊢ r a a

Next tactic:
apply hr
theorem pairwise_of_reflexive_of_forall_ne {l : List α} {r : α → α → Prop} (hr : Reflexive r)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; apply hr
  else
    

Proof state:
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
hr : Reflexive r
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ r a b

Next tactic:
apply h
theorem pairwise_of_reflexive_of_forall_ne {l : List α} {r : α → α → Prop} (hr : Reflexive r)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; apply hr
  else
    apply h <;> 

Proof state:
case a
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
hr : Reflexive r
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ a ∈ l

Next tactic:
try (apply hab.subset; simp)
theorem pairwise_of_reflexive_of_forall_ne {l : List α} {r : α → α → Prop} (hr : Reflexive r)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; apply hr
  else
    apply h <;> try (

Proof state:
case a
α : Type u_1
β : Type u_2
R S T : α → α → Prop
a✝ : α
l✝ l : List α
r : α → α → Prop
hr : Reflexive r
h : ∀ (a : α), a ∈ l → ∀ (b : α), b ∈ l → a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ a ∈ l

Next tactic:
apply hab.subset