File: .lake/packages/batteries/Batteries/Data/Sum/Basic.lean

full_name: Sum.«instBEq_.lake»
code: BEq
goal: {α : Type u_1} → {β : Type u_2} → [inst : BEq α] → [inst : BEq β] → BEq (α ⊕ β)

full_name: Sum.isLeft
code: /-- Check if a sum is `inl`. -/
def isLeft : α ⊕ β → Bool
  
goal: α ⊕ β → Bool

full_name: Sum.isRight
code: /-- Check if a sum is `inr`. -/
def isRight : α ⊕ β → Bool
  
goal: α ⊕ β → Bool

full_name: Sum.getLeft
code: /-- Retrieve the contents from a sum known to be `inl`.-/
def getLeft : (ab : α ⊕ β) → ab.isLeft → α
  
goal: ab.isLeft = true → α

full_name: Sum.getRight
code: /-- Retrieve the contents from a sum known to be `inr`.-/
def getRight : (ab : α ⊕ β) → ab.isRight → β
  
goal: ab.isRight = true → β

full_name: Sum.isLeft_inl
code: @[simp] theorem isLeft_inl : (inl x : α ⊕ β).isLeft = true 
goal: (Sum.inl x).isLeft = true

full_name: Sum.isLeft_inr
code: @[simp] theorem isLeft_inr : (inr x : α ⊕ β).isLeft = false 
goal: (Sum.inr x).isLeft = false

full_name: Sum.isRight_inl
code: @[simp] theorem isRight_inl : (inl x : α ⊕ β).isRight = false 
goal: (Sum.inl x).isRight = false

full_name: Sum.isRight_inr
code: @[simp] theorem isRight_inr : (inr x : α ⊕ β).isRight = true 
goal: (Sum.inr x).isRight = true

full_name: Sum.getLeft_inl
code: @[simp] theorem getLeft_inl (h : (inl x : α ⊕ β).isLeft) : (inl x).getLeft h = x 
goal: (Sum.inl x).getLeft h = x

full_name: Sum.getRight_inr
code: @[simp] theorem getRight_inr (h : (inr x : α ⊕ β).isRight) : (inr x).getRight h = x 
goal: (Sum.inr x).getRight h = x

full_name: Sum.getLeft?_inl
code: @[simp] theorem getLeft?_inl : (inl x : α ⊕ β).getLeft? = some x 
goal: (Sum.inl x).getLeft? = some x

full_name: Sum.getLeft?_inr
code: @[simp] theorem getLeft?_inr : (inr x : α ⊕ β).getLeft? = none 
goal: (Sum.inr x).getLeft? = none

full_name: Sum.getRight?_inl
code: @[simp] theorem getRight?_inl : (inl x : α ⊕ β).getRight? = none 
goal: (Sum.inl x).getRight? = none

full_name: Sum.getRight?_inr
code: @[simp] theorem getRight?_inr : (inr x : α ⊕ β).getRight? = some x 
goal: (Sum.inr x).getRight? = some x

full_name: Sum.elim
code: /-- Define a function on `α ⊕ β` by giving separate definitions on `α` and `β`. -/
protected def elim {α β γ} (f : α → γ) (g : β → γ) : α ⊕ β → γ 
goal: α ⊕ β → γ

full_name: Sum.elim_inl
code: @[simp] theorem elim_inl (f : α → γ) (g : β → γ) (x : α) :
    Sum.elim f g (inl x) = f x 
goal: Sum.elim f g (Sum.inl x) = f x

full_name: Sum.elim_inr
code: @[simp] theorem elim_inr (f : α → γ) (g : β → γ) (x : β) :
    Sum.elim f g (inr x) = g x 
goal: Sum.elim f g (Sum.inr x) = g x

full_name: Sum.map
code: /-- Map `α ⊕ β` to `α' ⊕ β'` sending `α` to `α'` and `β` to `β'`. -/
protected def map (f : α → α') (g : β → β') : α ⊕ β → α' ⊕ β' 
goal: α ⊕ β → α' ⊕ β'

full_name: Sum.map_inl
code: @[simp] theorem map_inl (f : α → α') (g : β → β') (x : α) : (inl x).map f g = inl (f x) 
goal: Sum.map f g (Sum.inl x) = Sum.inl (f x)

full_name: Sum.map_inr
code: @[simp] theorem map_inr (f : α → α') (g : β → β') (x : β) : (inr x).map f g = inr (g x) 
goal: Sum.map f g (Sum.inr x) = Sum.inr (g x)

full_name: Sum.swap
code: /-- Swap the factors of a sum type -/
def swap : α ⊕ β → β ⊕ α 
goal: α ⊕ β → β ⊕ α

full_name: Sum.swap_inl
code: @[simp] theorem swap_inl : swap (inl x : α ⊕ β) = inr x 
goal: (Sum.inl x).swap = Sum.inr x

full_name: Sum.swap_inr
code: @[simp] theorem swap_inr : swap (inr x : α ⊕ β) = inl x 
goal: (Sum.inr x).swap = Sum.inl x

full_name: Sum.LiftRel.inr
code: /-- Lifts pointwise two relations between `α` and `γ` and between `β` and `δ` to a relation between
`α ⊕ β` and `γ ⊕ δ`. -/
inductive LiftRel (r : α → γ → Prop) (s : β → δ → Prop) : α ⊕ β → γ ⊕ δ → Prop
  /-- `inl a` and `inl c` are related via `LiftRel r s` if `a` and `c` are related via `r`. -/
  | protected inl {a c} : r a c → LiftRel r s (inl a) (inl c)
  /-- `inr b` and `inr d` are related via `LiftRel r s` if `b` and `d` are related via `s`. -/
  | protected inr {b d} : s b d → LiftRel r s (inr b) (inr d)
goal: s b d → Sum.LiftRel r s (Sum.inr b) (Sum.inr d)

full_name: Sum.LiftRel
code: /-- Lifts pointwise two relations between `α` and `γ` and between `β` and `δ` to a relation between
`α ⊕ β` and `γ ⊕ δ`. -/
inductive LiftRel (r : α → γ → Prop) (s : β → δ → Prop) : α ⊕ β → γ ⊕ δ → Prop
  /-- `inl a` and `inl c` are related via `LiftRel r s` if `a` and `c` are related via `r`. -/
  | protected inl {a c} : r a c → LiftRel r s (inl a) (inl c)
  /-- `inr b` and `inr d` are related via `LiftRel r s` if `b` and `d` are related via `s`. -/
  | protected inr {b d} : s b d → LiftRel r s (inr b) (inr d)
goal: α ⊕ β → γ ⊕ δ → Prop

full_name: Sum.LiftRel.inl
code: /-- Lifts pointwise two relations between `α` and `γ` and between `β` and `δ` to a relation between
`α ⊕ β` and `γ ⊕ δ`. -/
inductive LiftRel (r : α → γ → Prop) (s : β → δ → Prop) : α ⊕ β → γ ⊕ δ → Prop
  /-- `inl a` and `inl c` are related via `LiftRel r s` if `a` and `c` are related via `r`. -/
  | protected inl {a c} : r a c → LiftRel r s (inl a) (inl c)
  /-- `inr b` and `inr d` are related via `LiftRel r s` if `b` and `d` are related via `s`. -/
  | protected inr {b d} : s b d → LiftRel r s (inr b) (inr d)
goal: r a c → Sum.LiftRel r s (Sum.inl a) (Sum.inl c)

full_name: Sum.liftRel_inl_inl
code: @[simp] theorem liftRel_inl_inl : LiftRel r s (inl a) (inl c) ↔ r a c 
goal: ∀ {α : Type u_1} {γ : Type u_2} {r : α → γ → Prop} {β : Type u_3} {δ : Type u_4} {s : β → δ → Prop} {a : α} {c : γ},
  Sum.LiftRel r s (Sum.inl a) (Sum.inl c) ↔ r a c

full_name: Sum.not_liftRel_inl_inr
code: @[simp] theorem not_liftRel_inl_inr : ¬LiftRel r s (inl a) (inr d) 
goal: ∀ {α : Type u_1} {γ : Type u_2} {r : α → γ → Prop} {β : Type u_3} {δ : Type u_4} {s : β → δ → Prop} {a : α} {d : δ},
  ¬Sum.LiftRel r s (Sum.inl a) (Sum.inr d)

full_name: Sum.not_liftRel_inr_inl
code: @[simp] theorem not_liftRel_inr_inl : ¬LiftRel r s (inr b) (inl c) 
goal: ∀ {α : Type u_1} {γ : Type u_2} {r : α → γ → Prop} {β : Type u_3} {δ : Type u_4} {s : β → δ → Prop} {b : β} {c : γ},
  ¬Sum.LiftRel r s (Sum.inr b) (Sum.inl c)

full_name: Sum.liftRel_inr_inr
code: @[simp] theorem liftRel_inr_inr : LiftRel r s (inr b) (inr d) ↔ s b d 
goal: ∀ {α : Type u_1} {γ : Type u_2} {r : α → γ → Prop} {β : Type u_3} {δ : Type u_4} {s : β → δ → Prop} {b : β} {d : δ},
  Sum.LiftRel r s (Sum.inr b) (Sum.inr d) ↔ s b d

full_name: Sum.instDecidableLiftRel
code: instance {r : α → γ → Prop} {s : β → δ → Prop}
    [∀ a c, Decidable (r a c)] [∀ b d, Decidable (s b d)] :
    ∀ (ab : α ⊕ β) (cd : γ ⊕ δ), Decidable (LiftRel r s ab cd)
  
goal: Decidable (Sum.LiftRel r s ab cd)

full_name: Sum.Lex.inr
code: /-- Lexicographic order for sum. Sort all the `inl a` before the `inr b`, otherwise use the
respective order on `α` or `β`. -/
inductive Lex (r : α → α → Prop) (s : β → β → Prop) : α ⊕ β → α ⊕ β → Prop
  /-- `inl a₁` and `inl a₂` are related via `Lex r s` if `a₁` and `a₂` are related via `r`. -/
  | protected inl {a₁ a₂} (h : r a₁ a₂) : Lex r s (inl a₁) (inl a₂)
  /-- `inr b₁` and `inr b₂` are related via `Lex r s` if `b₁` and `b₂` are related via `s`. -/
  | protected inr {b₁ b₂} (h : s b₁ b₂) : Lex r s (inr b₁) (inr b₂)
  /-- `inl a` and `inr b` are always related via `Lex r s`. -/
  | sep (a b) : Lex r s (inl a) (inr b)
goal: Sum.Lex r s (Sum.inr b₁) (Sum.inr b₂)

full_name: Sum.Lex
code: /-- Lexicographic order for sum. Sort all the `inl a` before the `inr b`, otherwise use the
respective order on `α` or `β`. -/
inductive Lex (r : α → α → Prop) (s : β → β → Prop) : α ⊕ β → α ⊕ β → Prop
  /-- `inl a₁` and `inl a₂` are related via `Lex r s` if `a₁` and `a₂` are related via `r`. -/
  | protected inl {a₁ a₂} (h : r a₁ a₂) : Lex r s (inl a₁) (inl a₂)
  /-- `inr b₁` and `inr b₂` are related via `Lex r s` if `b₁` and `b₂` are related via `s`. -/
  | protected inr {b₁ b₂} (h : s b₁ b₂) : Lex r s (inr b₁) (inr b₂)
  /-- `inl a` and `inr b` are always related via `Lex r s`. -/
  | sep (a b) : Lex r s (inl a) (inr b)
goal: α ⊕ β → α ⊕ β → Prop

full_name: Sum.Lex.sep
code: /-- Lexicographic order for sum. Sort all the `inl a` before the `inr b`, otherwise use the
respective order on `α` or `β`. -/
inductive Lex (r : α → α → Prop) (s : β → β → Prop) : α ⊕ β → α ⊕ β → Prop
  /-- `inl a₁` and `inl a₂` are related via `Lex r s` if `a₁` and `a₂` are related via `r`. -/
  | protected inl {a₁ a₂} (h : r a₁ a₂) : Lex r s (inl a₁) (inl a₂)
  /-- `inr b₁` and `inr b₂` are related via `Lex r s` if `b₁` and `b₂` are related via `s`. -/
  | protected inr {b₁ b₂} (h : s b₁ b₂) : Lex r s (inr b₁) (inr b₂)
  /-- `inl a` and `inr b` are always related via `Lex r s`. -/
  | sep (a b) : Lex r s (inl a) (inr b)
goal: Sum.Lex r s (Sum.inl a) (Sum.inr b)

full_name: Sum.Lex.inl
code: /-- Lexicographic order for sum. Sort all the `inl a` before the `inr b`, otherwise use the
respective order on `α` or `β`. -/
inductive Lex (r : α → α → Prop) (s : β → β → Prop) : α ⊕ β → α ⊕ β → Prop
  /-- `inl a₁` and `inl a₂` are related via `Lex r s` if `a₁` and `a₂` are related via `r`. -/
  | protected inl {a₁ a₂} (h : r a₁ a₂) : Lex r s (inl a₁) (inl a₂)
  /-- `inr b₁` and `inr b₂` are related via `Lex r s` if `b₁` and `b₂` are related via `s`. -/
  | protected inr {b₁ b₂} (h : s b₁ b₂) : Lex r s (inr b₁) (inr b₂)
  /-- `inl a` and `inr b` are always related via `Lex r s`. -/
  | sep (a b) : Lex r s (inl a) (inr b)
goal: Sum.Lex r s (Sum.inl a₁) (Sum.inl a₂)

full_name: Sum.lex_inl_inl
code: @[simp] theorem lex_inl_inl : Lex r s (inl a₁) (inl a₂) ↔ r a₁ a₂ 
goal: ∀ {α : Type u_1} {r : α → α → Prop} {β : Type u_2} {s : β → β → Prop} {a₁ a₂ : α},
  Sum.Lex r s (Sum.inl a₁) (Sum.inl a₂) ↔ r a₁ a₂

full_name: Sum.lex_inr_inr
code: @[simp] theorem lex_inr_inr : Lex r s (inr b₁) (inr b₂) ↔ s b₁ b₂ 
goal: ∀ {α : Type u_1} {r : α → α → Prop} {β : Type u_2} {s : β → β → Prop} {b₁ b₂ : β},
  Sum.Lex r s (Sum.inr b₁) (Sum.inr b₂) ↔ s b₁ b₂

full_name: Sum.lex_inr_inl
code: @[simp] theorem lex_inr_inl : ¬Lex r s (inr b) (inl a) 
goal: ∀ {α : Type u_1} {r : α → α → Prop} {β : Type u_2} {s : β → β → Prop} {b : β} {a : α},
  ¬Sum.Lex r s (Sum.inr b) (Sum.inl a)

full_name: Sum.instDecidableRelSumLex
code: instance instDecidableRelSumLex [DecidableRel r] [DecidableRel s] : DecidableRel (Lex r s)
  
goal: {α : Type u_1} →
  {r : α → α → Prop} →
    {α_1 : Type u_2} →
      {s : α_1 → α_1 → Prop} → [inst : DecidableRel r] → [inst : DecidableRel s] → DecidableRel (Sum.Lex r s)