The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V01. The language of Mathlib

Mathlib.Data.Part

198 declarations. Mathlib docs · Source

Partial values of a type

This file defines Part α, the partial values of a type. o : Part α carries a proposition o.Dom, its domain, along with a function get : o.Dom → α, its value. The rule is then that every partial value has a value but, to access it, you need to provide a proof of the domain. Part α behaves the same as Option α except that o : Option α is decidably none or some a for some a : α, while the domain of o : Part α doesn't have to be decidable. That means you can translate back and forth between a partial value with a decidable domain and an option, and Option α and Part α are classically equivalent. In general, Part α is bigger than Option α.

Main declarations

Option-like declarations:

  • Part.none: The partial value whose domain is False.
  • Part.some a: The partial value whose domain is True and whose value is a.
  • Part.ofOption: Converts an Option α to a Part α by sending none to none and some a to some a.
  • Part.toOption: Converts a Part α with a decidable domain to an Option α.
  • Part.equivOption: Classical equivalence between Part α and Option α.

Monadic structure:

  • Part.bind: o.bind f has value (f (o.get _)).get _ (f o morally) and is defined when o and f (o.get _) are defined.
  • Part.map: Maps the value and keeps the same domain.

Other:

  • Part.restrict: Part.restrict p o replaces the domain of o : Part α by p : Prop so long as p → o.Dom.
  • Part.assert: assert p f appends p to the domains of the values of a partial function.
  • Part.unwrap: Gets the value of a partial value regardless of its domain. Unsound.

Notation

For a : α, o : Part α, a ∈ o means that o is defined and equal to a. Formally, it means o.Dom and o.get _ = a.

We define several instances for constants and operations on Part α inherited from α.

This section could be moved to a separate file to avoid the import of Mathlib/Algebra/Notation/Defs.lean.

theorem Function.comp.congr_simp E1 #

∀ {α : Sort u} {β : Sort v} {δ : Sort w} (f f_1 : β → δ),
  f = f_1 → ∀ (g g_1 : α → β), g = g_1 → ∀ (a a_1 : α), a = a_1 → (f ∘ g) a = (f_1 ∘ g_1) a_1

theorem Part.toOption.congr_simp E1 #

∀ {α : Type u_1} (o o_1 : Part α),
  o = o_1 → ∀ {inst : Decidable o.Dom} [inst_1 : Decidable o_1.Dom], o.toOption = o_1.toOption

def Part.ctorIdx E1 #

{α : Type u} → Part α → ℕ

theorem Part.ofOption.match_1.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : Option α → Sort u_2) (x : Option α) (h_1 : Unit → motive none)
  (h_2 : (a : α) → motive (some a)),
  x = none →
    (match x with
      | none => h_1 ()
      | some a => h_2 a) ≍
      h_1 ()

theorem Part.ofOption.match_1.congr_eq_2 E1 #

∀ {α : Type u_1} (motive : Option α → Sort u_2) (x : Option α) (h_1 : Unit → motive none)
  (h_2 : (a : α) → motive (some a)) (a : α),
  x = some a →
    (match x with
      | none => h_1 ()
      | some a => h_2 a) ≍
      h_2 a

theorem Part.mk.injEq E0 #

∀ {α : Type u} (Dom : Prop) (get : Dom → α) (Dom_1 : Prop) (get_1 : Dom_1 → α),
  ({ Dom := Dom, get := get } = { Dom := Dom_1, get := get_1 }) = (Dom = Dom_1 ∧ get ≍ get_1)

theorem Part.get.congr_simp E1 #

∀ {α : Type u} (self self_1 : Part α) (e_self : self = self_1) (a : self.Dom), self.get a = self_1.get ⋯

theorem Part.mk.inj E1 #

∀ {α : Type u} {Dom : Prop} {get : Dom → α} {Dom_1 : Prop} {get_1 : Dom_1 → α},
  { Dom := Dom, get := get } = { Dom := Dom_1, get := get_1 } → Dom = Dom_1 ∧ get ≍ get_1

structure Part E1 #

Type u → Type u

Part α is the type of "partial values" of type α. It is similar to Option α except the domain condition can be an arbitrary proposition, not necessarily decidable.

ctor Part.mk E0 #

{α : Type u} → (Dom : Prop) → (Dom → α) → Part α

abbrev Part.Dom E1 #

{α : Type u} → Part α → Prop

The domain of a partial value

abbrev Part.get E1 #

{α : Type u} → (self : Part α) → self.Dom → α

Extract a value from a partial value given a proof of Dom

def Part.toOption E3 #

{α : Type u_1} → (o : Part α) → [Decidable o.Dom] → Option α

Convert a Part α with a decidable domain to an option

theorem Part.toOption_isSome E0 #

∀ {α : Type u_1} (o : Part α) [inst : Decidable o.Dom], o.toOption.isSome = true ↔ o.Dom

theorem Part.toOption_eq_none E0 #

∀ {α : Type u_1} (o : Part α) [inst : Decidable o.Dom], o.toOption = none ↔ ¬o.Dom

theorem Part.ext' E1 #

∀ {α : Type u_1} {o p : Part α}, (o.Dom ↔ p.Dom) → (∀ (h₁ : o.Dom) (h₂ : p.Dom), o.get h₁ = p.get h₂) → o = p

Part extensionality

theorem Part.eta E0 #

∀ {α : Type u_1} (o : Part α), { Dom := o.Dom, get := fun h ↦ o.get h } = o

Part eta expansion

def Part.Mem E1 #

{α : Type u_1} → Part α → α → Prop

a ∈ o means that o is defined and equal to a

instance Part.instMembership E0 #

{α : Type u_1} → Membership α (Part α)

theorem Part.mem_eq E0 #

∀ {α : Type u_1} (a : α) (o : Part α), (a ∈ o) = ∃ (h : o.Dom), o.get h = a

theorem Part.dom_iff_mem E1 #

∀ {α : Type u_1} {o : Part α}, o.Dom ↔ ∃ y, y ∈ o

theorem Part.get_mem E0 #

∀ {α : Type u_1} {o : Part α} (h : o.Dom), o.get h ∈ o

theorem Part.mem_mk_iff E0 #

∀ {α : Type u_1} {p : Prop} {o : p → α} {a : α}, a ∈ { Dom := p, get := o } ↔ ∃ (h : p), o h = a

theorem Part.ext E1 #

∀ {α : Type u_1} {o p : Part α}, (∀ (a : α), a ∈ o ↔ a ∈ p) → o = p

Part extensionality

theorem Part.ext_iff E0 #

∀ {α : Type u_1} {o p : Part α}, o = p ↔ ∀ (a : α), a ∈ o ↔ a ∈ p

def Part.none E3 #

{α : Type u_1} → Part α

The none value in Part has a False domain and an empty function.

instance Part.instInhabited E0 #

{α : Type u_1} → Inhabited (Part α)

theorem Part.notMem_none E0 #

∀ {α : Type u_1} (a : α), a ∉ Part.none

def Part.some E1 #

{α : Type u_1} → α → Part α

The some a value in Part has a True domain and the function returns a.

theorem Part.some_dom E0 #

∀ {α : Type u_1} (a : α), (Part.some a).Dom

theorem Part.mem_unique E0 #

∀ {α : Type u_1} {a b : α} {o : Part α}, a ∈ o → b ∈ o → a = b

theorem Part.mem_right_unique E0 #

∀ {α : Type u_1} {a : α} {o p : Part α}, a ∈ o → a ∈ p → o = p

theorem Part.Mem.left_unique E1 #

∀ {α : Type u_1}, Relator.LeftUnique fun x1 x2 ↦ x1 ∈ x2

theorem Part.Mem.right_unique E1 #

∀ {α : Type u_1}, Relator.RightUnique fun x1 x2 ↦ x1 ∈ x2

theorem Part.get_eq_of_mem E1 #

∀ {α : Type u_1} {o : Part α} {a : α}, a ∈ o → ∀ (h' : o.Dom), o.get h' = a

theorem Part.subsingleton E1 #

∀ {α : Type u_1} (o : Part α), {a | a ∈ o}.Subsingleton

theorem Part.get_some E0 #

∀ {α : Type u_1} {a : α} (ha : (Part.some a).Dom), (Part.some a).get ha = a

theorem Part.mem_some E0 #

∀ {α : Type u_1} (a : α), a ∈ Part.some a

theorem Part.mem_some_iff E0 #

∀ {α : Type u_1} {a b : α}, b ∈ Part.some a ↔ b = a

theorem Part.not_none_dom E0 #

∀ {α : Type u_1}, ¬Part.none.Dom

theorem Part.some_ne_none E0 #

∀ {α : Type u_1} (x : α), Part.some x ≠ Part.none

theorem Part.none_ne_some E0 #

∀ {α : Type u_1} (x : α), Part.none ≠ Part.some x

theorem Part.ne_none_iff E0 #

∀ {α : Type u_1} {o : Part α}, o ≠ Part.none ↔ ∃ x, o = Part.some x

theorem Part.some_injective E1 #

∀ {α : Type u_1}, Function.Injective Part.some

theorem Part.some_inj E0 #

∀ {α : Type u_1} {a b : α}, Part.some a = Part.some b ↔ a = b

theorem Part.some_get E0 #

∀ {α : Type u_1} {a : Part α} (ha : a.Dom), Part.some (a.get ha) = a

theorem Part.get_eq_iff_eq_some E1 #

∀ {α : Type u_1} {a : Part α} {ha : a.Dom} {b : α}, a.get ha = b ↔ a = Part.some b

theorem Part.get_eq_get_of_eq E0 #

∀ {α : Type u_1} (a : Part α) (ha : a.Dom) {b : Part α} (h : a = b), a.get ha = b.get ⋯

theorem Part.get_eq_iff_mem E1 #

∀ {α : Type u_1} {o : Part α} {a : α} (h : o.Dom), o.get h = a ↔ a ∈ o

theorem Part.none_toOption E0 #

∀ {α : Type u_1} [inst : Decidable Part.none.Dom], Part.none.toOption = none

theorem Part.some_toOption E0 #

∀ {α : Type u_1} (a : α) [inst : Decidable (Part.some a).Dom], (Part.some a).toOption = some a

instance Part.noneDecidable E0 #

{α : Type u_1} → Decidable Part.none.Dom

instance Part.someDecidable E0 #

{α : Type u_1} → (a : α) → Decidable (Part.some a).Dom

def Part.getOrElse E1 #

{α : Type u_1} → (a : Part α) → [Decidable a.Dom] → α → α

Retrieves the value of a : Part α if it exists, and return the provided default value otherwise.

theorem Part.getOrElse_of_dom E1 #

∀ {α : Type u_1} (a : Part α) (h : a.Dom) [inst : Decidable a.Dom] (d : α), a.getOrElse d = a.get h

theorem Part.getOrElse_of_not_dom E1 #

∀ {α : Type u_1} (a : Part α), ¬a.Dom → ∀ [inst : Decidable a.Dom] (d : α), a.getOrElse d = d

theorem Part.getOrElse_none E0 #

∀ {α : Type u_1} (d : α) [inst : Decidable Part.none.Dom], Part.none.getOrElse d = d

theorem Part.getOrElse_some E0 #

∀ {α : Type u_1} (a d : α) [inst : Decidable (Part.some a).Dom], (Part.some a).getOrElse d = a

theorem Part.mem_toOption E0 #

∀ {α : Type u_1} {o : Part α} [inst : Decidable o.Dom] {a : α}, a ∈ o.toOption ↔ a ∈ o

theorem Part.toOption_eq_some_iff E0 #

∀ {α : Type u_1} {o : Part α} [inst : Decidable o.Dom] {a : α}, o.toOption = some a ↔ a ∈ o

theorem Part.Dom.toOption E1 #

∀ {α : Type u_1} {o : Part α} [inst : Decidable o.Dom] (h : o.Dom), o.toOption = some (o.get h)

theorem Part.toOption_eq_none_iff E0 #

∀ {α : Type u_1} {a : Part α} [inst : Decidable a.Dom], a.toOption = none ↔ ¬a.Dom

theorem Part.elim_toOption E0 #

∀ {α : Type u_4} {β : Type u_5} (a : Part α) [inst : Decidable a.Dom] (b : β) (f : α → β),
  a.toOption.elim b f = if h : a.Dom then f (a.get h) else b

def Part.ofOption E3 #

{α : Type u_1} → Option α → Part α

Converts an Option α into a Part α.

theorem Part.mem_ofOption E0 #

∀ {α : Type u_1} {a : α} {o : Option α}, a ∈ ↑o ↔ a ∈ o

theorem Part.ofOption_dom E0 #

∀ {α : Type u_4} (o : Option α), (↑o).Dom ↔ o.isSome = true

theorem Part.ofOption_eq_get E1 #

∀ {α : Type u_4} (o : Option α), ↑o = { Dom := o.isSome = true, get := o.get }

instance Part.instCoeOption E0 #

{α : Type u_1} → Coe (Option α) (Part α)

theorem Part.mem_coe E0 #

∀ {α : Type u_1} {a : α} {o : Option α}, a ∈ ↑o ↔ a ∈ o

theorem Part.coe_none E0 #

∀ {α : Type u_1}, ↑none = Part.none

theorem Part.coe_some E0 #

∀ {α : Type u_1} (a : α), ↑(some a) = Part.some a

theorem Part.induction_on E1 #

∀ {α : Type u_1} {P : Part α → Prop} (a : Part α), P Part.none → (∀ (a : α), P (Part.some a)) → P a

instance Part.ofOptionDecidable E0 #

{α : Type u_1} → (o : Option α) → Decidable (↑o).Dom

theorem Part.to_ofOption E0 #

∀ {α : Type u_1} (o : Option α), (↑o).toOption = o

theorem Part.of_toOption E0 #

∀ {α : Type u_1} (o : Part α) [inst : Decidable o.Dom], ↑o.toOption = o

def Part.equivOption E3 #

{α : Type u_1} → Part α ≃ Option α

Part α is (classically) equivalent to Option α.

instance Part.instPartialOrder E0 #

{α : Type u_1} → PartialOrder (Part α)

We give Part α the order where everything is greater than none.

instance Part.instOrderBot E0 #

{α : Type u_1} → OrderBot (Part α)

theorem Part.le_total_of_le_of_le E1 #

∀ {α : Type u_1} {x y : Part α} (z : Part α), x ≤ z → y ≤ z → x ≤ y ∨ y ≤ x

def Part.assert E3 #

{α : Type u_1} → (p : Prop) → (p → Part α) → Part α

assert p f is a bind-like operation which appends an additional condition p to the domain and uses f to produce the value.

def Part.bind E3 #

{α : Type u_1} → {β : Type u_2} → Part α → (α → Part β) → Part β

The bind operation has value g (f.get), and is defined when all the parts are defined.

def Part.map E3 #

{α : Type u_1} → {β : Type u_2} → (α → β) → Part α → Part β

The map operation for Part just maps the value and maintains the same domain.

theorem Part.map_get E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β) (o : Part α) (a : o.Dom), (Part.map f o).get a = (f ∘ o.get) a

theorem Part.map_Dom E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β) (o : Part α), (Part.map f o).Dom = o.Dom

theorem Part.mem_map E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β) {o : Part α} {a : α}, a ∈ o → f a ∈ Part.map f o

theorem Part.mem_map_iff E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β) {o : Part α} {b : β}, b ∈ Part.map f o ↔ ∃ a ∈ o, f a = b

theorem Part.map_none E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β), Part.map f Part.none = Part.none

theorem Part.map_some E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β) (a : α), Part.map f (Part.some a) = Part.some (f a)

theorem Part.mem_assert E0 #

∀ {α : Type u_1} {p : Prop} {f : p → Part α} {a : α} (h : p), a ∈ f h → a ∈ Part.assert p f

theorem Part.mem_assert_iff E0 #

∀ {α : Type u_1} {p : Prop} {f : p → Part α} {a : α}, a ∈ Part.assert p f ↔ ∃ (h : p), a ∈ f h

theorem Part.assert_pos E1 #

∀ {α : Type u_1} {p : Prop} {f : p → Part α} (h : p), Part.assert p f = f h

theorem Part.assert_neg E1 #

∀ {α : Type u_1} {p : Prop} {f : p → Part α}, ¬p → Part.assert p f = Part.none

theorem Part.mem_bind E0 #

∀ {α : Type u_1} {β : Type u_2} {f : Part α} {g : α → Part β} {a : α} {b : β}, a ∈ f → b ∈ g a → b ∈ f.bind g

theorem Part.mem_bind_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {f : Part α} {g : α → Part β} {b : β}, b ∈ f.bind g ↔ ∃ a ∈ f, b ∈ g a

theorem Part.bind_eq_some_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {b : β} {x : Part α} {f : α → Part β},
  x.bind f = Part.some b ↔ ∃ a, x = Part.some a ∧ f a = Part.some b

Part.bind produces some b iff the input is some a and the continuation maps a to some b. This is the Part analogue of Option.bind_eq_some_iff.

theorem Part.Dom.bind E1 #

∀ {α : Type u_1} {β : Type u_2} {o : Part α} (h : o.Dom) (f : α → Part β), o.bind f = f (o.get h)

theorem Part.Dom.of_bind E1 #

∀ {α : Type u_1} {β : Type u_2} {f : α → Part β} {a : Part α}, (a.bind f).Dom → a.Dom

theorem Part.bind_none E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → Part β), Part.none.bind f = Part.none

theorem Part.bind_some E0 #

∀ {α : Type u_1} {β : Type u_2} (a : α) (f : α → Part β), (Part.some a).bind f = f a

theorem Part.bind_of_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {o : Part α} {a : α}, a ∈ o → ∀ (f : α → Part β), o.bind f = f a

theorem Part.bind_some_eq_map E1 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β) (x : Part α), (x.bind fun y ↦ Part.some (f y)) = Part.map f x

theorem Part.bind_toOption E1 #

∀ {α : Type u_1} {β : Type u_2} (f : α → Part β) (o : Part α) [inst : Decidable o.Dom]
  [inst_1 : (a : α) → Decidable (f a).Dom] [inst_2 : Decidable (o.bind f).Dom],
  (o.bind f).toOption = o.toOption.elim none fun a ↦ (f a).toOption

theorem Part.bind_assoc E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_4} (f : Part α) (g : α → Part β) (k : β → Part γ),
  (f.bind g).bind k = f.bind fun x ↦ (g x).bind k

theorem Part.bind_map E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_4} (f : α → β) (x : Part α) (g : β → Part γ),
  (Part.map f x).bind g = x.bind fun y ↦ g (f y)

theorem Part.map_bind E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_4} (f : α → Part β) (x : Part α) (g : β → γ),
  Part.map g (x.bind f) = x.bind fun y ↦ Part.map g (f y)

theorem Part.map_map E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (g : β → γ) (f : α → β) (o : Part α),
  Part.map g (Part.map f o) = Part.map (g ∘ f) o

instance Part.instMonad E0 #

Monad Part

instance Part.instLawfulMonad E0 #

LawfulMonad Part

theorem Part.map_id' E0 #

∀ {α : Type u_1} {f : α → α}, (∀ (x : α), f x = x) → ∀ (o : Part α), Part.map f o = o

theorem Part.bind_some_right E0 #

∀ {α : Type u_1} (x : Part α), x.bind Part.some = x

theorem Part.pure_eq_some E0 #

∀ {α : Type u_1} (a : α), pure a = Part.some a

theorem Part.ret_eq_some E0 #

∀ {α : Type u_1} (a : α), pure a = Part.some a

theorem Part.map_eq_map E0 #

∀ {α β : Type u_4} (f : α → β) (o : Part α), f <$> o = Part.map f o

theorem Part.bind_eq_bind E0 #

∀ {α β : Type u_4} (f : Part α) (g : α → Part β), f >>= g = f.bind g

theorem Part.bind_le E1 #

∀ {β α : Type u_2} (x : Part α) (f : α → Part β) (y : Part β), x >>= f ≤ y ↔ ∀ a ∈ x, f a ≤ y

def Part.restrict E3 #

{α : Type u_1} → (p : Prop) → (o : Part α) → (p → o.Dom) → Part α

restrict p o h replaces the domain of o with p, and is well defined when p implies o is defined.

theorem Part.mem_restrict E0 #

∀ {α : Type u_1} (p : Prop) (o : Part α) (h : p → o.Dom) (a : α), a ∈ Part.restrict p o h ↔ p ∧ a ∈ o

def Part.unwrap E3 #

{α : Type u_1} → Part α → α

unwrap o gets the value at o, ignoring the condition. This function is unsound.

theorem Part.assert_defined E1 #

∀ {α : Type u_1} {p : Prop} {f : p → Part α} (h : p), (f h).Dom → (Part.assert p f).Dom

theorem Part.bind_defined E1 #

∀ {α : Type u_1} {β : Type u_2} {f : Part α} {g : α → Part β} (h : f.Dom), (g (f.get h)).Dom → (f.bind g).Dom

theorem Part.bind_dom E0 #

∀ {α : Type u_1} {β : Type u_2} {f : Part α} {g : α → Part β}, (f.bind g).Dom ↔ ∃ (h : f.Dom), (g (f.get h)).Dom

instance Part.instOne E0 #

{α : Type u_1} → [One α] → One (Part α)

instance Part.instZero E0 #

{α : Type u_1} → [Zero α] → Zero (Part α)

instance Part.instMul E0 #

{α : Type u_1} → [Mul α] → Mul (Part α)

instance Part.instAdd E0 #

{α : Type u_1} → [Add α] → Add (Part α)

instance Part.instNeg E0 #

{α : Type u_1} → [Neg α] → Neg (Part α)

instance Part.instInv E0 #

{α : Type u_1} → [Inv α] → Inv (Part α)

instance Part.instDiv E0 #

{α : Type u_1} → [Div α] → Div (Part α)

instance Part.instSub E0 #

{α : Type u_1} → [Sub α] → Sub (Part α)

instance Part.instMod E0 #

{α : Type u_1} → [Mod α] → Mod (Part α)

instance Part.instAppend E0 #

{α : Type u_1} → [Append α] → Append (Part α)

instance Part.instInter E0 #

{α : Type u_1} → [Inter α] → Inter (Part α)

instance Part.instUnion E0 #

{α : Type u_1} → [Union α] → Union (Part α)

instance Part.instSDiff E0 #

{α : Type u_1} → [SDiff α] → SDiff (Part α)

theorem Part.add_def E0 #

∀ {α : Type u_1} [inst : Add α] (a b : Part α),
  a + b = do
    let y ← a
    Part.map (fun x ↦ y + x) b

theorem Part.mul_def E0 #

∀ {α : Type u_1} [inst : Mul α] (a b : Part α),
  a * b = do
    let y ← a
    Part.map (fun x ↦ y * x) b

theorem Part.one_def E0 #

∀ {α : Type u_1} [inst : One α], 1 = Part.some 1

theorem Part.zero_def E0 #

∀ {α : Type u_1} [inst : Zero α], 0 = Part.some 0

theorem Part.inv_def E0 #

∀ {α : Type u_1} [inst : Inv α] (a : Part α), a⁻¹ = Part.map (fun x ↦ x⁻¹) a

theorem Part.neg_def E0 #

∀ {α : Type u_1} [inst : Neg α] (a : Part α), -a = Part.map (fun x ↦ -x) a

theorem Part.div_def E0 #

∀ {α : Type u_1} [inst : Div α] (a b : Part α),
  a / b = do
    let y ← a
    Part.map (fun x ↦ y / x) b

theorem Part.sub_def E0 #

∀ {α : Type u_1} [inst : Sub α] (a b : Part α),
  a - b = do
    let y ← a
    Part.map (fun x ↦ y - x) b

theorem Part.mod_def E0 #

∀ {α : Type u_1} [inst : Mod α] (a b : Part α),
  a % b = do
    let y ← a
    Part.map (fun x ↦ y % x) b

theorem Part.append_def E0 #

∀ {α : Type u_1} [inst : Append α] (a b : Part α),
  a ++ b = do
    let y ← a
    Part.map (fun x ↦ y ++ x) b

theorem Part.inter_def E0 #

∀ {α : Type u_1} [inst : Inter α] (a b : Part α),
  a ∩ b = do
    let y ← a
    Part.map (fun x ↦ y ∩ x) b

theorem Part.union_def E0 #

∀ {α : Type u_1} [inst : Union α] (a b : Part α),
  a ∪ b = do
    let y ← a
    Part.map (fun x ↦ y ∪ x) b

theorem Part.sdiff_def E0 #

∀ {α : Type u_1} [inst : SDiff α] (a b : Part α),
  a \ b = do
    let y ← a
    Part.map (fun x ↦ y \ x) b

theorem Part.one_mem_one E1 #

∀ {α : Type u_1} [inst : One α], 1 ∈ 1

theorem Part.zero_mem_zero E1 #

∀ {α : Type u_1} [inst : Zero α], 0 ∈ 0

theorem Part.mul_mem_mul E1 #

∀ {α : Type u_1} [inst : Mul α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma * mb ∈ a * b

theorem Part.add_mem_add E1 #

∀ {α : Type u_1} [inst : Add α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma + mb ∈ a + b

theorem Part.left_dom_of_mul_dom E1 #

∀ {α : Type u_1} [inst : Mul α] {a b : Part α}, (a * b).Dom → a.Dom

theorem Part.left_dom_of_add_dom E1 #

∀ {α : Type u_1} [inst : Add α] {a b : Part α}, (a + b).Dom → a.Dom

theorem Part.right_dom_of_mul_dom E1 #

∀ {α : Type u_1} [inst : Mul α] {a b : Part α}, (a * b).Dom → b.Dom

theorem Part.right_dom_of_add_dom E1 #

∀ {α : Type u_1} [inst : Add α] {a b : Part α}, (a + b).Dom → b.Dom

theorem Part.mul_get_eq E0 #

∀ {α : Type u_1} [inst : Mul α] (a b : Part α) (hab : (a * b).Dom), (a * b).get hab = a.get ⋯ * b.get ⋯

theorem Part.add_get_eq E0 #

∀ {α : Type u_1} [inst : Add α] (a b : Part α) (hab : (a + b).Dom), (a + b).get hab = a.get ⋯ + b.get ⋯

theorem Part.some_add_some E1 #

∀ {α : Type u_1} [inst : Add α] (a b : α), Part.some a + Part.some b = Part.some (a + b)

theorem Part.some_mul_some E1 #

∀ {α : Type u_1} [inst : Mul α] (a b : α), Part.some a * Part.some b = Part.some (a * b)

theorem Part.inv_mem_inv E1 #

∀ {α : Type u_1} [inst : Inv α] (a : Part α), ∀ ma ∈ a, ma⁻¹ ∈ a⁻¹

theorem Part.neg_mem_neg E1 #

∀ {α : Type u_1} [inst : Neg α] (a : Part α), ∀ ma ∈ a, -ma ∈ -a

theorem Part.neg_some E1 #

∀ {α : Type u_1} [inst : Neg α] (a : α), -Part.some a = Part.some (-a)

theorem Part.inv_some E1 #

∀ {α : Type u_1} [inst : Inv α] (a : α), (Part.some a)⁻¹ = Part.some a⁻¹

theorem Part.sub_mem_sub E1 #

∀ {α : Type u_1} [inst : Sub α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma - mb ∈ a - b

theorem Part.div_mem_div E1 #

∀ {α : Type u_1} [inst : Div α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma / mb ∈ a / b

theorem Part.left_dom_of_div_dom E1 #

∀ {α : Type u_1} [inst : Div α] {a b : Part α}, (a / b).Dom → a.Dom

theorem Part.left_dom_of_sub_dom E1 #

∀ {α : Type u_1} [inst : Sub α] {a b : Part α}, (a - b).Dom → a.Dom

theorem Part.right_dom_of_div_dom E1 #

∀ {α : Type u_1} [inst : Div α] {a b : Part α}, (a / b).Dom → b.Dom

theorem Part.right_dom_of_sub_dom E1 #

∀ {α : Type u_1} [inst : Sub α] {a b : Part α}, (a - b).Dom → b.Dom

theorem Part.sub_get_eq E0 #

∀ {α : Type u_1} [inst : Sub α] (a b : Part α) (hab : (a - b).Dom), (a - b).get hab = a.get ⋯ - b.get ⋯

theorem Part.div_get_eq E0 #

∀ {α : Type u_1} [inst : Div α] (a b : Part α) (hab : (a / b).Dom), (a / b).get hab = a.get ⋯ / b.get ⋯

theorem Part.some_sub_some E1 #

∀ {α : Type u_1} [inst : Sub α] (a b : α), Part.some a - Part.some b = Part.some (a - b)

theorem Part.some_div_some E1 #

∀ {α : Type u_1} [inst : Div α] (a b : α), Part.some a / Part.some b = Part.some (a / b)

theorem Part.mod_mem_mod E1 #

∀ {α : Type u_1} [inst : Mod α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma % mb ∈ a % b

theorem Part.left_dom_of_mod_dom E1 #

∀ {α : Type u_1} [inst : Mod α] {a b : Part α}, (a % b).Dom → a.Dom

theorem Part.right_dom_of_mod_dom E1 #

∀ {α : Type u_1} [inst : Mod α] {a b : Part α}, (a % b).Dom → b.Dom

theorem Part.mod_get_eq E0 #

∀ {α : Type u_1} [inst : Mod α] (a b : Part α) (hab : (a % b).Dom), (a % b).get hab = a.get ⋯ % b.get ⋯

theorem Part.some_mod_some E1 #

∀ {α : Type u_1} [inst : Mod α] (a b : α), Part.some a % Part.some b = Part.some (a % b)

theorem Part.append_mem_append E1 #

∀ {α : Type u_1} [inst : Append α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma ++ mb ∈ a ++ b

theorem Part.left_dom_of_append_dom E1 #

∀ {α : Type u_1} [inst : Append α] {a b : Part α}, (a ++ b).Dom → a.Dom

theorem Part.right_dom_of_append_dom E1 #

∀ {α : Type u_1} [inst : Append α] {a b : Part α}, (a ++ b).Dom → b.Dom

theorem Part.append_get_eq E0 #

∀ {α : Type u_1} [inst : Append α] (a b : Part α) (hab : (a ++ b).Dom), (a ++ b).get hab = a.get ⋯ ++ b.get ⋯

theorem Part.some_append_some E1 #

∀ {α : Type u_1} [inst : Append α] (a b : α), Part.some a ++ Part.some b = Part.some (a ++ b)

theorem Part.inter_mem_inter E1 #

∀ {α : Type u_1} [inst : Inter α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma ∩ mb ∈ a ∩ b

theorem Part.left_dom_of_inter_dom E1 #

∀ {α : Type u_1} [inst : Inter α] {a b : Part α}, (a ∩ b).Dom → a.Dom

theorem Part.right_dom_of_inter_dom E1 #

∀ {α : Type u_1} [inst : Inter α] {a b : Part α}, (a ∩ b).Dom → b.Dom

theorem Part.inter_get_eq E0 #

∀ {α : Type u_1} [inst : Inter α] (a b : Part α) (hab : (a ∩ b).Dom), (a ∩ b).get hab = a.get ⋯ ∩ b.get ⋯

theorem Part.some_inter_some E1 #

∀ {α : Type u_1} [inst : Inter α] (a b : α), Part.some a ∩ Part.some b = Part.some (a ∩ b)

theorem Part.union_mem_union E1 #

∀ {α : Type u_1} [inst : Union α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma ∪ mb ∈ a ∪ b

theorem Part.left_dom_of_union_dom E1 #

∀ {α : Type u_1} [inst : Union α] {a b : Part α}, (a ∪ b).Dom → a.Dom

theorem Part.right_dom_of_union_dom E1 #

∀ {α : Type u_1} [inst : Union α] {a b : Part α}, (a ∪ b).Dom → b.Dom

theorem Part.union_get_eq E0 #

∀ {α : Type u_1} [inst : Union α] (a b : Part α) (hab : (a ∪ b).Dom), (a ∪ b).get hab = a.get ⋯ ∪ b.get ⋯

theorem Part.some_union_some E1 #

∀ {α : Type u_1} [inst : Union α] (a b : α), Part.some a ∪ Part.some b = Part.some (a ∪ b)

theorem Part.sdiff_mem_sdiff E1 #

∀ {α : Type u_1} [inst : SDiff α] (a b : Part α) (ma mb : α), ma ∈ a → mb ∈ b → ma \ mb ∈ a \ b

theorem Part.left_dom_of_sdiff_dom E1 #

∀ {α : Type u_1} [inst : SDiff α] {a b : Part α}, (a \ b).Dom → a.Dom

theorem Part.right_dom_of_sdiff_dom E1 #

∀ {α : Type u_1} [inst : SDiff α] {a b : Part α}, (a \ b).Dom → b.Dom

theorem Part.sdiff_get_eq E0 #

∀ {α : Type u_1} [inst : SDiff α] (a b : Part α) (hab : (a \ b).Dom), (a \ b).get hab = a.get ⋯ \ b.get ⋯

theorem Part.some_sdiff_some E1 #

∀ {α : Type u_1} [inst : SDiff α] (a b : α), Part.some a \ Part.some b = Part.some (a \ b)