Gadgets and chains of gadgets as value functions
DefinitionRhoMin_GadgetGadget. For a number and a function (the values of an interior of size ), the gadget has size and values
Chain parameters. An offset , a number of gadgets, sizes , interiors and a flag saying whether one fixed point is appended. The -th gadget starts at
and the named positions are the joint , the gates and , the corners and , and the interior block . The set of positions of the chain is , together with if .
A function fits a chain. A value function fits the parameters if is even and, for every : is odd; maps injectively into itself and fixes and ; and for all ; and moreover if .
These definitions describe the permutations built for the upper bound: chains of gadgets.
Formalization Note Positions are natural numbers and a chain may sit at any even offset , so that a chain can be the interior of a gadget of a larger chain. The condition "fits" does not ask the interiors to be parity-preserving.
import Definitions.Def_RhoMin_Orient import Definitions.Def_RhoMin_Defs import Definitions.Def_RhoMin_Piece import Definitions.Def_RhoMin_Dir import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.Fintype.Perm import Mathlib.Data.Fintype.Card import Mathlib.Data.List.Nodup import Mathlib.Data.Nat.Find import Mathlib.Data.List.FinRange import Mathlib.Data.Finset.Lattice.Fold import Mathlib.Data.Finset.Card import Mathlib.Data.List.Count import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset namespace RhoMin structure Pieces where p : ℕ K : ℕ r : ℕ → ℕ g : ℕ → ℕ → ℕ eps : Bool /-- The values of the gadget Y(g) of size r + 3 (positions 0, 1, 2..r+1, r+2). -/ def gadV (r : ℕ) (g : ℕ → ℕ) (k : ℕ) : ℕ := if k = 0 then 0 else if k = 1 then r + 2 else if k ≤ r + 1 then g (k - 2) + 2 else 1 namespace Pieces def offs (P : Pieces) (j : ℕ) : ℕ := P.p + ∑ i ∈ Finset.range j, (P.r i + 3) def toData (P : Pieces) : ChainData where K := P.K z := P.offs a j := P.offs j + 1 b j := P.offs j + P.r j + 2 c j := P.offs j + 2 w j := P.offs j + P.r j + 1 I j := Finset.Ico (P.offs j + 2) (P.offs j + 2 + P.r j) X := Finset.Ico P.p (P.offs P.K + if P.eps then 1 else 0) end Pieces structure Fits (f : ℕ → ℕ) (P : Pieces) : Prop where peven : P.p % 2 = 0 rodd : ∀ j < P.K, P.r j % 2 = 1 gin : ∀ j < P.K, ∀ i < P.r j, P.g j i < P.r j ginj : ∀ j < P.K, ∀ i < P.r j, ∀ i' < P.r j, P.g j i = P.g j i' → i = i' g0 : ∀ j < P.K, P.g j 0 = 0 glast : ∀ j < P.K, P.g j (P.r j - 1) = P.r j - 1 hf : ∀ j < P.K, ∀ k < P.r j + 3, f (P.offs j + k) = P.offs j + gadV (P.r j) (P.g j) k heps : P.eps = true → f (P.offs P.K) = P.offs P.K end RhoMin
Read-back
What the Lean code literally says, in plain math · claude-fable-5-2
Structure Pieces. A pieces datum is a bundle of five pieces of data with no conditions imposed on them:
- a natural number ;
- a natural number ;
- a function , written ;
- a function , i.e. for each natural number a function ;
- a truth value .
The functions and are defined at every index , including , and each is defined on all of .
Definition gadV. For a natural number , a function and a natural number , the natural number is
The cases are tested in this order. The last case applies to every , not only to , so the function is defined for all and equals for all large . When the third case never occurs: the values are for . No assumption is made on ; in the third case is evaluated at .
Definition Pieces.offs. For a pieces datum (with components ) and a natural number , the natural number is
Thus and . It is defined for every , including , in which case the sum uses the values with .
Definition Pieces.toData. To a pieces datum (components , and offsets ) is associated a bundle consisting of a natural number, five functions , a family of finite sets and a finite set , given for every natural number by:
- the natural number is (the same as in );
- ;
- ;
- ;
- ;
- ;
- , the consecutive integers from to ;
- , where if is true and if is false.
The functions are not used. When , is the smallest and the largest element of (they coincide when ). When , the set is empty, and . When , is empty if is false and if is true.
Structure Fits. Let be an arbitrary function (not assumed injective, surjective, or otherwise restricted) and let be a pieces datum with components and offsets . The proposition " fits " is the conjunction of the following eight conditions.
- (peven) is even: .
- (rodd) For every : is odd, .
- (gin) For every and every : .
- (ginj) For every and all , : if then .
- (g0) For every : .
- (glast) For every : , where the subtraction is truncated at (so would mean if ; under condition 2, and no truncation occurs).
- (hf) For every and every :
where equals if ; if ; if ; and if . Spelled out, for each :
- (heps) If is true, then .
Conditions 3 and 4 together say that restricted to is an injective map of that set into itself. When , conditions 5 and 6 are the same statement . Nothing is required of or for , of for , or of for , for , or for when is false; condition 7 determines exactly on the integers with . When , conditions 2–7 hold vacuously and the proposition reduces to: is even, and if is true then .