Download data/lean/OAI/MathematicalPhysics/AlternatingFlow/Model.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.33 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/AlternatingFlow/Model.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/AlternatingFlow/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/AlternatingFlow/Model.lean
9.33 kB
| import Mathlib | |
| namespace OAI | |
| open scoped BigOperators ENNReal NNReal Topology ContDiff | |
| open MeasureTheory | |
| namespace AlternatingNS | |
| theorem neZeroThree : NeZero 3 := β¨Nat.succ_ne_zero 2β© | |
| theorem twoAtLeastTwo : Nat.AtLeastTwo 2 := β¨Nat.le_refl 2β© | |
| theorem threeAtLeastTwo : Nat.AtLeastTwo 3 := β¨Nat.le_succ 2β© | |
| theorem eightAtLeastTwo : Nat.AtLeastTwo 8 := β¨by decideβ© | |
| abbrev Rule := β Γ β Γ Fin 3 | |
| abbrev Machine := β Γ β Γ β Γ List β Γ List (Option Rule) | |
| namespace Machine | |
| def states (M : Machine) : β := M.1 + 1 | |
| def alphabet (M : Machine) : β := M.2.1 + 1 | |
| def initialState (M : Machine) : β := M.2.2.1 | |
| def haltingStates (M : Machine) : List β := M.2.2.2.1 | |
| def table (M : Machine) : List (Option Rule) := M.2.2.2.2 | |
| def instruction (M : Machine) (q a : β) : Option Rule := | |
| (M.table[q * M.alphabet + a]?).join | |
| def WellFormed (M : Machine) : Prop := | |
| M.initialState < M.states β§ | |
| (β q β M.haltingStates, q < M.states) β§ | |
| β q a r, q < M.states β a < M.alphabet β M.instruction q a = some r β | |
| r.1 < M.states β§ r.2.1 < M.alphabet | |
| def ValidInput (M : Machine) (w : List β) : Prop := | |
| β a β w, a < M.alphabet | |
| structure Configuration where | |
| state : β | |
| head : β€ | |
| tape : β€ β β | |
| def isHalting (M : Machine) (c : Configuration) : Bool := | |
| decide (c.state = M.states β¨ c.state β M.haltingStates) | |
| def initial (M : Machine) (w : List β) : Configuration where | |
| state := M.initialState | |
| head := 0 | |
| tape := fun i => if 0 β€ i then w[i.toNat]?.getD 0 else 0 | |
| def step (M : Machine) (c : Configuration) : Configuration := | |
| if M.isHalting c then c else | |
| match M.instruction c.state (c.tape c.head) with | |
| | none => { c with state := M.states } | |
| | some r => | |
| { state := r.1 | |
| head := c.head + ((r.2.2.val : β€) - 1) | |
| tape := Function.update c.tape c.head r.2.1 } | |
| def run (M : Machine) (w : List β) (n : β) : Configuration := | |
| (M.step)^[n] (M.initial w) | |
| def Halts (M : Machine) (w : List β) : Prop := | |
| β n : β, M.isHalting (M.run w n) = true | |
| end Machine | |
| abbrev Space := EuclideanSpace β (Fin 3) | |
| abbrev Field (E : Type*) := β β Space β E | |
| abbrev Velocity := Field Space | |
| abbrev Pressure := Field β | |
| abbrev MultiIndex := Fin 3 β β | |
| noncomputable section | |
| def e (i : Fin 3) : Space := EuclideanSpace.single i 1 | |
| def dx {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (i : Fin 3) (F : Field E) : Field E := | |
| fun t x => fderiv β (F t) x (e i) | |
| def dt {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (F : Field E) : Field E := | |
| fun t x => fderivWithin β (fun s => F s x) (Set.Ici 0) t 1 | |
| def spatial {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (Ξ± : MultiIndex) (F : Field E) : Field E := | |
| (dx 0)^[Ξ± 0] ((dx 1)^[Ξ± 1] ((dx 2)^[Ξ± 2] F)) | |
| def mixed {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (l : β) (Ξ± : MultiIndex) (F : Field E) : Field E := | |
| dt^[l] (spatial Ξ± F) | |
| def div (u : Velocity) (t : β) (x : Space) : β := | |
| β i : Fin 3, dx i u t x i | |
| def grad (p : Pressure) (t : β) (x : Space) : Space := | |
| (EuclideanSpace.equiv (Fin 3) β).symm (fun i => dx i p t x) | |
| def laplacian (u : Velocity) (t : β) (x : Space) : Space := | |
| β i : Fin 3, dx i (dx i u) t x | |
| def advection (u : Velocity) (t : β) (x : Space) : Space := | |
| fderiv β (u t) x (u t x) | |
| def residual (Ξ½ : β) (u : Velocity) : Velocity := | |
| fun t x => dt u t x + advection u t x - Ξ½ β’ laplacian u t x | |
| def timeCylinder (T : β) : Set (β Γ Space) := Set.Icc 0 T ΓΛ’ Set.univ | |
| def Smooth {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (F : Field E) : Prop := | |
| ContDiffOn β (β) (Function.uncurry F) (Set.Ici 0 ΓΛ’ Set.univ) | |
| def ClassicalRegularity (u : Velocity) (p : Pressure) : Prop := | |
| (β x, DifferentiableOn β (fun t => u t x) (Set.Ici 0)) β§ | |
| (β t, 0 β€ t β Differentiable β (u t)) β§ | |
| (β t, 0 β€ t β β i, Differentiable β (dx i u t)) β§ | |
| (β t, 0 β€ t β Differentiable β (p t)) β§ | |
| β T, 0 β€ T β | |
| ContinuousOn (Function.uncurry u) (timeCylinder T) β§ | |
| ContinuousOn (Function.uncurry (dt u)) (timeCylinder T) β§ | |
| (β i, ContinuousOn (Function.uncurry (dx i u)) (timeCylinder T)) β§ | |
| (β i j, ContinuousOn (Function.uncurry (dx i (dx j u))) (timeCylinder T)) β§ | |
| ContinuousOn (Function.uncurry p) (timeCylinder T) β§ | |
| (β i, ContinuousOn (Function.uncurry (dx i p)) (timeCylinder T)) | |
| def ContinuousInH {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (k : β) (F : Field E) (T : β) : Prop := | |
| β Ξ± : MultiIndex, (β i, Ξ± i) β€ k β | |
| β g : β β Lp E 2 (volume : Measure Space), | |
| ContinuousOn g (Set.Icc 0 T) β§ | |
| β t β Set.Icc 0 T, | |
| βα΅ x β(volume : Measure Space), (g t) x = spatial Ξ± F t x | |
| def C1InL2 (u : Velocity) (T : β) : Prop := | |
| β g g' : β β Lp Space 2 (volume : Measure Space), | |
| ContinuousOn g (Set.Icc 0 T) β§ | |
| ContinuousOn g' (Set.Icc 0 T) β§ | |
| (β t β Set.Icc 0 T, HasDerivWithinAt g (g' t) (Set.Icc 0 T) t) β§ | |
| (β t β Set.Icc 0 T, βα΅ x β(volume : Measure Space), (g t) x = u t x) β§ | |
| (β t β Set.Icc 0 T, βα΅ x β(volume : Measure Space), (g' t) x = dt u t x) | |
| def CompetitorEnergyClass (u : Velocity) (p : Pressure) : Prop := | |
| β T, 0 β€ T β | |
| ContinuousInH 2 u T β§ C1InL2 u T β§ ContinuousInH 1 p T β§ | |
| β C : β, β t β Set.Icc 0 T, β x, βu t xβ β€ C | |
| def EnergyClass (u : Velocity) (p : Pressure) : Prop := | |
| CompetitorEnergyClass u p β§ | |
| β T, 0 β€ T β β C : β, β t β Set.Icc 0 T, β x, | |
| βu t xβ + βfderiv β (u t) xβ β€ C | |
| def NavierStokes (Ξ½ : β) (f u : Velocity) (p : Pressure) : Prop := | |
| ClassicalRegularity u p β§ | |
| (β x, u 0 x = 0) β§ | |
| β t, 0 β€ t β β x, | |
| div u t x = 0 β§ | |
| dt u t x + advection u t x = -grad p t x + Ξ½ β’ laplacian u t x + f t x | |
| def Rapid (F : Velocity) : Prop := | |
| β J l : β, β Ξ± : MultiIndex, β C : β, 0 β€ C β§ | |
| β t, 0 β€ t β β x, | |
| (1 + t + βxβ) ^ J * βmixed l Ξ± F t xβ β€ C | |
| def SupportedIn (F : Velocity) (K : Set Space) : Prop := | |
| β t, 0 β€ t β Function.support (F t) β K | |
| def IsTrajectory (u : Velocity) (a : Space) (Ξ³ : β β Space) : Prop := | |
| Ξ³ 0 = a β§ β t, 0 β€ t β HasDerivWithinAt Ξ³ (u t (Ξ³ t)) (Set.Ici 0) t | |
| def observedParticle : Space := (EuclideanSpace.equiv (Fin 3) β).symm ![-1, 0, 0] | |
| abbrev RationalPoint := β Γ β Γ β Γ β | |
| abbrev RationalVector := β Γ β Γ β | |
| abbrev IndexCode := β Γ β Γ β | |
| abbrev Program := Nat.Partrec.Code | |
| abbrev FieldProgram := Program Γ Program Γ Program | |
| def Returns {A B : Type*} [Encodable A] [Encodable B] | |
| (c : Program) (a : A) (b : B) : Prop := | |
| Encodable.encode b β c.eval (Encodable.encode a) | |
| def index (Ξ± : IndexCode) : MultiIndex := ![Ξ±.1, Ξ±.2.1, Ξ±.2.2] | |
| def rationalVector (q : RationalVector) : Space := | |
| (EuclideanSpace.equiv (Fin 3) β).symm ![(q.1 : β), (q.2.1 : β), (q.2.2 : β)] | |
| def rationalPoint (q : RationalPoint) : β Γ Space := | |
| ((q.1 : β), rationalVector q.2) | |
| def dyadicError (n : β) : β := (1 / 2 : β) ^ n | |
| def ComputableReal (r : β) : Prop := | |
| β a : β β β, Computable (fun n => ((a n).num, (a n).den)) β§ | |
| β n, |r - (a n : β)| β€ dyadicError n | |
| def ProgramFor (c : FieldProgram) (F : Velocity) : Prop := | |
| (β (l : β) (Ξ± : IndexCode) (q : RationalPoint) (k : β), | |
| β v : RationalVector, Returns c.1 (l, Ξ±, q, k) v β§ | |
| (0 β€ q.1 β | |
| βrationalVector v - mixed l (index Ξ±) F (rationalPoint q).1 (rationalPoint q).2β | |
| β€ dyadicError k)) β§ | |
| (β (l : β) (Ξ± : IndexCode) (R k : β), | |
| β m : β, Returns c.2.1 (l, Ξ±, R, k) m β§ | |
| β z z' : β Γ Space, | |
| 0 β€ z.1 β 0 β€ z'.1 β βzβ β€ R β βz'β β€ R β | |
| βz - z'β β€ dyadicError m β | |
| βmixed l (index Ξ±) F z.1 z.2 - mixed l (index Ξ±) F z'.1 z'.2β β€ dyadicError k) β§ | |
| (β (J l : β) (Ξ± : IndexCode), | |
| β B : β, Returns c.2.2 (J, l, Ξ±) B β§ | |
| β t, 0 β€ t β β x, | |
| (1 + t + βxβ) ^ J * βmixed l (index Ξ±) F t xβ β€ B) | |
| def AlternatingConclusion (Ξ½ : β) : Prop := | |
| β (compileForce compileVelocity : Machine Γ List β β FieldProgram), | |
| Computable compileForce β§ Computable compileVelocity β§ | |
| β K : Set Space, IsCompact K β§ | |
| β (M : Machine) (w : List β), M.WellFormed β M.ValidInput w β | |
| β (f U : Velocity) (X : Space β β β Space), | |
| ProgramFor (compileForce (M, w)) f β§ | |
| ProgramFor (compileVelocity (M, w)) U β§ | |
| Smooth f β§ Smooth U β§ | |
| SupportedIn f K β§ SupportedIn U K β§ Rapid f β§ Rapid U β§ | |
| f = residual Ξ½ U β§ | |
| NavierStokes Ξ½ f U (fun _ _ => 0) β§ EnergyClass U (fun _ _ => 0) β§ | |
| (β (v : Velocity) (p : Pressure), | |
| NavierStokes Ξ½ f v p β CompetitorEnergyClass v p β | |
| β t, 0 β€ t β β x, v t x = U t x β§ p t x = 0) β§ | |
| (β a, IsTrajectory U a (X a)) β§ | |
| (β a Ξ³, IsTrajectory U a Ξ³ β β t, 0 β€ t β Ξ³ t = X a t) β§ | |
| ((β t : β, 0 β€ t β§ 0 < X observedParticle t 0) β M.Halts w) | |
| end | |
| end AlternatingNS | |
| end OAI | |