Theoremclosed_of_full
A shaped set with n members is all of range n, so closed.
Statement
theorem closed_of_full {n : Nat} {r : Nat → Nat → Bool} {s : List Nat} (hs : Shape n s)
(hl : n ≤ s.length) : Closed n r sProof
by
intro a _ b hb _
have hself := shape_self hs
have hmono : ∀ x ∈ List.range n, (fun j => s.contains j) x = true → (fun _ => true) x = true :=
fun _ _ _ => rfl
have heq : ((List.range n).filter fun j => s.contains j).length = ((List.range n).filter fun _ => true).length := by
rw [← hself]
have : ((List.range n).filter fun _ => true) = List.range n := List.filter_eq_self.mpr (by simp)
rw [this, List.length_range]
exact Nat.le_antisymm (shape_len hs) hl
have := len_filter_eq hmono heq b (List.mem_range.mpr hb) rfl
simpa using thisProved with tactics, which Lean expands into a proof term that its kernel checks.
Theorems it uses
Used by
In StandardElmMech/Src/Graph.lean: Reachability on graphs over 0 .. n-1 (Plus, Reach) and its decider, proved correct (plusB_iff, reachB_iff).
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.