1-- The far-wall face of a Kuhn simplex, restricted to the lower cube, is a2-- Kuhn simplex of one dimension less: its base is the restricted base and3-- its permutation is the rotated permutation restricted4-- Part of Cumulus, the Grace17 mathematics library.5-- Copyright (c) 2026 Grant Passmore.6-- Released under the Apache License 2.0. See LICENSE in the repository root.7-- Authors: Grant Passmore89module Grace.Cumulus.FixedPoint.KuhnWallSimplex10import KuhnExtend1112def wallPerm (m u : Set) : Set:= restrict(rotated(succ(m), u), m)1314-- A bijection of succ(m) fixing m restricts to a bijection of m.15theorem Bijective.restrict_fixed (m : Nat) (g : Set)16requires bijective : BijectiveBetween(g, succ(m), succ(m))17requires fixed : g(m) = m18shows BijectiveBetween(restrict(g, m), m, m)19proof20have injective := Bijective.injective with bijective21have function := Injective.function with injective22have mSubset := successor.subset at m23have mIn := bootstrap.succ.self at m24have closed : ∀ l ∈ m, g(l) ∈ m25intros l hl26have lIn := membership.into_successor with hl27have valueIn := FunctionBetween.apply_closed with function, lIn28havesplit:= bootstrap.succ.membership.forward with valueIn29casessplitwith below | same30 . exact below31 . exfalso32rw← fixed at same33have equal := Injective.apply_cancel with injective, lIn, mIn, same34rw equal at hl35exact membership.irreflexive with hl36have restricted := restrict.function with function, mSubset, closed37constructor38 . apply Injective.of_cancel with restricted39intros x hx y hy same40have xValue := restrict.domain_apply with function, mSubset, hx41have yValue := restrict.domain_apply with function, mSubset, hy42rw [xValue, yValue] at same43have xIn := membership.into_successor with hx44have yIn := membership.into_successor with hy45exact Injective.apply_cancel with injective, xIn, yIn, same46 . constructor47 . exact restricted48 . intros y hy49obtain⟨fn, law⟩:= Bijective.surjective with bijective50have yIn := membership.into_successor with hy51obtain⟨l, hl, edge⟩:= law with yIn52have value := FunctionBetween.apply_value with function, hl, edge53have lBelow : l ∈ m54havesplit:= bootstrap.succ.membership.forward with hl55casessplitwith below | same56 . exact below57 . exfalso58rw [same, fixed] at value59rw← value at hy60exact membership.irreflexive with hy61witness l62constructor63 . exact lBelow64 . have restrictedValue := restrict.domain_apply with function, mSubset, lBelow65have edge2 := FunctionBetween.relates_apply with restricted, lBelow66 rwa [restrictedValue, value] at edge26768theorem wallPerm.bijective (m : Nat) (u : Set)69requires updBijective : BijectiveBetween(u, succ(m), succ(m))70requires first : u(0) = m71shows BijectiveBetween(wallPerm(m, u), m, m)72proof73have turned := rotated.bijective with updBijective74have mIn := bootstrap.succ.self at m75have top : succ(m) = succ(m) byrfl76have fixed := rotated.wrap with updBijective, mIn, top77rw first at fixed78have same : wallPerm(m, u) = restrict(rotated(succ(m), u), m)79unfold wallPerm80rfl81rw same82exact Bijective.restrict_fixed with turned, fixed8384theorem wallPerm.value (m : Nat) (u l : Set)85requires updBijective : BijectiveBetween(u, succ(m), succ(m))86requires hl : l ∈ m87shows wallPerm(m, u)(l) = u(succ(l))88proof89have turned := rotated.bijective with updBijective90have turnedFunction := Injective.function with (Bijective.injective with turned)91have mSubset := successor.subset at m92have lIn := membership.into_successor with hl93have lNat := natural.member at m with hl94have lLess := Less.of_membership with hl95have sLess : succ(l) < succ(m) byarith96have sIn := membership.of_Less with sLess97have same : wallPerm(m, u) = restrict(rotated(succ(m), u), m)98unfold wallPerm99rfl100rw same101have value := restrict.domain_apply with turnedFunction, mSubset, hl102rw value103exact rotated.step with updBijective, lIn, sIn104105-- Below the far wall, the raised coordinates of the restricted simplex are106-- those of the original one step up.107theorem raised.wall_iff (m : Nat) (u k j : Set)108requires updBijective : BijectiveBetween(u, succ(m), succ(m))109requires first : u(0) = m110requires hk : k ∈ succ(m)111requires hj : j ∈ m112shows j ∈ raised(m, wallPerm(m, u), k) ↔ j ∈ raised(succ(m), u, succ(k))113proof114have kNat := natural.member at succ(m) with hk115have kLess := Less.of_membership with hk116have kInside :=Ordinal.member_subset with (Ordinal.natural at succ(m)), hk117have jIn := membership.into_successor with hj118constructor119 . intro inside120obtain⟨inM, l, hl, shape⟩:= raised.membership.forward with inside121have lIn := kInside with l, hl122have lBelow : l ∈ m123have lNat := natural.member at succ(m) with lIn124have lLess := Less.of_membership with hl125have less : l < m byarith126exact membership.of_Less with less127have value := wallPerm.value with updBijective, lBelow128apply raised.membership.backward129constructor130 . exact jIn131 . witness succ(l)132constructor133 . have lNat := natural.member at m with lBelow134have lLess := Less.of_membership with hl135have less : succ(l) < succ(k) byarith136exact membership.of_Less with less137 . rw [shape, value]138rfl139 . intro inside140obtain⟨inSucc, i, hi, shape⟩:= raised.membership.forward with inside141have iNat := natural.member at succ(k) with hi142have iLess := Less.of_membership with hi143havesplit:= natural.zero_or_successor with iNat144casessplitwith zero | successor145 . exfalso146rw [zero, first] at shape147rw shape at hj148exact membership.irreflexive with hj149 . obtain⟨l, lNat, iEq⟩:= successor150rw iEq at iLess151have lLess : l < k byarith152have lIn := membership.of_Less with lLess153have lBelow : l < m byarith154have lInM := membership.of_Less with lBelow155have value := wallPerm.value with updBijective, lInM156apply raised.membership.backward157constructor158 . exact hj159 . witness l160constructor161 . exact lIn162 . rw [shape, iEq, value]163rfl164165theorem kuhnVertex.wall (m : Nat) (b u k : Set)166requires baseFunction : b : succ(m) → ℕ167requires updBijective : BijectiveBetween(u, succ(m), succ(m))168requires first : u(0) = m169requires hk : k ∈ succ(m)170shows restrict(kuhnVertex(succ(m), b, u)(succ(k)), m) = kuhnVertex(m, restrict(b, m), wallPerm(m, u))(k)171proof172have mSubset := successor.subset at m173have kNat := natural.member at succ(m) with hk174have kLess := Less.of_membership with hk175have sLess : succ(k) < succ(succ(m)) byarith176have sIn := membership.of_Less with sLess177have restrictedBase := restrict.domain_function with baseFunction, mSubset178have vertexFunction := kuhnVertex.function_on at succ(m), b, u, succ(k) with baseFunction, sIn179have leftFunction := restrict.domain_function with vertexFunction, mSubset180have rightFunction := kuhnVertex.function_on at m, restrict(b, m), wallPerm(m, u), k with restrictedBase, hk181apply FunctionBetween.ext with leftFunction, rightFunction182intros j hj183have leftValue := restrict.domain_apply with vertexFunction, mSubset, hj184have jIn := membership.into_successor with hj185have coordinate := kuhnVertex.coordinate at succ(m), b, u, succ(k), j with baseFunction, sIn, jIn186have rightValue := kuhnVertex.coordinate at m, restrict(b, m), wallPerm(m, u), k, j with restrictedBase, hk, hj187have baseValue := restrict.domain_apply with baseFunction, mSubset, hj188have equivalent := raised.wall_iff with updBijective, first, hk, hj189have same := indicator.congr with equivalent190rw [leftValue, coordinate, rightValue, baseValue, same]191rfl192193-- The far-wall face of a simplex, restricted, is the simplex one dimension194-- down with the restricted base and the rotated permutation restricted.195theorem kuhnSimplex.wall_face (m p : Nat) (b u : Set)196requires baseFunction : b : succ(m) → ℕ197requires bounds : ∀ j ∈ succ(m), b(j) < p198requires updBijective : BijectiveBetween(u, succ(m), succ(m))199requires first : u(0) = m200shows functionImage(cubeRestrict(m, p), kuhnSimplex(succ(m), b, u) ∖ {kuhnVertex(succ(m), b, u)(0)}, functionSpace(m, succ(p))) =201 kuhnSimplex(m, restrict(b, m), wallPerm(m, u))202proof203have updInjective := Bijective.injective with updBijective204have mSubset := successor.subset at m205have restrictedBase := restrict.domain_function with baseFunction, mSubset206have zeroLess : 0 < succ(succ(m)) byarith207have zeroIn := membership.of_Less with zeroLess208ext y209constructor210 . intro hy211obtain⟨yIn, x, hx, yShape⟩:= functionImage.membership.forward with hy212have parts := difference.singleton_membership.forward with hx213obtain⟨inSpace, i, hi, xShape⟩:= kuhnSimplex.membership.forward with parts.left214have xInCube : x ∈ functionSpace(succ(m), succ(p))215rw xShape216exact kuhnVertex.into_cube with baseFunction, bounds, hi217have value := cubeRestrict.value with xInCube218have iNat := natural.member at succ(succ(m)) with hi219have iLess := Less.of_membership with hi220havesplit:= natural.zero_or_successor with iNat221casessplitwith zero | successor222 . exfalso223apply parts.right224rw [xShape, zero]225rfl226 . obtain⟨k, kNat, iEq⟩:= successor227rw iEq at iLess228have kLess : k < succ(m) byarith229have kIn := membership.of_Less with kLess230have agree := kuhnVertex.wall with baseFunction, updBijective, first, kIn231rw [yShape, value, xShape, iEq, agree]232exact kuhnVertex.member with restrictedBase, kIn233 . intro hy234obtain⟨inSpace, k, hk, yShape⟩:= kuhnSimplex.membership.forward with hy235have kNat := natural.member at succ(m) with hk236have kLess := Less.of_membership with hk237have sLess : succ(k) < succ(succ(m)) byarith238have sIn := membership.of_Less with sLess239have agree := kuhnVertex.wall with baseFunction, updBijective, first, hk240have xInCube := kuhnVertex.into_cube at succ(m), p, b, u, succ(k) with baseFunction, bounds, sIn241have value := cubeRestrict.value with xInCube242have restrictedBounds : ∀ j ∈ m, restrict(b, m)(j) < p243intros j hj244have baseValue := restrict.domain_apply with baseFunction, mSubset, hj245rw baseValue246exact bounds with (membership.into_successor with hj)247apply functionImage.membership.backward248constructor249 . rw yShape250exact kuhnVertex.into_cube with restrictedBase, restrictedBounds, hk251 . witness kuhnVertex(succ(m), b, u)(succ(k))252constructor253 . apply difference.singleton_membership.backward254constructor255 . exact kuhnVertex.member with baseFunction, sIn256 . intro equal257have same := kuhnVertex.injective with baseFunction, updInjective, sIn, zeroIn, equal258arith259 . rw [yShape, value, agree]260rfl261