EffortResponse.lean

Board Support, CEO (Mis)Reporting, and Scapegoating · December 2, 2026 verification

1import EffortContract23open Std Lean.Grind Scapegoating Disclosure Posterior4namespace EffortContract5variable {R : Type} [Field R] [LE R] [LT R] [IsLinearOrder R] [LawfulOrderLT R] [OrderedRing R]67/-- Consistent effort for a fixed high bonus on the binding IC-L schedule.8As in the paper's partial derivative, the low payment adjusts with beliefs. -/9def Response (E : Economy R) (a m ψ b x y : R) : Prop :=10  0≤y ∧ y≤1 ∧ ψ*y=(1-m)*(1-a)*E.P x*(b+reputation E a x y)1112def failure (E : Economy R) (a x y : R) := 1-(a+(1-a)*y)*E.P x13def mass (E : Economy R) (x : R) := E.H x-E.β1415theorem bayesEffort (E : Economy R) (a x y : R) (ha : 0<a ∧ a<1) (hx : 0≤x)16    (hy : 0≤y ∧ y≤1) : 0<failure E a x y ∧ 0<reputation E a x y ∧17      reputation E a x y<1 ∧ failure E a x y*reputation E a x y=mass E x := by18  let z := a+(1-a)*y19  have t := OrderedRing.mul_nonneg (show 0≤1-a by grind) hy.120  have u := OrderedRing.mul_le_mul_of_nonneg_left hy.2 (show 0≤1-a by grind)21  have zp : 0<z := by dsimp [z]; grind22  have z1 : z≤1 := by dsimp [z]; grind23  have p := E.probabilities x hx24  have pp := OrderedRing.mul_le_mul_of_nonneg_right z1 (le_of_lt p.1)25  obtain ⟨B,G,top⟩ := E.tech x hx26  have r := spreadBounds E.β (E.G x) (E.B x) z E.prior.1 E.prior.2 B G top zp z127  have w := (bayesCancellation E.β (E.G x) (E.B x) z E.prior.1 E.prior.2 B G top zp z1).228  have ⟨avg,unit⟩ := E.cancellation x hx29  dsimp [Economy.rho] at unit30  change (1-z*E.P x)*reputation E a x y=E.β*(1-E.β)*(E.G x-E.B x)/E.P x at w31  change 0<1-z*E.P x ∧ _; dsimp [failure,mass]32  exact ⟨by grind,r.1,r.2,by change (1-z*E.P x)*reputation E a x y=E.H x-E.β; grind⟩3334private def polynomial (E : Economy R) (a m ψ b x y : R) :=35  (ψ*y-(1-m)*(1-a)*E.P x*b)*failure E a x y-(1-m)*(1-a)*E.P x*mass E x3637private theorem rootEq (E : Economy R) (a m ψ b x y : R) (ha : 0<a ∧ a<1) (hx : 0≤x)38    (hy : 0≤y ∧ y≤1) :39    Response E a m ψ b x y ↔ polynomial E a m ψ b x y=0 := by40  obtain ⟨pos,_,_,rep⟩ := bayesEffort E a x y ha hx hy41  let k := (1-m)*(1-a)*E.P x42  have eq := congrArg (fun t => k*t) rep43  change (0≤y ∧ y≤1 ∧ ψ*y=k*(b+reputation E a x y)) ↔44    (ψ*y-k*b)*failure E a x y-k*mass E x=045  constructor46  · intro ⟨_,_,h⟩47    have z := congrArg (fun t => t*failure E a x y) h48    grind49  · intro h50    refine ⟨hy.1,hy.2,?_⟩51    apply le_antisymm <;> apply (Field.IsOrdered.mul_le_mul_iff_of_pos_right pos).mp <;> grind5253private theorem quadraticContinuous (E : Economy R) (a m ψ b x : R) :54    ContinuousSupport (polynomial E a m ψ b x) := by55  let v := (1-a)*E.P x56  let k := (1-m)*v57  let u := 1-a*E.P x58  let f := fun y => (-ψ*v)*(y*y)+(ψ*u+k*b*v)*y+(-k*b*u-k*mass E x)59  have eqn : f=polynomial E a m ψ b x := by60    funext y; dsimp [f,v,k,u,polynomial,failure]; grind61  rw [← eqn]62  apply continuousOfDerivatives63  intro y _64  exact ⟨_,affineSlope _ _ _ (mulSlope (identitySlope y) (identitySlope y)) (identitySlope y)⟩6566theorem smallResponse (E : Economy R) (a m ψ b x y : R)67    (ha : 0<a ∧ a<1) (hm : 0<m ∧ m<1) (hx : 0≤x) (hb : 0≤b ∧ b<E.X-E.L)68    (big : 4*(E.X-E.L+1)<ψ) (I : Response E a m ψ b x y) : 4*y<1 := by69  obtain ⟨lo,hi,root⟩ := I70  have p := E.probabilities x hx71  have ⟨_,rp,r1,_⟩ := bayesEffort E a x y ha hx ⟨lo,hi⟩72  have v0 := OrderedRing.mul_pos (show 0<1-a by grind) p.173  have v1 := OrderedRing.mul_lt_mul_of_pos_right (show 1-a<1 by grind) p.174  have k1 := OrderedRing.mul_lt_mul_of_pos_right (show 1-m<1 by grind) v075  have h := OrderedRing.mul_lt_mul_of_pos_right (show (1-m)*(1-a)*E.P x<1 by grind)76    (show 0<b+reputation E a x y by grind)77  have H : ψ*y<E.X-E.L+1 := by grind78  apply (Field.IsOrdered.mul_lt_mul_iff_of_pos_left (show 0<ψ by have := E.cash; grind)).mp79  grind8081private theorem responseExists (E : Economy R) (complete : CompleteSupport R)82    (a m ψ b x : R) (ha : 0<a ∧ a<1) (hm : 0<m ∧ m<1) (hx : 0≤x)83    (hb : 0≤b ∧ b<E.X-E.L) (big : 4*(E.X-E.L+1)<ψ) : ∃ y, Response E a m ψ b x y := by84  let cap : R := 1/485  have ce : cap*4=1 := Field.div_mul_cancel (by grind)86  have cp : 0<cap := by grind87  let k := (1-m)*(1-a)*E.P x88  have p := E.probabilities x hx89  have α : 0<1-a := by grind90  have c : 0<1-m := by grind91  have kp : 0<k := OrderedRing.mul_pos (OrderedRing.mul_pos c α) p.192  have v := OrderedRing.mul_lt_mul_of_pos_right (show 1-a<1 by grind) p.193  have v0 := OrderedRing.mul_pos α p.194  have k' := OrderedRing.mul_lt_mul_of_pos_right (show 1-m<1 by grind) v095  have k1 : k<1 := by dsimp [k]; grind96  have sign (y : R) (y0 : 0≤y) (y1 : y≤1) :97      polynomial E a m ψ b x y=(ψ*y-k*(b+reputation E a x y))*failure E a x y := by98    have z := congrArg (fun t => k*t) (bayesEffort E a x y ha hx ⟨y0,y1⟩).2.2.299    change (ψ*y-k*b)*failure E a x y-k*mass E x=_; grind100  have z0 := bayesEffort E a x 0 ha hx ⟨by grind,by grind⟩101  have z1 := bayesEffort E a x cap ha hx ⟨le_of_lt cp,by grind⟩102  have k0 := OrderedRing.mul_pos kp (show 0<b+reputation E a x 0 by grind)103  have neg := OrderedRing.mul_lt_mul_of_pos_right (show ψ*0-k*(b+reputation E a x 0)<0 by grind) z0.1104  have kc := OrderedRing.mul_lt_mul_of_pos_right k1 (show 0<b+reputation E a x cap by grind)105  have size := OrderedRing.mul_lt_mul_of_pos_right big cp106  have capId := congrArg (fun z => (E.X-E.L+1)*z) ce107  have pos := OrderedRing.mul_pos (show 0<ψ*cap-k*(b+reputation E a x cap) by grind) z1.1108  have ⟨e,l,h,root⟩ := intermediateValue (polynomial E a m ψ b x) 0 cap 0109    (by grind) cp (by rw [sign 0 (by grind) (by grind)]; grind)110    (by rw [sign cap (by grind) (by grind)]; exact pos) (quadraticContinuous E a m ψ b x) complete111  exact ⟨e,(rootEq E a m ψ b x e ha hx ⟨by grind,by grind⟩).2 root⟩112113/-- Difference of the polynomial at two candidate efforts under the same114support. This coefficient also supplies an explicit bound away from zero. -/115private def coefficient (E : Economy R) (a m ψ b x y z : R) : R :=116  ψ*(1-a*E.P x-(1-a)*E.P x*(y+z))+(1-m)*((1-a)*E.P x)*b*((1-a)*E.P x)117118private theorem coefficientBound (E : Economy R) (a m ψ b x y z : R)119    (ha : 0<a ∧ a<1) (hm : m<1) (hp : 0<ψ) (bh : 0≤b) (hx : 0≤x)120    (ys : 4*y<1) (zs : 4*z<1) :121    (ψ*(1-a))/2 ≤ coefficient E a m ψ b x y z := by122  have p := E.probabilities x hx123  let v := (1-a)*E.P x124  have vp : 0<v := OrderedRing.mul_pos (by grind) p.1125  have one := OrderedRing.mul_lt_mul_of_pos_left p.2.1 (show 0<a by grind)126  have two := OrderedRing.mul_lt_mul_of_pos_left p.2.1 (show 0<1-a by grind)127  have half := OrderedRing.mul_lt_mul_of_pos_left (show 2*(y+z)<1 by grind) vp128  have h : 1-a<2*(1-a*E.P x-v*(y+z)) := by dsimp [v] at *; grind129  have S := OrderedRing.mul_lt_mul_of_pos_left h hp130  have b := OrderedRing.mul_nonneg (OrderedRing.mul_nonneg (OrderedRing.mul_nonneg131    (show 0≤1-m by grind) (le_of_lt vp)) bh) (le_of_lt vp)132  have id := Field.div_mul_cancel (x := ψ*(1-a)) (show (2:R)≠0 by grind)133  change _ ≤ ψ*(1-a*E.P x-v*(y+z))+(1-m)*v*_ *v134  grind135136omit [IsLinearOrder R] [LawfulOrderLT R] [OrderedRing R] in137private theorem polynomialDiff (E : Economy R) (a m ψ b x y z : R) :138    polynomial E a m ψ b x y-polynomial E a m ψ b x z=(y-z)*coefficient E a m ψ b x y z := by139  dsimp [polynomial,coefficient,failure]; grind140141/-- For an affordable fixed bonus there is a unique response. This auxiliary142fact uses only the small-effort region and holds on the entire support domain. -/143private theorem responseUnique (E : Economy R) (a m ψ b x y z : R)144    (ha : 0<a ∧ a<1) (hm : 0<m ∧ m<1) (hx : 0≤x) (hb : 0≤b ∧ b<E.X-E.L)145    (big : 4*(E.X-E.L+1)<ψ) (I : Response E a m ψ b x y) (J : Response E a m ψ b x z) : y=z := by146  have hp : 0<ψ := by have := E.cash; grind147  have pos := OrderedRing.mul_pos hp (show 0<1-a by grind)148  have sz := Field.div_mul_cancel (x := ψ*(1-a)) (show (2:R)≠0 by grind)149  have bnd := coefficientBound E a m ψ b x y z ha hm.2 hp hb.1 hx150    (smallResponse E a m ψ b x y ha hm hx hb big I) (smallResponse E a m ψ b x z ha hm hx hb big J)151  have D : 0<coefficient E a m ψ b x y z := by grind152  have A := (rootEq E a m ψ b x y ha hx ⟨I.1,I.2.1⟩).1 I153  have B := (rootEq E a m ψ b x z ha hx ⟨J.1,J.2.1⟩).1 J154  have C := polynomialDiff E a m ψ b x y z155  apply le_antisymm <;> apply (Field.IsOrdered.mul_le_mul_iff_of_pos_right D).mp <;> grind156157theorem linearSlope {f : R → R} {s d : R} (a b : R) (D : HasSlopeAt f s d) :158    HasSlopeAt (fun x => a*f x+b) s (a*d) := by159  simpa only [Semiring.zero_mul,Semiring.add_zero] using affineSlope a 0 b D D160161private theorem linearLimit {f : R → R} {s p : R} (a b : R) (L : Tends s f p) :162    Tends s (fun x => a*f x+b) (a*p+b) := by163  simpa only [Semiring.zero_mul,Semiring.add_zero] using affineLimit a 0 b L L164165/-- Support changes the effort equation at a fixed target e. The slope of its166rightward shift is strictly positive under the local complementarity condition. -/167private theorem driveSlope (E : Economy R) (s a m ψ b e : R)168    (ha : 0<a ∧ a<1) (hm : 0<m ∧ m<1) (hs : 0≤s) (hb : 0≤b)169    (I : Response E a m ψ b s e) (comp : E.G s*E.dB s<E.B s*E.dG s) :170    ∃ d, 0<d ∧ HasSlopeAt (fun x => -polynomial E a m ψ b x e) s d ∧171      ∃ p', 0<p' ∧ HasSlopeAt E.P s p' := by172  obtain ⟨G,B,_⟩ := E.slopes s hs173  obtain ⟨g',b'⟩ := E.production s hs174  obtain ⟨h',_,H,_,_,_,_,Hpos,_,_⟩ := posteriorDerivatives E.G E.B E.β s _ _ E.prior175    (E.tech s hs) G B b' comp176  change HasSlopeAt E.H s h' at H177  let p' := E.β*E.dG s+(1-E.β)*E.dB s178  have Pd : HasSlopeAt E.P s p' := by179    change HasSlopeAt (fun x => E.β*E.G x+(1-E.β)*E.B x) s _180    simpa only [Semiring.add_zero] using affineSlope E.β (1-E.β) 0 G B181  have x1 := OrderedRing.mul_pos E.prior.1 g'182  have x2 := OrderedRing.mul_pos (show 0<1-E.β by have := E.prior; grind) b'183  have ppos : 0<p' := by dsimp [p']; grind184  let t := (1-m)*(1-a)185  let z := a+(1-a)*e186  have Kd : HasSlopeAt (mass E) s h' := by187    have eq : (fun x => (1:R)*E.H x+(-E.β))=mass E := by funext x; dsimp [mass]; grind188    rw [← eq]; simpa only [Semiring.one_mul] using linearSlope 1 (-E.β) H189  let k := fun x => t*E.P x190  have kd : HasSlopeAt k s (t*p') := by simpa only [Semiring.add_zero] using linearSlope t 0 Pd191  let A := fun x => (b*t)*E.P x+(-(ψ*e))192  have Ad : HasSlopeAt A s ((b*t)*p') := linearSlope _ _ Pd193  have fd : HasSlopeAt (fun x => failure E a x e) s ((-z)*p') := by194    have eq : (fun x => (-z)*E.P x+1)=(fun x => failure E a x e) := by funext x; dsimp [failure,z]; grind195    rw [← eq]; exact linearSlope _ _ Pd196  have Der := affineSlope 1 1 0 (mulSlope Ad fd) (mulSlope kd Kd)197  let d := (b*t)*p'*failure E a s e + A s*((-z)*p') + (t*p'*mass E s + k s*h')198  have eq : (fun x => 1*(A x*failure E a x e)+1*(k x*mass E x)+0) =199      (fun x => -polynomial E a m ψ b x e) := by200    funext x; dsimp [A,k,t,polynomial]; grind201  rw [eq] at Der202  have deriv : HasSlopeAt (fun x => -polynomial E a m ψ b x e) s d := by203    simpa only [Semiring.one_mul,Semiring.add_zero,Semiring.mul_zero] using Der204  have tpos : 0<t := OrderedRing.mul_pos (by grind) (by grind)205  have p := E.probabilities s hs206  have kp : 0<k s := OrderedRing.mul_pos tpos p.1207  have ⟨fp,rp,_,wt⟩ := bayesEffort E a s e ha hs ⟨I.1,I.2.1⟩208  have Kpos : 0<mass E s := by rw [← wt]; exact OrderedRing.mul_pos fp rp209  have root := I.2.2210  change ψ*e=k s*(b+reputation E a s e) at root211  have gap := OrderedRing.mul_pos kp rp212  have aS : A s<0 := by dsimp [A,k] at *; grind213  have zpos : 0<z := by have := OrderedRing.mul_nonneg (show 0≤1-a by grind) I.1; dsimp [z]; grind214  have dh1 := OrderedRing.mul_nonneg (OrderedRing.mul_nonneg (OrderedRing.mul_nonneg hb (le_of_lt tpos))215    (le_of_lt ppos)) (le_of_lt fp)216  have dh2 := OrderedRing.mul_pos (a := -(A s)) (by grind) (OrderedRing.mul_pos zpos ppos)217  have dh3 := OrderedRing.mul_pos (OrderedRing.mul_pos tpos ppos) Kpos218  have dh4 := OrderedRing.mul_pos kp Hpos219  exact ⟨d,by dsimp [d]; grind,deriv,p',ppos,Pd⟩220221/-- Existence, uniqueness and derivative of the equilibrium response with the222high bonus held fixed, including the right derivative at zero support. -/223theorem fixedBonusResponse (E : Economy R) (complete : CompleteSupport R) (a m ψ b : R)224    (ha : 0<a ∧ a<1) (hm : 0<m ∧ m<1) (hb : 0≤b ∧ b<E.X-E.L)225    (big : 4*(E.X-E.L+1)<ψ) :226    ∃ Y : R → R,227      (∀ x, 0≤x → ∀ y, Response E a m ψ b x y ↔ y=Y x) ∧228      ∀ s, 0≤s → E.G s*E.dB s<E.B s*E.dG s → ∃ d, 0<d ∧ HasSlopeAt Y s d := by229  classical230  let Y (x : R) := if hx : 0≤x then Classical.choose (responseExists E complete a m ψ b x ha hm hx hb big) else 0231  have I (x : R) (hx : 0≤x) : Response E a m ψ b x (Y x) := by232    simpa only [Y,dite_eq_left hx] using Classical.choose_spec (responseExists E complete a m ψ b x ha hm hx hb big)233  refine ⟨Y,?_,?_⟩234  · intro x hx y235    exact ⟨fun h => responseUnique E a m ψ b x y (Y x) ha hm hx hb big h (I x hx),236      fun eq => eq ▸ I x hx⟩237  intro s hs comp238  let e := Y s239  let A := fun x => -polynomial E a m ψ b x e240  let D := fun x => coefficient E a m ψ b x (Y x) e241  have Is := I s hs242  have hp : 0<ψ := by have := E.cash; grind243  have half := Field.div_mul_cancel (x := ψ*(1-a)) (show (2:R)≠0 by grind)244  have δpos : 0<ψ*(1-a)/2 := by have := OrderedRing.mul_pos hp (show 0<1-a by grind); grind245  have bound (x : R) (hx : 0≤x) : ψ*(1-a)/2≤D x :=246    coefficientBound E a m ψ b x (Y x) e ha hm.2 hp hb.1 hx247      (smallResponse E a m ψ b x _ ha hm hx hb big (I x hx))248      (smallResponse E a m ψ b s _ ha hm hs hb big Is)249  have roots (x : R) (hx : 0≤x) := (rootEq E a m ψ b x (Y x) ha hx ⟨(I x hx).1,(I x hx).2.1⟩).1 (I x hx)250  have eq (x : R) (hx : 0≤x) : (Y x-Y s)*D x=A x-A s := by251    have F := polynomialDiff E a m ψ b x (Y x) e252    have z := roots x hx253    have w : polynomial E a m ψ b s e=0 := roots s hs254    change (Y x-e)*coefficient E a m ψ b x (Y x) e= -polynomial E a m ψ b x e-(-polynomial E a m ψ b s e)255    grind256  obtain ⟨d,dp,Ad,_,_,Pd⟩ := driveSlope E s a m ψ b e ha hm hs hb.1 Is comp257  have Ylim := implicitLimit Ad δpos bound eq258  have Plim := slopeLimit Pd259  have py := mulLimit Plim Ylim260  have pp := mulLimit Plim Plim261  let l := -ψ*(a+(1-a)*e)262  let q := (1-m)*(1-a)*(1-a)*b263  let n := -ψ*(1-a)264  have lim := affineLimit 1 q 0 (affineLimit l n ψ Plim py) pp265  have Deq : (fun x => 1*(l*E.P x+n*(E.P x*Y x)+ψ)+q*(E.P x*E.P x)+0)=D := by266    funext x; dsimp [D,coefficient,l,q,n]; grind267  have de := congrFun Deq s268  rw [Deq,de] at lim269  have Dp (x : R) (hx : 0≤x) : 0<D x := lt_of_lt_of_le δpos (bound x hx)270  refine ⟨d/D s,?_,implicitSlope Ad lim (Dp s hs) Dp eq⟩271  have mul := Field.div_mul_cancel (x := d) (show D s≠0 by have := Dp s hs; grind)272  apply (Field.IsOrdered.mul_lt_mul_iff_of_pos_right (Dp s hs)).mp; grind273274/-- Lemma 2: at fixed support, controls and production floor, sufficiently275large effort costs implement a unique optimal bonus and effort. The final276clause differentiates the fixed-bonus response under local complementarity. -/277theorem contractAndEffort (E : Economy R) (complete : CompleteSupport R) (s a m : R)278    (hs : 0≤s) (ha : 0<a ∧ a<1) (hm : 0<m ∧ m<1) :279    ∃ cutoff, 0<cutoff ∧ ∀ ψ, cutoff≤ψ → ∃ (e b : R) (Y : R → R),280      Optimal (reputation E a s) (a*E.P s) ((1-a)*E.P s) (E.X-E.L) m ψ e b ∧281      Y s=e ∧ (∀ x, 0≤x → ∀ y, Response E a m ψ b x y ↔ y=Y x) ∧282      (E.G s*E.dB s<E.B s*E.dG s → ∃ d, 0<d ∧ HasSlopeAt Y s d) := by283  obtain ⟨t,tp,h⟩ := optimalContractAtSupport E complete s a m hs ha hm284  let cutoff := t+4*(E.X-E.L+1)285  have c := E.cash286  refine ⟨cutoff,by dsimp [cutoff]; grind,?_⟩287  intro ψ size288  obtain ⟨e,b,O⟩ := h ψ (by dsimp [cutoff] at size; grind)289  have I : Response E a m ψ b s e := ⟨le_of_lt O.1,le_of_lt O.2.1,by have := O.2.2.2.2.1; grind⟩290  obtain ⟨Y,Rp,S⟩ := fixedBonusResponse E complete a m ψ b ha hm ⟨O.2.2.1,O.2.2.2.1⟩291    (by dsimp [cutoff] at size; grind)292  exact ⟨e,b,Y,O,((Rp s hs e).1 I).symm,Rp,S s hs⟩293end EffortContract