Download data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/BucketProgramProducedRankFiber.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.53 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/BucketProgramProducedRankFiber.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/BucketProgramProducedRankFiber.lean
-
curl -L -o BucketProgramProducedRankFiber.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/BucketProgramProducedRankFiber.lean
2.53 kB
| import OAI.Algorithms.SubexponentialSAT.LeanCompat | |
| import OAI.Algorithms.SubexponentialSAT.SqrtLog.BucketProgramProducedRankMatrix | |
| import OAI.Algorithms.SubexponentialSAT.SqrtLog.LayoutOwnerFiberProgramBounds | |
| import OAI.Algorithms.SubexponentialSAT.SqrtLog.LayoutFiberSumProgramInterface | |
| namespace OAI.Algorithms | |
| /-! Literal equality between the runtime owner-fiber sum and an integer | |
| matrix column. Both use the original incidence order and original owner IDs. -/ | |
| namespace SubexponentialSAT.SqrtLog.BucketProgram.ProducedRank | |
| open scoped BigOperators | |
| /-- The executable fiber scanner selects exactly the matching indices. | |
| No nodup or arbitrary re-enumeration premise is needed. -/ | |
| theorem fiber_sum_ofFn {D : β} (ps : Fin D β β Γ β) (value : β β β€) | |
| (query start : β) : | |
| ((LayoutOwnerFiberProgram.fiberIndices query start (List.ofFn ps)).map value).sum= | |
| β i : Fin D,if (ps i).1=query then value (start+i.val) else 0 := by | |
| induction D generalizing start with | |
| | zero => simp [LayoutOwnerFiberProgram.fiberIndices] | |
| | succ D ih => | |
| rw [List.ofFn_succ,LayoutOwnerFiberProgram.fiberIndices,Fin.sum_univ_succ] | |
| by_cases h : (ps 0).1=query | |
| Β· simp only [h,ite_true,List.map_cons,List.sum_cons] | |
| rw [ih] | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| simp [Nat.add_left_comm,Nat.add_comm] | |
| Β· simp only [h,ite_false,zero_add] | |
| rw [ih] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| simp [Nat.add_left_comm,Nat.add_comm] | |
| /-- A physical owner-fiber result computes this exact literal matrix, even | |
| when incidence factors and variable labels are not consecutive. -/ | |
| def fiberMatrix {D n : β} (owner : Fin D β Fin n) | |
| (entry : Fin D β Fin D β β€) : Fin D β Fin n β β€ := | |
| fun j v=>β i,if owner i=v then entry j i else 0 | |
| theorem fiber_sum_eq_matrix {D n : β} (owner : Fin D β Fin n) | |
| (ps : Fin D β β Γ β) (hp : β i,(ps i).1=(owner i).val) | |
| (entry : Fin D β Fin D β β€) (value : β β β β β€) | |
| (hv : β j i,value j.val i.val=entry j i) (j : Fin D) (v : Fin n) : | |
| ((LayoutOwnerFiberProgram.fiberIndices v.val 0 (List.ofFn ps)).map (value j.val)).sum= | |
| fiberMatrix owner entry j v := by | |
| rw [fiber_sum_ofFn] | |
| unfold fiberMatrix | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| simp only [Nat.zero_add,hp,hv] | |
| have he : (owner i).val=v.val β owner i=v := Fin.ext_iff.symm | |
| simp only [he] | |
| end SubexponentialSAT.SqrtLog.BucketProgram.ProducedRank | |
| end OAI.Algorithms | |