openAI-math-dataset / lean /OAI /Combinatorics /EditApproximation /Geometry /ActualActionValues.lean
Download lean/OAI/Combinatorics/EditApproximation/Geometry/ActualActionValues.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 3.85 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Combinatorics/EditApproximation/Geometry/ActualActionValues.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Combinatorics/EditApproximation/Geometry/ActualActionValues.lean
-
curl -L -o ActualActionValues.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Combinatorics/EditApproximation/Geometry/ActualActionValues.lean
3.85 kB
| import OAI.Combinatorics.EditApproximation.Geometry.ActionLower | |
| import OAI.Combinatorics.EditApproximation.Geometry.BalancedIntervals | |
| import OAI.Combinatorics.EditApproximation.Geometry.StateGeometry | |
| import OAI.Combinatorics.EditApproximation.Definitions | |
| namespace OAI | |
| /-! | |
| # Connection values at labeled physical children | |
| Child table values retain their child labels even when two source | |
| substrings coincide. The edit and shift lower bounds are proved for | |
| the actual finite sum of these labeled values. | |
| -/ | |
| namespace EditApproximation | |
| open Finset EditDistortion | |
| noncomputable def endpointActionValue {n M : ℕ} (q : TargetInterval n) | |
| (states : Fin M → TargetInterval n) (value : Fin M → TargetInterval n → ℝ) : ℝ := | |
| endpointActionConnection q states + ∑ i, value i (states i) | |
| theorem actual_endpoint_action_lower {α : Type*} (source target : List α) | |
| {M : ℕ} (hM : 0 < M) (parent : TargetInterval source.length) | |
| (q : TargetInterval target.length) (states : Fin M → TargetInterval target.length) | |
| (a : ℝ) (ha : 1 ≤ a) (value : Fin M → TargetInterval target.length → ℝ) | |
| (hcost : ∀ i, (stateEditCost | |
| (substring source (sourceChild parent i).lo (sourceChild parent i).hi) target (states i) : ℝ) / a ≤ | |
| value i (states i)) | |
| (hgap : ∀ i, |stateLengthGap | |
| (substring source (sourceChild parent i).lo (sourceChild parent i).hi) target (states i)| ≤ | |
| value i (states i)) : | |
| max ((stateEditCost (substring source parent.lo parent.hi) target q : ℝ) / a) | |
| |stateLengthGap (substring source parent.lo parent.hi) target q| ≤ | |
| endpointActionValue q states value := by | |
| let piece := fun i : Fin M => | |
| substring source (sourceChild parent i).lo (sourceChild parent i).hi | |
| let children := List.ofFn fun i : Fin M => (piece i, states i) | |
| have hsource : (List.ofFn piece).flatten = substring source parent.lo parent.hi := | |
| sourceChild_partition source hM parent | |
| have htarget : (children.map Prod.snd) = List.ofFn states := by | |
| simp only [children, List.map_ofFn, Function.comp_def] | |
| have hchildSource : (children.map Prod.fst).flatten = substring source parent.lo parent.hi := by | |
| simpa only [children, List.map_ofFn, Function.comp_def] using hsource | |
| have hconnection := child_connection_bound target children q | |
| rw [hchildSource, htarget] at hconnection | |
| simp only [children, List.map_ofFn, List.sum_ofFn, Function.comp_def] at hconnection | |
| have hconnectionR : (stateEditCost (substring source parent.lo parent.hi) target q : ℝ) ≤ | |
| (∑ i, (stateEditCost (piece i) target (states i) : ℝ)) + endpointActionConnection q states := by | |
| exact_mod_cast hconnection | |
| have hshift := child_shift_connection_bound target children q | |
| rw [hchildSource, htarget] at hshift | |
| simp only [children, List.map_ofFn, List.sum_ofFn, Function.comp_def] at hshift | |
| have hgapSum : (∑ i, |signedLengthGap (piece i) | |
| (substring target (states i).lo (states i).hi)|) ≤ ∑ i, value i (states i) := by | |
| apply sum_le_sum | |
| intro i hi | |
| rw [← stateLengthGap_actual] | |
| exact hgap i | |
| have hcostSum : (∑ i, (stateEditCost (piece i) target (states i) : ℝ)) / a ≤ | |
| ∑ i, value i (states i) := by | |
| rw [sum_div] | |
| exact sum_le_sum (fun i _ => hcost i) | |
| have hconn0 : (0 : ℝ) ≤ endpointActionConnection q states := Nat.cast_nonneg _ | |
| have ha0 : 0 < a := by linarith | |
| have hconnDiv : (endpointActionConnection q states : ℝ) / a ≤ endpointActionConnection q states := by | |
| apply (div_le_iff₀ ha0).2 | |
| nlinarith | |
| apply max_le | |
| · have hdivide := div_le_div_of_nonneg_right hconnectionR ha0.le | |
| rw [add_div] at hdivide | |
| unfold endpointActionValue | |
| linarith | |
| · rw [stateLengthGap_actual] | |
| unfold endpointActionValue endpointActionConnection | |
| linarith | |
| end EditApproximation | |
| end OAI | |