File: Mathlib/Logic/Hydra.lean

full_name: Relation.CutExpand
code: /-- The relation that specifies valid moves in our hydra game. `CutExpand r s' s`
  means that `s'` is obtained by removing one head `a ∈ s` and adding back an arbitrary
  multiset `t` of heads such that all `a' ∈ t` satisfy `r a' a`.

  This is most directly translated into `s' = s.erase a + t`, but `Multiset.erase` requires
  `DecidableEq α`, so we use the equivalent condition `s' + {a} = s + t` instead, which
  is also easier to verify for explicit multisets `s'`, `s` and `t`.

  We also don't include the condition `a ∈ s` because `s' + {a} = s + t` already
  guarantees `a ∈ s + t`, and if `r` is irreflexive then `a ∉ t`, which is the
  case when `r` is well-founded, the case we are primarily interested in.

  The lemma `Relation.cutExpand_iff` below converts between this convenient definition
  and the direct translation when `r` is irreflexive. -/
def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop 
goal: Prop

full_name: Relation.cutExpand_le_invImage_lex
code: theorem cutExpand_le_invImage_lex [DecidableEq α] [IsIrrefl α r] :
    CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp 
goal: Relation.CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ fun x x_1 => x ≠ x_1) fun x x_1 => x < x_1) ⇑Multiset.toFinsupp

full_name: Relation.cutExpand_singleton
code: theorem cutExpand_singleton {s x} (h : ∀ x' ∈ s, r x' x) : CutExpand r s {x} 
goal: Relation.CutExpand r s {x}

full_name: Relation.cutExpand_singleton_singleton
code: theorem cutExpand_singleton_singleton {x' x} (h : r x' x) : CutExpand r {x'} {x} 
goal: Relation.CutExpand r {x'} {x}

full_name: Relation.cutExpand_add_left
code: theorem cutExpand_add_left {t u} (s) : CutExpand r (s + t) (s + u) ↔ CutExpand r t u 
goal: Relation.CutExpand r (s + t) (s + u) ↔ Relation.CutExpand r t u

full_name: Relation.cutExpand_add_right
code: lemma cutExpand_add_right {s' s} (t) : CutExpand r (s' + t) (s + t) ↔ CutExpand r s' s 
goal: Relation.CutExpand r (s' + t) (s + t) ↔ Relation.CutExpand r s' s

full_name: Relation.cutExpand_iff
code: theorem cutExpand_iff [DecidableEq α] [IsIrrefl α r] {s' s : Multiset α} :
    CutExpand r s' s ↔
      ∃ (t : Multiset α) (a : α), (∀ a' ∈ t, r a' a) ∧ a ∈ s ∧ s' = s.erase a + t 
goal: Relation.CutExpand r s' s ↔ ∃ t a, (∀ a' ∈ t, r a' a) ∧ a ∈ s ∧ s' = s.erase a + t

full_name: Relation.not_cutExpand_zero
code: theorem not_cutExpand_zero [IsIrrefl α r] (s) : ¬CutExpand r s 0 
goal: ¬Relation.CutExpand r s 0

full_name: Relation.cutExpand_zero
code: lemma cutExpand_zero {x} : CutExpand r 0 {x} 
goal: Relation.CutExpand r 0 {x}

full_name: Relation.cutExpand_fibration
code: /-- For any relation `r` on `α`, multiset addition `Multiset α × Multiset α → Multiset α` is a
  fibration between the game sum of `CutExpand r` with itself and `CutExpand r` itself. -/
theorem cutExpand_fibration (r : α → α → Prop) :
    Fibration (GameAdd (CutExpand r) (CutExpand r)) (CutExpand r) fun s ↦ s.1 + s.2 
goal: Relation.Fibration (Prod.GameAdd (Relation.CutExpand r) (Relation.CutExpand r)) (Relation.CutExpand r) fun s =>
  s.1 + s.2

full_name: Relation.cutExpand_closed
code: /-- `CutExpand` preserves leftward-closedness under a relation. -/
lemma cutExpand_closed [IsIrrefl α r] (p : α → Prop)
    (h : ∀ {a' a}, r a' a → p a → p a') :
    ∀ {s' s}, CutExpand r s' s → (∀ a ∈ s, p a) → ∀ a ∈ s', p a 
goal: Relation.CutExpand r s' s → (∀ a ∈ s, p a) → ∀ a ∈ s', p a

full_name: Relation.cutExpand_double
code: lemma cutExpand_double {a a₁ a₂} (h₁ : r a₁ a) (h₂ : r a₂ a) : CutExpand r {a₁, a₂} {a} 
goal: Relation.CutExpand r {a₁, a₂} {a}

full_name: Relation.cutExpand_pair_left
code: lemma cutExpand_pair_left {a' a b} (hr : r a' a) : CutExpand r {a', b} {a, b} 
goal: Relation.CutExpand r {a', b} {a, b}

full_name: Relation.cutExpand_pair_right
code: lemma cutExpand_pair_right {a b' b} (hr : r b' b) : CutExpand r {a, b'} {a, b} 
goal: Relation.CutExpand r {a, b'} {a, b}

full_name: Relation.cutExpand_double_left
code: lemma cutExpand_double_left {a a₁ a₂ b} (h₁ : r a₁ a) (h₂ : r a₂ a) :
    CutExpand r {a₁, a₂, b} {a, b} 
goal: Relation.CutExpand r {a₁, a₂, b} {a, b}

full_name: Relation.acc_of_singleton
code: /-- A multiset is accessible under `CutExpand` if all its singleton subsets are,
  assuming `r` is irreflexive. -/
theorem acc_of_singleton [IsIrrefl α r] {s : Multiset α} (hs : ∀ a ∈ s, Acc (CutExpand r) {a}) :
    Acc (CutExpand r) s 
goal: Acc (Relation.CutExpand r) s

full_name: Acc.cutExpand
code: /-- A singleton `{a}` is accessible under `CutExpand r` if `a` is accessible under `r`,
  assuming `r` is irreflexive. -/
theorem _root_.Acc.cutExpand [IsIrrefl α r] {a : α} (hacc : Acc r a) : Acc (CutExpand r) {a} 
goal: Acc (Relation.CutExpand r) {a}

full_name: WellFounded.cutExpand
code: /-- `CutExpand r` is well-founded when `r` is. -/
theorem _root_.WellFounded.cutExpand (hr : WellFounded r) : WellFounded (CutExpand r) 
goal: WellFounded (Relation.CutExpand r)