Download data/lean/OAI/Combinatorics/EditApproximation/Geometry/ActualActionValues.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.85 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Geometry/ActualActionValues.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Geometry/ActualActionValues.lean
-
curl -L -o ActualActionValues.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/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 | |