Download data/lean/OAI/MathematicalPhysics/NavierStokes/Material/Model.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.11 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/NavierStokes/Material/Model.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MathematicalPhysics/NavierStokes/Material/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MathematicalPhysics/NavierStokes/Material/Model.lean
9.11 kB
| import Mathlib | |
| namespace OAI | |
| namespace Alternating | |
| open scoped BigOperators | |
| open MeasureTheory | |
| abbrev Instruction := β Γ β Γ Fin 3 | |
| abbrev Machine := β Γ β Γ Finset β Γ List (List (Option Instruction)) | |
| abbrev MachineInput := Machine Γ List β | |
| def Machine.stateCount (M : Machine) : β := M.1 + 1 | |
| def Machine.symbolCount (M : Machine) : β := M.2.1 + 1 | |
| def Machine.haltingStates (M : Machine) : Finset β := M.2.2.1 | |
| def Machine.table (M : Machine) : List (List (Option Instruction)) := M.2.2.2 | |
| def Machine.WellFormed (M : Machine) : Prop := | |
| M.table.length = M.stateCount β§ | |
| (β q β M.haltingStates, q < M.stateCount) β§ | |
| β row β M.table, | |
| row.length = M.symbolCount β§ | |
| β i : Instruction, some i β row β | |
| i.1 < M.stateCount β§ i.2.1 < M.symbolCount | |
| def ValidInput (I : MachineInput) : Prop := | |
| I.1.WellFormed β§ β a β I.2, a < I.1.symbolCount | |
| theorem ValidInput.machine_wellFormed {I : MachineInput} (hI : ValidInput I) : | |
| I.1.WellFormed := hI.1 | |
| structure Configuration where | |
| state : β | |
| head : β€ | |
| tape : β€ β β | |
| def Machine.isHalting (M : Machine) (q : β) : Bool := | |
| decide (q = M.stateCount β¨ q β M.haltingStates) | |
| def Machine.instruction (M : Machine) (q a : β) : Option Instruction := | |
| ((M.table[q]?).bind fun row => row[a]?).join | |
| def Machine.step (M : Machine) (c : Configuration) : Configuration := | |
| if M.isHalting c.state then c | |
| else match M.instruction c.state (c.tape c.head) with | |
| | none => { c with state := M.stateCount } | |
| | some i => | |
| { state := i.1 | |
| head := c.head + (i.2.2.val : β€) - 1 | |
| tape := Function.update c.tape c.head i.2.1 } | |
| def initialConfiguration (w : List β) : Configuration := | |
| { state := 0 | |
| head := 0 | |
| tape := fun j => if j < 0 then 0 else (w[j.toNat]?).getD 0 } | |
| def configurationAt (I : MachineInput) (n : β) : Configuration := | |
| I.1.step^[n] (initialConfiguration I.2) | |
| def Halts (I : MachineInput) : Prop := | |
| β n : β, I.1.isHalting (configurationAt I n).state = true | |
| abbrev Space := EuclideanSpace β (Fin 3) | |
| abbrev Field := β β Space β Space | |
| abbrev Pressure := β β Space β β | |
| abbrev MultiIndex := Fin 3 β β | |
| noncomputable section | |
| def basisVector (i : Fin 3) : Space := EuclideanSpace.single i 1 | |
| def multiOrder (Ξ± : MultiIndex) : β := β i, Ξ± i | |
| def spatialD {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (i : Fin 3) (g : Space β E) : Space β E := | |
| fun x => fderiv β g x (basisVector i) | |
| def spatialPartial {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (Ξ± : MultiIndex) (g : Space β E) : Space β E := | |
| (spatialD 2)^[Ξ± 2] ((spatialD 1)^[Ξ± 1] ((spatialD 0)^[Ξ± 0] g)) | |
| def timeD {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (g : β β E) : β β E := fun t => derivWithin g (Set.Ici 0) t | |
| def mixedPartial (u : Field) (l : β) (Ξ± : MultiIndex) (t : β) (x : Space) : Space := | |
| timeD^[l] (fun s => spatialPartial Ξ± (u s) x) t | |
| def timeDerivative (u : Field) (t : β) (x : Space) : Space := | |
| timeD (fun s => u s x) t | |
| def divergence (u : Space β Space) (x : Space) : β := | |
| β i : Fin 3, spatialD i u x i | |
| def gradient (p : Space β β) (x : Space) : Space := | |
| (EuclideanSpace.equiv (Fin 3) β).symm (fun i => spatialD i p x) | |
| def laplacian (u : Space β Space) (x : Space) : Space := | |
| β i : Fin 3, spatialD i (spatialD i u) x | |
| def convection (u : Space β Space) (x : Space) : Space := | |
| β i : Fin 3, (u x i) β’ spatialD i u x | |
| def residual (Ξ½ : β) (u : Field) : Field := | |
| fun t x => timeDerivative u t x + convection (u t) x - Ξ½ β’ laplacian (u t) x | |
| def timeSpace : Set (β Γ Space) := Set.Ici 0 ΓΛ’ Set.univ | |
| def SmoothUpToZero (u : Field) : Prop := | |
| ContDiffOn β (β€ : ββ) (Function.uncurry u) timeSpace | |
| def SupportedIn (K : Set Space) (u : Field) : Prop := | |
| β t : β, 0 β€ t β β x : Space, x β K β u t x = 0 | |
| def RapidDecay (u : Field) : Prop := | |
| β (J l : β) (Ξ± : MultiIndex), β C : β, 0 β€ C β§ | |
| β (t : β), 0 β€ t β β x : Space, | |
| (1 + t + βxβ) ^ J * βmixedPartial u l Ξ± t xβ β€ C | |
| def ClassicalRegularity (u : Field) (p : Pressure) : Prop := | |
| (β t : β, 0 β€ t β ContDiff β 2 (u t) β§ ContDiff β 1 (p t)) β§ | |
| (β x : Space, DifferentiableOn β (fun t => u t x) (Set.Ici 0)) β§ | |
| β T : β, 0 β€ T β | |
| ContinuousOn (Function.uncurry (timeDerivative u)) (Set.Icc 0 T ΓΛ’ Set.univ) β§ | |
| (β Ξ± : MultiIndex, multiOrder Ξ± β€ 2 β | |
| ContinuousOn (fun tx : β Γ Space => spatialPartial Ξ± (u tx.1) tx.2) | |
| (Set.Icc 0 T ΓΛ’ Set.univ)) β§ | |
| (β Ξ± : MultiIndex, multiOrder Ξ± β€ 1 β | |
| ContinuousOn (fun tx : β Γ Space => spatialPartial Ξ± (p tx.1) tx.2) | |
| (Set.Icc 0 T ΓΛ’ Set.univ)) | |
| def NSSolution (Ξ½ : β) (f u : Field) (p : Pressure) : Prop := | |
| ClassicalRegularity u p β§ | |
| (β x : Space, u 0 x = 0) β§ | |
| β t : β, 0 β€ t β β x : Space, | |
| divergence (u t) x = 0 β§ | |
| timeDerivative u t x + convection (u t) x = | |
| -gradient (p t) x + Ξ½ β’ laplacian (u t) x + f t x | |
| abbrev SpatialL2 (E : Type*) [NormedAddCommGroup E] := | |
| MeasureTheory.Lp E 2 (MeasureTheory.volume : MeasureTheory.Measure Space) | |
| def ContinuousInSobolev {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| (k : β) (g : β β Space β E) (T : β) : Prop := | |
| β Ξ± : MultiIndex, multiOrder Ξ± β€ k β | |
| β G : β β SpatialL2 E, | |
| ContinuousOn G (Set.Icc 0 T) β§ | |
| β t β Set.Icc (0 : β) T, | |
| (fun x : Space => (G t) x) =α΅[volume] spatialPartial Ξ± (g t) | |
| def C1InL2 (u : Field) (T : β) : Prop := | |
| β U W : β β SpatialL2 Space, | |
| ContinuousOn U (Set.Icc 0 T) β§ ContinuousOn W (Set.Icc 0 T) β§ | |
| β t β Set.Icc (0 : β) T, | |
| ((fun x : Space => (U t) x) =α΅[volume] u t) β§ | |
| ((fun x : Space => (W t) x) =α΅[volume] timeDerivative u t) β§ | |
| HasDerivWithinAt U (W t) (Set.Icc 0 T) t | |
| def EnergyClass (u : Field) (p : Pressure) : Prop := | |
| β T : β, 0 β€ T β | |
| ContinuousInSobolev 2 u T β§ C1InL2 u T β§ ContinuousInSobolev 1 p T β§ | |
| β C : β, β t β Set.Icc (0 : β) T, β x : Space, | |
| βu t xβ + βfderiv β (u t) xβ β€ C | |
| def CompetitorEnergyClass (u : Field) (p : Pressure) : Prop := | |
| β T : β, 0 β€ T β | |
| ContinuousInSobolev 2 u T β§ C1InL2 u T β§ ContinuousInSobolev 1 p T β§ | |
| β C : β, β t β Set.Icc (0 : β) T, β x : Space, βu t xβ β€ C | |
| def SolvesParticle (u : Field) (a : Space) (Ξ³ : β β Space) : Prop := | |
| Ξ³ 0 = a β§ β t : β, 0 β€ t β | |
| HasDerivWithinAt Ξ³ (u t (Ξ³ t)) (Set.Ici 0) t | |
| def GlobalMaterialFlow (u : Field) (X : β β Space β Space) : Prop := | |
| (β a : Space, SolvesParticle u a (fun t => X t a)) β§ | |
| β (a : Space) (Ξ³ : β β Space), SolvesParticle u a Ξ³ β | |
| β t : β, 0 β€ t β Ξ³ t = X t a | |
| def observedParticle : Space := -basisVector 0 | |
| abbrev Program := Nat.Partrec.Code | |
| abbrev RationalPoint := β Γ β Γ β | |
| def rationalPoint (q : RationalPoint) : Space := | |
| (EuclideanSpace.equiv (Fin 3) β).symm ![(q.1 : β), (q.2.1 : β), (q.2.2 : β)] | |
| def error (k : β) : β := (2 : β)β»ΒΉ ^ k | |
| def ComputableReal (x : β) : Prop := | |
| β c : Program, β k : β, β q : β, | |
| Encodable.encode q β c.eval k β§ |x - (q : β)| β€ error k | |
| abbrev FieldProgram := Program Γ Program Γ Program | |
| def EvaluatesField (c : FieldProgram) (u : Field) : Prop := | |
| (β (l : β) (Ξ± : MultiIndex) (t : β), 0 β€ t β | |
| β (x : RationalPoint) (k : β), β q : RationalPoint, | |
| Encodable.encode q β c.1.eval (Encodable.encode (l, Ξ±, t, x, k)) β§ | |
| βmixedPartial u l Ξ± (t : β) (rationalPoint x) - rationalPoint qβ β€ error k) β§ | |
| (β (l : β) (Ξ± : MultiIndex) (k : β), β m : β, | |
| m β c.2.1.eval (Encodable.encode (l, Ξ±, k)) β§ | |
| β (t s : β), 0 β€ t β 0 β€ s β β x y : Space, | |
| |t - s| + βx - yβ β€ error m β | |
| βmixedPartial u l Ξ± t x - mixedPartial u l Ξ± s yβ β€ error k) β§ | |
| (β (J l : β) (Ξ± : MultiIndex), β C : β, | |
| Encodable.encode C β c.2.2.eval (Encodable.encode (J, l, Ξ±)) β§ 0 β€ C β§ | |
| β t : β, 0 β€ t β β x : Space, | |
| (1 + t + βxβ) ^ J * βmixedPartial u l Ξ± t xβ β€ (C : β)) | |
| def AlternatingOutput (Ξ½ : β) (K : Set Space) (I : MachineInput) | |
| (velocityProgram forceProgram : FieldProgram) : Prop := | |
| β (u f : Field) (X : β β Space β Space), | |
| EvaluatesField velocityProgram u β§ EvaluatesField forceProgram f β§ | |
| SmoothUpToZero u β§ SmoothUpToZero f β§ | |
| SupportedIn K u β§ SupportedIn K f β§ RapidDecay u β§ RapidDecay f β§ | |
| f = residual Ξ½ u β§ | |
| NSSolution Ξ½ f u (fun _ _ => 0) β§ EnergyClass u (fun _ _ => 0) β§ | |
| (β (v : Field) (p : Pressure), NSSolution Ξ½ f v p β CompetitorEnergyClass v p β | |
| β t : β, 0 β€ t β β x : Space, v t x = u t x β§ p t x = 0) β§ | |
| GlobalMaterialFlow u X β§ | |
| ((β t : β, 0 β€ t β§ 0 < X t observedParticle 0) β Halts I) | |
| end | |
| end Alternating | |
| end OAI | |