Elm Exactly

TheoremlabelsIncreasing_iff

StandardElmMech/Eff/Normalise.lean:56, Labels increasing as a pairwise property · term proof

Statement

theorem labelsIncreasing_iff : ∀ fs : PFields, fs.labelsIncreasing = true ↔ fs.labels.Pairwise (· < ·)
  | .nil => by simp [PFields.labelsIncreasing, PFields.labels]
  | .cons l τ .nil => by simp [PFields.labelsIncreasing, PFields.labels]
  | .cons l τ (.cons l' τ' rest) => by
    have ih

Proof

labelsIncreasing_iff (.cons l' τ' rest)
    simp only [PFields.labelsIncreasing, Bool.and_eq_true, decide_eq_true_eq, ih]
    simp only [PFields.labels, List.pairwise_cons, List.mem_cons]
    constructor
    · rintro ⟨hll', h1, h2⟩
      refine ⟨?_, h1, h2⟩
      rintro a (rfl | ha)
      · exact hll'
      · exact String.lt_trans hll' (h1 a ha)
    · rintro ⟨h0, h1, h2⟩
      exact ⟨h0 l' (.inl rfl), h1, h2⟩

Proved by a term, which Lean's kernel checks directly.

In StandardElmMech/Eff/Normalise.lean: PTy.normalise (record fields sorted by label) and normalise_canon: canonical when each record's labels are distinct.

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.