lemmarawBinaryRep_exact {h n : ℕ} (hh : 4≤h) (P : Table (ι:=ι)) {v : ι →ℕ} {S : Schedule (2^h)}
(hP : P.Represents v S) {H size QWXYZ : Formula ι} (w x y z : Raw h)
(hH : H.eval v=h) (hs : size.eval v=n) (hQ : Q.eval v=2^h)
(hW : W.eval v=natCode w) (hX : X.eval v=natCode x) (hY : Y.eval v=natCode y) (hZ : Z.eval v=natCode z) :
(rawBinaryRep PH size QWXYZ).eval v≠0↔Codec.replacement (by omega) S n [w,x] [y,z] :=by
proof · 14
lines
have hw := valid_value (show0<h by omega) w hH hW
have hx := valid_value (show0<h by omega) x hH hX
have hy := valid_value (show0<h by omega) y hH hY
have hz := valid_value (show0<h by omega) z hH hZ
cases hdw : decode (show0<h by omega) w <;> cases hdx : decode (show0<h by omega) x <;>
cases hdy : decode (show0<h by omega) y <;> cases hdz : decode (show0<h by omega) z
all_goals try simp [rawBinaryRep,branch_value,all_eval,hw,hx,hy,hz,hdw,hdx,hdy,hdz,Codec.replacement,decodeWord]
rename_i a b c d
have ha := rawRepresents hh w hdw hH hW
have hb := rawRepresents hh x hdx hH hX
have hc := rawRepresents hh y hdy hH hY
have hd := rawRepresents hh z hdz hH hZ
simpa [rawBinaryRep,branch_value,all_eval,hw,hx,hy,hz,hdw,hdx,hdy,hdz,
Codec.replacement,decodeWord] using (binaryRep_exact hh P hP hs hQ ha hb hc hd)
| .read i => .read i
| .constant a => .constant a
| .add x y => .add x.totalize y.totalize
| .sub x y => .branch (.le y.totalize x.totalize) (.sub x.totalize y.totalize) (.constant 0)
| .mul x y => .mul x.totalize y.totalize
| .div x y => .branch (.le (.constant 1) y.totalize) (.div x.totalize y.totalize) (.constant 0)
| .mod x y => .branch (.le (.constant 1) y.totalize) (.mod x.totalize y.totalize) x.totalize
| .le x y => .le x.totalize y.totalize
| .powTwo x => .powTwo x.totalize
| .bitLength x => .bitLength x.totalize
| .branch c a b => .branch (.le (.constant 1) c.totalize) a.totalize b.totalize
@[simp]theoremtotalize_eval (e : Formula ι) (v : ι →ℕ) : e.totalize.eval v=e.eval v :=by
proof · 24
lines
induction e with
| read i => rfl
| constant a => rfl
| add x y hx hy => simp [totalize,eval,hx,hy]
| sub x y hx hy =>by_cases h : y.eval v≤x.eval v
· simp [totalize,eval,hx,hy,h]
· simp [totalize,eval,hx,hy,h,Nat.sub_eq_zero_of_le (show x.eval v≤y.eval v by omega)]
| mul x y hx hy => simp [totalize,eval,hx,hy]
| div x y hx hy =>by_cases h : y.eval v=0
· simp [totalize,eval,hy,h]
· simp [totalize,eval,hx,hy,show1≤y.eval v by omega]
| mod x y hx hy =>by_cases h : y.eval v=0
· simp [totalize,eval,hx,hy,h]
· simp [totalize,eval,hx,hy,show1≤y.eval v by omega]
| le x y hx hy => simp [totalize,eval,hx,hy]
| powTwo x hx => simp [totalize,eval,hx]
| bitLength x hx => simp [totalize,eval,hx]
| branch c a b hc ha hb =>by_cases h : c.eval v=0
· simp [totalize,eval,hc,hb,h]
· simp [totalize,eval,hc,ha,h,show1≤c.eval v by omega]
| .read _ =>True
| .constant a => a.bits.length≤n
| .add x y => x.Bounded n v ∧ y.Bounded n v ∧ x.eval v+y.eval v<2^n
| .sub x y => x.Bounded n v ∧ y.Bounded n v
| .mul x y => x.Bounded n v ∧ y.Bounded n v ∧ x.eval v*y.eval v<2^n
| .div x y | .mod x y => x.Bounded n v ∧ y.Bounded n v ∧2*y.eval v≤2^n
| .le x y => x.Bounded n v ∧ y.Bounded n v
| .powTwo x => x.Bounded n v ∧ x.eval v<n
| .bitLength x => x.Bounded n v
| .branch c a b => c.Bounded n v ∧ (if c.eval v=0then b.Bounded n v else a.Bounded n v)
lemmatotalize_safe {e : Formula ι} {n : ℕ} {v : ι →ℕ} (hn : 0<n) (he : e.Bounded n v) :
e.totalize.Safe n v :=by
proof · 47
lines
haveH0 : (Formula.constant 0 : Formula ι).Safe n v :=by change (Nat.bits 0).length≤n;simp
haveH1 : (Formula.constant 1 : Formula ι).Safe n v :=by change (Nat.bits 1).length≤n;norm_num;omega
induction e with
| read i => trivial
| constant a => exact he
| add x y hx hy => exact ⟨hx he.1,hy he.2.1,by simpa using he.2.2⟩
| sub x y hx hy =>haveHx:= hx he.1haveHy:= hy he.2
refine ⟨⟨Hy,Hx⟩,compare_boolean _ _ _,?_⟩
change (if (if y.totalize.eval v≤x.totalize.eval v then1else0)=0then _ else _)
simp only [totalize_eval]
by_cases h : y.eval v≤x.eval v
· simp only [ite_eq_left h,Nat.one_ne_zero,ite_false]
exact ⟨Hx,Hy,by simpa using h⟩
· simpa only [ite_eq_right h,ite_true] usingH0
| mul x y hx hy => exact ⟨hx he.1,hy he.2.1,by simpa using he.2.2⟩
| div x y hx hy =>haveHx:= hx he.1haveHy:= hy he.2.1
refine ⟨⟨H1,Hy⟩,compare_boolean _ _ _,?_⟩
change (if (if1≤y.totalize.eval v then1else0)=0then _ else _)
simp only [totalize_eval]
by_cases h : 1≤y.eval v
· simp only [ite_eq_left h,Nat.one_ne_zero,ite_false]
exact ⟨Hx,Hy,by rw [totalize_eval];omega,by simpa using he.2.2⟩
· simpa only [ite_eq_right h,ite_true] usingH0
| mod x y hx hy =>haveHx:= hx he.1haveHy:= hy he.2.1
refine ⟨⟨H1,Hy⟩,compare_boolean _ _ _,?_⟩
change (if (if1≤y.totalize.eval v then1else0)=0then _ else _)
simp only [totalize_eval]
by_cases h : 1≤y.eval v
· simp only [ite_eq_left h,Nat.one_ne_zero,ite_false]
exact ⟨Hx,Hy,by rw [totalize_eval];omega,by simpa using he.2.2⟩
· simpa only [ite_eq_right h,ite_true] usingHx
| le x y hx hy => exact ⟨hx he.1,hy he.2⟩
| powTwo x hx => exact ⟨hx he.1,by simpa using he.2⟩
| bitLength x hx => exact hx he
| branch c a b hc ha hb =>
refine ⟨⟨H1,hc he.1⟩,compare_boolean _ _ _,?_⟩
change (if (if1≤c.totalize.eval v then1else0)=0then _ else _)
simp only [totalize_eval]
by_cases h : c.eval v=0
· simpa [h] using hb (by simpa only [h,ite_true] using he.2)
· simpa only [ite_eq_left (show1≤c.eval v by omega),Nat.one_ne_zero,ite_false] using ha (by simpa only [ite_eq_right h] using he.2)
lemmabounded_mono {e : Formula ι} {m n : ℕ} {v : ι →ℕ} (hmn : m≤n) (he : e.Bounded m v) :
e.Bounded n v :=by
proof · 17
lines
havehp : 2^m≤2^n :=Nat.pow_le_pow_right (by omega) hmn
induction e with
| read i => trivial
| constant a => exact he.trans hmn
| add x y hx hy => exact ⟨hx he.1,hy he.2.1,he.2.2.trans_le hp⟩
| sub x y hx hy => exact ⟨hx he.1,hy he.2⟩
| mul x y hx hy => exact ⟨hx he.1,hy he.2.1,he.2.2.trans_le hp⟩
| div x y hx hy => exact ⟨hx he.1,hy he.2.1,he.2.2.trans hp⟩
| mod x y hx hy => exact ⟨hx he.1,hy he.2.1,he.2.2.trans hp⟩
| le x y hx hy => exact ⟨hx he.1,hy he.2⟩
| powTwo x hx => exact ⟨hx he.1,he.2.trans_le hmn⟩
| bitLength x hx => exact hx he
| branch c a b hc ha hb =>
refine ⟨hc he.1,?_⟩
by_cases h : c.eval v=0
· simpa only [h,ite_true] using hb (by simpa only [h,ite_true] using he.2)
· simpa only [ite_eq_right h] using ha (by simpa only [ite_eq_right h] using he.2)
| .read _ | .constant _ =>True
| .add x y | .sub x y | .mul x y | .div x y | .mod x y | .le x y => x.ExponentsM v ∧ y.ExponentsM v
| .powTwo x => x.ExponentsM v ∧ x.eval v≤M
| .bitLength x => x.ExponentsM v
| .branch c a b => c.ExponentsM v ∧ (if c.eval v=0then b.ExponentsM v else a.ExponentsM v)
| .read _ =>1
| .constant a => a.size+1
| .add x y | .sub x y | .mul x y | .div x y | .mod x y | .le x y => x.weight+y.weight+2
| .powTwo x | .bitLength x => x.weight+2
| .branch c a b => c.weight+a.weight+b.weight+2
theoremtimed_total (base : ι) (e : Formula ι) :
∃D : Realizer e.totalize.eval (fun n v => e.totalize.Safe n v),
∀M xs,(∀i,(xs i).length=e.weight*(M+1)) →
(∀i,values xs i<2^(M+1)) → e.ExponentsM (values xs) →∃t y,t≤D.coefficient*(e.weight*(M+1)+1)^2∧ y.length=e.weight*(M+1) ∧Binary.Add.value y.reverse=e.eval (values xs) ∧RunD.program (input xs) t (result xs D.out y) :=by
proof · 5
lines
refine ⟨compile base e.totalize,?_⟩
intro M xs hl hv he
have hB := (bounded_of_exponents e M (values xs) hv he).1
obtain ⟨t,y,ht,hy,hv',hr⟩ := (compile base e.totalize).spec _ (width_pos e M) xs hl (totalize_safe (width_pos e M) hB)
exact ⟨t,y,ht,hy,by simpa using hv',hr⟩
lemmaexponents_and {a b : Formula ι} (ha : a.ExponentsM v) (hb : b.ExponentsM v) :
(and a b).ExponentsM v := exponents_branch ha hb (exponents_constant 0)
lemmaexponents_or {a b : Formula ι} (ha : a.ExponentsM v) (hb : b.ExponentsM v) :
(or a b).ExponentsM v := exponents_branch ha (exponents_constant 1) hb
lemmaexponents_implies {a b : Formula ι} (ha : a.ExponentsM v) (hb : b.ExponentsM v) :
(implies a b).ExponentsM v := exponents_branch ha hb (exponents_constant 1)
lemmaexponents_all {es : List (Formula ι)} (H : ∀e∈es,e.ExponentsM v) : (all es).ExponentsM v :=by
proof · 3
lines
induction es with
| nil => exact exponents_constant 1
| cons e es ih => exact exponents_and (H e (by simp)) (ih (by intro a ha;exact H a (by simp [ha])))
lemmaexponents_any {es : List (Formula ι)} (H : ∀e∈es,e.ExponentsM v) : (any es).ExponentsM v :=by
proof · 3
lines
induction es with
| nil => exact exponents_constant 0
| cons e es ih => exact exponents_or (H e (by simp)) (ih (by intro a ha;exact H a (by simp [ha])))
lemmaexponents_bind (e : Formula κ) (f : κ →Formula ι)
(hf : ∀i,(f i).ExponentsM v) (he : e.ExponentsM (fun i => (f i).eval v)) :
(e.bind f).ExponentsM v :=by
proof · 12
lines
induction e with
| read i => exact hf i
| constant a => trivial
| add a b ha hb | sub a b ha hb | mul a b ha hb | div a b ha hb | mod a b ha hb | le a b ha hb => exact ⟨ha he.1,hb he.2⟩
| powTwo a ha => exact ⟨ha he.1,by simpa only [bind_eval] using he.2⟩
| bitLength a ha => exact ha he
| branch c a b hc ha hb =>
refine ⟨hc he.1,?_⟩
simp only [bind_eval]
split <;> rename_i h
· exact hb (by simpa only [ite_eq_left h] using he.2)
· exact ha (by simpa only [ite_eq_right h] using he.2)
lemmadata_exponents {s b p : Formula ι} (hs : s.ExponentsM v) (hb : b.ExponentsM v) (hp : p.ExponentsM v) :
Exponents (data s b p) M v :=by intro i;fin_cases i <;> simp [data,hs,hb,hp]
lemmachoose_exponents {c : Formula ι} {a b : Expr (ι:=ι)}
(hc : c.ExponentsM v) (ha : c.eval v≠0→ a.ExponentsM v) (hb : c.eval v=0→ b.ExponentsM v) :
(choose c a b).ExponentsM v :=by
proof · 11
lines
by_cases h : c.eval v=0
· have hb := hb h
refine ⟨⟨hc,?_⟩,?_,⟨hc,?_⟩⟩
· simpa only [ite_eq_left h] using hb.1
· intro i;exact ⟨hc,by simpa only [ite_eq_left h] using hb.2.1 i⟩
· simpa only [ite_eq_left h] using hb.2.2
· have ha := ha h
refine ⟨⟨hc,?_⟩,?_,⟨hc,?_⟩⟩
· simpa only [ite_eq_right h] using ha.1
· intro i;exact ⟨hc,by simpa only [ite_eq_right h] using ha.2.1 i⟩
· simpa only [ite_eq_right h] using ha.2.2
lemmaPiece.append_exponents {a b : Piece (ι:=ι)} (ha : a.ExponentsM v) (hb : b.ExponentsM v) :
(a.append b).ExponentsM v :=by
proof · 12
lines
refine ⟨⟨ha.1,hb.1⟩,?_⟩
intro i hi hiv
apply choose_exponents (exponents_less hi ha.1)
· intro H
apply ha.2 i hi
simpa usingH
· intro H
apply hb.2 (.sub i a.length) ⟨hi,ha.1⟩
haveH' : ¬i.eval v<a.length.eval v :=by simpa usingH
change i.eval v-a.length.eval v<b.length.eval v
change i.eval v<a.length.eval v+b.length.eval v at hiv
omega
lemmasetChecker_exponents {a : Expr (ι:=ι)} {tag i : Formula ι}
(ha : Exponents a M v) (ht : tag.ExponentsM v) (hi : i.ExponentsM v) : Exponents (setChecker a tag i) M v :=by
lemmapair_exponents {a b : Expr (ι:=ι)} {Q : Formula ι}
(ha : Exponents a M v) (hb : Exponents b M v) (hQ : Q.ExponentsM v) :
(pair a b Q).ExponentsM v :=by
lemmaunaryZero_exponents {a : Expr (ι:=ι)} {size count truth : Formula ι}
(ha : Exponents a M v) (hs : size.ExponentsM v) (hc : count.ExponentsM v) (ht : truth.ExponentsM v) :
(unaryZero a size count truth).ExponentsM v :=by
proof · 3
lines
have hf := formats_exponents ha hs hc
simp [unaryZero,semanticZero,passedOwn,isPalette,checkerPassed,hasMarker,hasPhase,regZero,
Formula.or,Formula.and,any,all,neg,equal,Formula.Exponents,ha.1,ha.2,hf,ht]
lemmabinaryZero_exponents {a b : Expr (ι:=ι)} {Q : Formula ι}
(ha : Exponents a M v) (hb : Exponents b M v) (hQ : Q.ExponentsM v) :
(binaryZero a b Q).ExponentsM v :=by
proof · 3
lines
have hp := pair_exponents ha hb hQ
simp [binaryZero,duplicate,missing,checkerHead,isPalette,isStop,
Formula.or,Formula.and,any,all,neg,equal,Formula.Exponents,ha.1,hb.1,hp]
lemmareadAt_exponents {a : Expr (ι:=ι)} {c : CellFormula.Expr (ι:=ι)}
(ha : Exponents a M v) (hc : CellFormula.Exponents c M v) : (readAt a c).ExponentsM v :=by
proof · 2
lines
haveha' : ∀i,(a i).ExponentsM v := ha
simp [readAt,CellFormula.isCore,all,Formula.and,equal,Formula.Exponents,ha',hc.1,hc.2]
lemmadelta_exponents {a : Expr (ι:=ι)} {c : CellFormula.Expr (ι:=ι)} (ha : a.ExponentsM v)
(hc : CellFormula.Exponents c M v) (i : Fin3) : (delta a c i).ExponentsM v :=
lemmalookup_exponents {i : Formula ι} {f : Expr (ι:=ι)} {xs : List (Expr (ι:=ι))}
(hi : i.ExponentsM v) (hf : f.ExponentsM v) (hx : ∀x∈xs,x.ExponentsM v) (n : ℕ) :
(lookup i f n xs).ExponentsM v :=by
proof · 5
lines
induction xs generalizing n with
| nil => exact hf
| cons x xs ih =>
exact choose_exponents (exponents_equal hi (exponents_constant n)) (hx x (by simp))
(ih (by intro x h;exact hx x (by simp [h])) (n+1))
lemmaequalReading_exponents {a b : ReadingExpr (ι:=ι)} {k : Formula ι}
(ha : a.ExponentsM v) (hb : b.ExponentsM v) (hk : k.ExponentsM v) : (equalReading a b k).ExponentsM v :=by
proof · 2
lines
apply choose_exponents (exponents_equal hk (exponents_constant 0)) <;> apply make_exponents <;> intro i <;> fin_cases i
all_goals first | exact ha | exact hb
lemmainitialData_exponents {a : ReadingExpr (ι:=ι)} {p : AddressFormula.Expr (ι:=ι)} {n k : Formula ι}
(ha : a.ExponentsM v) (hp : AddressFormula.Exponents p M v) (hn : n.ExponentsM v) (hk : k.ExponentsM v) :
(initialData a p n k).ExponentsM v :=by
proof · 4
lines
apply choose_exponents hn
· apply choose_exponents (exponents_equal hk (exponents_constant 0)) <;> apply make_exponents <;> intro i <;> fin_cases i
all_goals first | exact ha | exact addressReading_exponents hp
· exact equalReading_exponents ha (addressReading_exponents hp) hk
lemmawire_exponents {n : ℕ} {a : Fin n →AddressFormula.Expr (ι:=ι)}
(ha : ∀i,AddressFormula.Exponents (a i) M v) (w : Tableau.Wire n) : (wire a w).ExponentsM v :=by
proof · 3
lines
cases w with
| inl b => exact fixedReading_exponents trivial
| inr i => exact addressReading_exponents (ha i)
lemmacircuitClause_exponents {n : ℕ} {a : Fin n →AddressFormula.Expr (ι:=ι)}
(ha : ∀i,AddressFormula.Exponents (a i) M v) (C : Tableau.Circuit.Clause n) : (circuitClause a C).ExponentsM v :=
proof · 1
line
make_exponents C.truth (fun _ => wire_exponents ha _)
lemmaskeletonPair_exponents {a b : Expr (ι:=ι)} {Q : Formula ι}
(ha : Exponents a M v) (hb : Exponents b M v) (hQ : Q.ExponentsM v) :
(skeletonPair a b Q).ExponentsM v :=by
lemmaunaryMove_exponents {a b : Expr (ι:=ι)} {count truth : Formula ι}
(ha : Exponents a M v) (hb : Exponents b M v)
(hc : count.ExponentsM v) (ht : truth.ExponentsM v) :
(unaryMove a b count truth).ExponentsM v :=by
proof · 9
lines
have hra := register_exponents ha
have hrb := register_exponents hb
havehz : ∀ i, (zeroReg (ι:=ι) i).ExponentsM v := zeroReg_exponents
have h0 (p : FiniteTable.Phase) := full_exponents p hb (hb.21) (exponents_constant 0) hz
have h1 (p : FiniteTable.Phase) := full_exponents p hb (hb.21) (hb.17) hrb
have h2 (p : FiniteTable.Phase) := full_exponents p hb (hb.21) (ha.17) hz
have h3 (p : FiniteTable.Phase) := full_exponents p hb (exponents_neg (hb.21)) (exponents_constant 0) hz
simp [unaryMove,all,any,Formula.and,Formula.or,equal,first,last,side,clause,
Formula.Exponents,ha,hb,ha.1,hb.1,hb.2,hc,ht,hz,h0,h1,h2,h3]
lemmabinaryMove_exponents {a b a' b' : Expr (ι:=ι)} {Q : Formula ι}
{readDelta undoDelta : Fin3→Formula ι}
(ha : Exponents a M v) (hb : Exponents b M v)
(ha' : Exponents a' M v) (hb' : Exponents b' M v) (hQ : Q.ExponentsM v)
(hr : ∀i,(readDelta i).ExponentsM v) (hu : ∀i,(undoDelta i).ExponentsM v) :
(binaryMove a b a' b' Q readDelta undoDelta).ExponentsM v :=by
proof · 18
lines
have hra := register_exponents ha
have hrb := register_exponents hb
have hread := addReg_exponents hrb hr
have hundo := addReg_exponents hra hu
have h0 (p : FiniteTable.Phase) := full_exponents p hb (hb.21) (hb.17) hrb
have h1 (p : FiniteTable.Phase) := full_exponents p ha (hb.21) (hb.17) hread
have h2 (p : FiniteTable.Phase) := full_exponents p ha (ha.21) (ha.17) hra
have h3 (p : FiniteTable.Phase) := full_exponents p hb (ha.21) (ha.17) hra
have h4 (p : FiniteTable.Phase) := full_exponents p ha (hb.21) (hb.17) hrb
have h5 (p : FiniteTable.Phase) := full_exponents p hb (ha.21) (ha.17) hundo
have hk0 := setChecker_exponents ha (exponents_constant 1) (ha.16)
have hk1 := setChecker_exponents hb (exponents_constant 2) (ha.16)
have hk2 := setChecker_exponents hb' (exponents_constant 0) (exponents_constant 0)
simp [binaryMove,acquireMove,readLeftMove,readRightMove,undoLeftMove,undoRightMove,
checkerCreateMove,checkerAdvanceMove,swapMove,all,any,Formula.and,Formula.or,equal,
side,clause,isCore,isPalette,checkerHead,checkerIdle,headFree,hasHead,hasMarker,
Formula.Exponents,ha,hb,ha',hb',ha.1,ha.2,hb.1,hb'.1,hQ,h0,h1,h2,h3,h4,h5,hk0,hk1,hk2]
all_goals simp [neg,Formula.Exponents,ha.1,hb.1]
lemmaTable.delta_exponents {P : Table (ι:=ι)} (hP : P.ExponentsM v)
{a b : CellFormula.Expr (ι:=ι)} (ha : CellFormula.Ready a M v) (hb : CellFormula.Ready b M v) (i : Fin3) :
(P.delta a b i).ExponentsM v :=
proof · 1
line
ClauseFormula.delta_exponents ((hP a ha).2 _ (hb.1.1 _)) ha.1 i
lemmaunaryRep_exponents {P : Table (ι:=ι)} {size : Formula ι} {a b : CellFormula.Expr (ι:=ι)}
(hP : P.ExponentsM v) (hs : size.ExponentsM v)
(ha : CellFormula.Ready a M v) (hb : CellFormula.Ready b M v) :
(unaryRep P size a b).ExponentsM v :=by
proof · 8
lines
apply exponents_all
simp only [List.mem_cons,List.not_mem_nil,or_false]
intro e he
rcases he with rfl|rfl|rfl
· exact CellFormula.formats_exponents ha.1 hs (hP a ha).1
· exact CellFormula.formats_exponents hb.1 hs (hP b hb).1
· exact exponents_or (CellFormula.unaryMove_exponents ha.1 hb.1 (hP b hb).1 (Table.truth_exponents hP hb))
(CellFormula.unaryMove_exponents hb.1 ha.1 (hP a ha).1 (Table.truth_exponents hP ha))
lemmabinaryRep_exponents {P : Table (ι:=ι)} {size Q : Formula ι} {a b a' b' : CellFormula.Expr (ι:=ι)}
(hP : P.ExponentsM v) (hs : size.ExponentsM v) (hQ : Q.ExponentsM v)
(ha : CellFormula.Ready a M v) (hb : CellFormula.Ready b M v)
(ha' : CellFormula.Ready a' M v) (hb' : CellFormula.Ready b' M v) :
(binaryRep P size Q a b a' b').ExponentsM v :=by
proof · 12
lines
apply exponents_all
simp only [List.mem_cons,List.not_mem_nil,or_false]
intro e he
rcases he with rfl|rfl|rfl|rfl|rfl
· exact CellFormula.formats_exponents ha.1 hs (hP a ha).1
· exact CellFormula.formats_exponents hb.1 hs (hP b hb).1
· exact CellFormula.formats_exponents ha'.1 hs (hP a' ha').1
· exact CellFormula.formats_exponents hb'.1 hs (hP b' hb').1
· exact exponents_or (CellFormula.binaryMove_exponents ha.1 hb.1 ha'.1 hb'.1 hQ
(Table.delta_exponents hP ha hb) (Table.delta_exponents hP ha ha))
(CellFormula.binaryMove_exponents ha'.1 hb'.1 ha.1 hb.1 hQ
(Table.delta_exponents hP ha' hb') (Table.delta_exponents hP ha' ha'))