File size: 5,285 Bytes
f18e7de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import OAI.MathematicalPhysics.AlternatingFlow.BaseNames

namespace OAI

section MixedProgramsDevelopment

open scoped BigOperators Topology ContDiff
namespace AlternatingNS.Effective
attribute [local instance] Arithmetic.rationalCoding

variable {A E F : Type*} [Primcodable A]
  [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F]

lemma wordJet_linear {f : ℝ × Space → E} (hf : ContDiff ℝ ∞ f)
    (L : E →L[ℝ] F) (w : List (Fin 4)) :
    wordJet (L ∘ f) w = L ∘ wordJet f w := by
  induction w with
  | nil => rfl
  | cons i w ih =>
    funext z
    simp only [wordJet, ih]
    rw [fderiv_comp _ L.differentiableAt ((wordJet_smooth hf w).differentiable (by simp) z), L.fderiv]
    rfl

lemma wordJet_component {f : ℝ × Space → Space} (hf : ContDiff ℝ ∞ f)
    (i : Fin 3) (w : List (Fin 4)) :
    wordJet (fun z => f z i) w = fun z => wordJet f w z i :=
  wordJet_linear hf (PiLp.proj 2 (𝕜 := ℝ) (fun _ : Fin 3 => ℝ) i) w

lemma JetBound.named_component_words {f : A → ℝ × Space → Space} (hf : JetBound f)
    (hn : Named (fun z : (A × Fin 3) × RationalPoint => f z.1.1 (rationalPoint z.2) z.1.2)) :
    Named (fun z : ((A × Fin 3) × List (Fin 4)) × RationalPoint =>
      wordJet (f z.1.1.1) z.1.2 (rationalPoint z.2) z.1.1.2) := by
  have hp := (hf.param (Computable.fst : Computable (Prod.fst : A × Fin 3 → A))).linear_unit
    (fun p => PiLp.proj 2 (𝕜 := ℝ) (fun _ : Fin 3 => ℝ) p.2) (fun p => norm_proj p.2)
  exact (hp.named_wordJet hn).congr (fun z => congrFun (wordJet_component (hf.1 z.1.1.1) z.1.1.2 z.1.2) (rationalPoint z.2))

lemma wordJet_append (f : ℝ × Space → E) (v w : List (Fin 4)) :
    wordJet f (v ++ w) = wordJet (wordJet f w) v := by
  induction v with
  | nil => rfl
  | cons i v ih => simp only [List.cons_append, wordJet, ih]

lemma wordJet_dx (f : Field E) (hf : ContDiff ℝ ∞ (Function.uncurry f))
    (i : Fin 3) (n : ℕ) :
    Function.uncurry ((dx i)^[n] f) = wordJet (Function.uncurry f) (List.replicate n i.succ) := by
  induction n with
  | zero => rfl
  | succ n ih =>
    funext z
    rw [Function.iterate_succ_apply']
    change dx i ((dx i)^[n] f) z.1 z.2 = _
    rw [Bounds.dx_eq_full_directional _ (Analytic.iterate_dx_smooth f hf i n), ih]
    simp only [List.replicate_succ, wordJet, direction_succ]

lemma wordJet_dt (f : Field E) (hf : ContDiff ℝ ∞ (Function.uncurry f)) (n : ℕ) :
    Bounds.HalfEq (dt^[n] f) (fun t x => wordJet (Function.uncurry f) (List.replicate n 0) (t,x)) := by
  induction n with
  | zero => exact fun _ _ _ => rfl
  | succ n ih =>
    intro t ht x
    rw [Function.iterate_succ_apply']
    have hh := ih.dt t ht x
    have hs := wordJet_smooth hf (List.replicate n 0)
    rw [Analytic.dt_eq_full (fun t x => wordJet (Function.uncurry f) (List.replicate n 0) (t,x)) hs t ht x,
      Bounds.fullDt_eq_full_directional (fun t x => wordJet (Function.uncurry f) (List.replicate n 0) (t,x)) hs (t,x)] at hh
    change dt (dt^[n] f) t x = fderiv ℝ (wordJet (Function.uncurry f) (List.replicate n 0)) (t,x) (1,0) at hh
    simpa only [List.replicate_succ, wordJet, direction, Matrix.cons_val_zero] using hh

def mixedWord (l : ℕ) (α : IndexCode) : List (Fin 4) :=
  List.replicate l 0 ++ (List.replicate α.1 1 ++
    (List.replicate α.2.1 2 ++ List.replicate α.2.2 3))

lemma wordJet_spatial (f : Field E) (hf : ContDiff ℝ ∞ (Function.uncurry f)) (α : IndexCode) :
    Function.uncurry (spatial (index α) f) =
      wordJet (Function.uncurry f) (List.replicate α.1 1 ++
        (List.replicate α.2.1 2 ++ List.replicate α.2.2 3)) := by
  simp only [spatial, index, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val]
  rw [wordJet_dx _ (Analytic.iterate_dx_smooth _ (Analytic.iterate_dx_smooth f hf 2 _) 1 _),
    wordJet_dx _ (Analytic.iterate_dx_smooth f hf 2 _), wordJet_dx f hf]
  simp only [wordJet_append]
  rfl

lemma mixed_eq_wordJet (f : Field E) (hf : ContDiff ℝ ∞ (Function.uncurry f))
    (l : ℕ) (α : IndexCode) (t : ℝ) (ht : 0 ≤ t) (x : Space) :
    mixed l (index α) f t x = wordJet (Function.uncurry f) (mixedWord l α) (t,x) := by
  have h := wordJet_dt (spatial (index α) f) (Analytic.spatial_smooth f hf _) l t ht x
  rw [wordJet_spatial f hf α] at h
  simpa only [mixedWord, wordJet_append, mixed] using h

lemma replicate_primrec {B : Type*} [Primcodable B] (b : B) : Primrec (fun n => List.replicate n b) := by
  have h := Primrec.nat_rec₁ (f := fun _ : ℕ => fun w : List B => b :: w) ([] : List B)
    (Primrec.list_cons.comp (Primrec.const b) Primrec.snd)
  apply h.of_eq
  intro n
  induction n with
  | zero => rfl
  | succ n ih =>
    change b :: _ = List.replicate (n+1) b
    rw [ih, List.replicate_succ]

lemma mixedWord_computable : Computable₂ mixedWord := by
  have hr (i : Fin 4) := (replicate_primrec i).to_comp
  exact Primrec.list_append.to_comp.comp ((hr 0).comp Computable.fst)
    (Primrec.list_append.to_comp.comp ((hr 1).comp (Computable.fst.comp Computable.snd))
      (Primrec.list_append.to_comp.comp ((hr 2).comp (Computable.fst.comp (Computable.snd.comp Computable.snd)))
        ((hr 3).comp (Computable.snd.comp (Computable.snd.comp Computable.snd)))))

end AlternatingNS.Effective

end MixedProgramsDevelopment

end OAI