Documentation

LeanPool.ApollonianSuperharmonic.ListEndpointFacts

ListEndpointFacts #

Shared facts adapted from Wesley Pegden's Apache-2.0 Trellis formalization of Levine–Pegden–Smart, replacing repeated implementations at their common dependency level.

theorem ApollonianSuperharmonic.ListEndpointFacts.internalNeighbors (l : List GaussianInt) (x h t : GaussianInt) :
l.Nodup → l.head? = some h → l.getLast? = some t → x ∈ l → x ≠ h → x ≠ t → ∃ (pre : List GaussianInt) (y : GaussianInt) (z : GaussianInt) (post : List GaussianInt), l = pre ++ y :: x :: z :: post

Shared internalNeighbors identity for ListEndpointFacts.

theorem ApollonianSuperharmonic.ListEndpointFacts.headMembership {α : Type u_1} (l : List α) (a : α) (hhead : l.head? = some a) :
a ∈ l

A specified head belongs to its list.

theorem ApollonianSuperharmonic.ListEndpointFacts.zipHeadShape {α : Type u_1} {β : Type u_2} (left : List α) (right : List β) (a : α) (b : β) (hleft : left.head? = some a) (hright : right.head? = some b) :
left.zip right = [(a, b)] ++ left.tail.zip right.tail

Zipping lists with specified heads separates the first pair.

theorem ApollonianSuperharmonic.ListEndpointFacts.headDropLastAppend {α : Type u_1} (left right : List α) (a b : α) (hhead : left.head? = some a) (hlast : left.getLast? = some b) (hright : right.head? = some b) :
(left.dropLast ++ right).head? = some a

Replacing a list's last entry by a list starting there preserves its head.

theorem ApollonianSuperharmonic.ListEndpointFacts.lastDropLastAppend {α : Type u_1} (left right : List α) (a : α) (hlast : right.getLast? = some a) :
(left.dropLast ++ right).getLast? = some a

Appending a nonempty final list preserves its last entry.

theorem ApollonianSuperharmonic.ListEndpointFacts.getNotTake {α : Type u_1} (l : List α) (hn : l.Nodup) (m : ℕ) (hm : m < l.length) :
l.get ⟨m, hm⟩ ∉ List.take m l

A nodup list's indexed entry does not occur in its preceding prefix.

theorem ApollonianSuperharmonic.ListEndpointFacts.lastMembership {α : Type u_1} (S : α) (forward : List α) (hflast : forward.getLast? = some S) :
S ∈ forward

A specified last element belongs to its list.

theorem ApollonianSuperharmonic.ListEndpointFacts.splitMembership {α : Type u_1} (r : List α) (z : α) (hz : z ∈ r) :
∃ (l : List α) (t : List α), r = l ++ z :: t

Split a list at any member.

theorem ApollonianSuperharmonic.ListEndpointFacts.twoLeLength {α : Type u_1} (a b : α) (hab : a ≠ b) (k : List α) (hhead : k.head? = some b) (hlast : k.getLast? = some a) :

Distinct head and last entries require at least two list elements.