Write more documentation
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
@@ -1,11 +1,46 @@
|
||||
import Spa.Lattice
|
||||
|
||||
/-!
|
||||
|
||||
# Product Lattice
|
||||
|
||||
This file provides a proof that, in addition to being a lattice,
|
||||
the product of two types $\alpha \times \beta$ forms a `Spa.FiniteHeightLattice`
|
||||
if both $\alpha$ and $\beta$ have a finite height.
|
||||
|
||||
The proof proceeds by "unzipping" a chain:
|
||||
|
||||
$$
|
||||
(a_1, b_1) < (a_1, b_2) < \ldots < (a_n, b_m)
|
||||
$$
|
||||
|
||||
In which, at each step, either an $\alpha$ or $\beta$ element
|
||||
might ratchet up, into two chains:
|
||||
|
||||
$$
|
||||
\begin{aligned}
|
||||
a_1 < \ldots < a_n \\
|
||||
b_1 < \ldots < b_m
|
||||
\end{aligned}
|
||||
$$
|
||||
|
||||
Because at least one of the two "unzipped" chains grows with
|
||||
each element of the product chain, the full chain length
|
||||
can't exceed the sum of the two components. By the definition
|
||||
of finite height, these two chains are bounded, and therefore,
|
||||
the product chain is bounded too.
|
||||
|
||||
-/
|
||||
|
||||
namespace Spa
|
||||
|
||||
section Unzip
|
||||
|
||||
variable {α β : Type*} [PartialOrder α] [PartialOrder β]
|
||||
|
||||
/-- The unzipping lemma: any chain (`LTSeries`) of product
|
||||
elements can be decomposed into chains of components,
|
||||
whose lengths bound the chain. -/
|
||||
lemma LTSeries.exists_unzip (c : LTSeries (α × β)) :
|
||||
∃ (c₁ : LTSeries α) (c₂ : LTSeries β),
|
||||
c₁.head = c.head.1 ∧ c₁.last = c.last.1 ∧
|
||||
@@ -60,6 +95,9 @@ section FixedHeight
|
||||
|
||||
variable {α β : Type*}
|
||||
|
||||
/-- The longest possible chain is one in which only one of the components grows
|
||||
at a time, making the maximum height of $\alpha \times \beta$ be
|
||||
$\text{height}_\alpha + \text{height}_\beta$. -/
|
||||
instance prod [A : FiniteHeightLattice α] [B : FiniteHeightLattice β] :
|
||||
FiniteHeightLattice (α × β) where
|
||||
toLattice := inferInstance
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
import Spa.Lattice
|
||||
|
||||
/-!
|
||||
|
||||
# Unit Lattice
|
||||
|
||||
This file provides a proof that in addition to being a lattice,
|
||||
`PUnit` is a `Spa.FiniteHeightLattice`. This is fairly trivial result,
|
||||
but the unit is used as a placeholder in various contexts (e.g.,
|
||||
as a base case for the iterated product `Spa/Lattice/IterProd.lean`). -/
|
||||
|
||||
namespace Spa
|
||||
|
||||
/-- Since a singleton type's preorder has no nonempty `<` chains,
|
||||
they are vacuously bounded by any minimum height. -/
|
||||
lemma boundedChains_of_subsingleton (α : Type*) [Preorder α] [Subsingleton α]
|
||||
(n : ℕ) : BoundedChains α n := fun c => by
|
||||
by_contra hc
|
||||
|
||||
Reference in New Issue
Block a user