File: .lake/packages/batteries/Batteries/Data/DList.lean

full_name: Batteries.DList.invariant
code: /--
A difference List is a Function that, given a List, returns the original
contents of the difference List prepended to the given List.
This structure supports `O(1)` `append` and `concat` operations on lists, making it
useful for append-heavy uses such as logging and pretty printing.
-/
structure DList (α : Type u) where
  /-- "Run" a `DList` by appending it on the right by a `List α` to get another `List α`. -/
  apply     : List α → List α
  /-- The `apply` function of a `DList` is completely determined by the list `apply []`. -/
  invariant : ∀ l, apply l = apply [] ++ l
goal: self.apply l = self.apply [] ++ l

full_name: Batteries.DList
code: /--
A difference List is a Function that, given a List, returns the original
contents of the difference List prepended to the given List.
This structure supports `O(1)` `append` and `concat` operations on lists, making it
useful for append-heavy uses such as logging and pretty printing.
-/
structure DList (α : Type u) where
  /-- "Run" a `DList` by appending it on the right by a `List α` to get another `List α`. -/
  apply     : List α → List α
  /-- The `apply` function of a `DList` is completely determined by the list `apply []`. -/
  invariant : ∀ l, apply l = apply [] ++ l
goal: Type u

full_name: Batteries.DList.apply
code: /--
A difference List is a Function that, given a List, returns the original
contents of the difference List prepended to the given List.
This structure supports `O(1)` `append` and `concat` operations on lists, making it
useful for append-heavy uses such as logging and pretty printing.
-/
structure DList (α : Type u) where
  /-- "Run" a `DList` by appending it on the right by a `List α` to get another `List α`. -/
  apply     : List α → List α
  /-- The `apply` function of a `DList` is completely determined by the list `apply []`. -/
  invariant : ∀ l, apply l = apply [] ++ l
goal: List α → List α

full_name: Batteries.DList.ofList
code: /-- `O(1)` (`apply` is `O(|l|)`). Convert a `List α` into a `DList α`. -/
def ofList (l : List α) : DList α 
goal: Batteries.DList α

full_name: Batteries.DList.empty
code: /-- `O(1)` (`apply` is `O(1)`). Return an empty `DList α`. -/
def empty : DList α 
goal: Batteries.DList α

full_name: Batteries.DList.instEmptyCollection
code: instance : EmptyCollection (DList α) 
goal: EmptyCollection (Batteries.DList α)

full_name: Batteries.DList.toList
code: /-- `O(apply())`. Convert a `DList α` into a `List α` by running the `apply` function. -/
def toList : DList α → List α
  
goal: Batteries.DList α → List α

full_name: Batteries.DList.singleton
code: /-- `O(1)` (`apply` is `O(1)`). A `DList α` corresponding to the list `[a]`. -/
def singleton (a : α) : DList α 
goal: Batteries.DList α

full_name: Batteries.DList.cons
code: /-- `O(1)` (`apply` is `O(1)`). Prepend `a` on a `DList α`. -/
def cons : α → DList α → DList α
  
goal: α → Batteries.DList α → Batteries.DList α

full_name: Batteries.DList.append
code: /-- `O(1)` (`apply` is `O(1)`). Append two `DList α`. -/
def append : DList α → DList α → DList α
  
goal: Batteries.DList α → Batteries.DList α → Batteries.DList α

full_name: Batteries.DList.push
code: /-- `O(1)` (`apply` is `O(1)`). Append an element at the end of a `DList α`. -/
def push : DList α → α → DList α
  
goal: Batteries.DList α → α → Batteries.DList α

full_name: Batteries.DList.instAppend
code: instance : Append (DList α) 
goal: Append (Batteries.DList α)