AFTD Auto-Formalizing Theoretical Domains

order_move_to_front

def

The order obtained by moving attribute a to the front of order π, preserving the relative order of the remaining attributes.

Statement

def order_move_to_front {d : ℕ} (a : Fin d) (π : Order d) : Order d
Defined in
arXiv:2610.39311 Definition 1
Verified
31 Oct 2026
Axioms
none listed
Built on 1
  • OrderAn order of dimension d is a permutation of the attribute set {0, ..., d-1}, represented as a list without duplicates containing all…
Used by 6
  • complete_order_graph_dim_six_lower_boundEvery complete order graph of dimension 6 has at least 40 edges.
  • OrderGraphAn order graph of dimension d is a structure consisting of a finite set V of orders of Fin d and a finite set E of edges (π, a) where π :…
  • order_graph_serves_uniAn order graph G of dimension d serves requirement (S, x) where S is a finite set of Fin d and x : Fin d in the unidirectional model if…
  • order_graph_is_complete_of_complete_uniIf an order graph G of dimension d is complete in the unidirectional model, then G is complete in the bidirectional model.
  • complete_order_graph_dim_six_upper_boundThere exists a complete order graph of dimension 6 with exactly 40 edges.
  • order_graph_servesAn order graph G serves requirement (S, x) where S is a finite set of Fin d and x : Fin d if there exists a nonempty list of edges p all…

Read back from the Lean

order_move_to_front is a function that takes an implicit natural number d : ℕ, an element a : Fin d, and an ordering π : Order d, and returns a new Order d. If a ∈ π.elems, it returns the Order d whose underlying list is a :: π.elems.erase a (moving a to the front of the list by prepending a and erasing its previous occurrence); otherwise, it returns π unchanged.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- Move attribute a to the front of order π. -/
def order_move_to_front {d : ℕ} (a : Fin d) (π : Order d) : Order d := if h : a ∈ π.elems then
    ⟨a :: π.elems.erase a,
     by rw [List.nodup_cons]; exact ⟨List.Nodup.not_mem_erase π.nodup, List.Nodup.erase a π.nodup⟩,
     by
       have hpos : 0 < π.elems.length := List.length_pos_of_mem h
       have hl := π.length_eq
       rw [List.length_cons, List.length_erase_of_mem h]
       omega⟩
  else π
See it in the graphDiscuss this resultChallenge it