File size: 2,292 Bytes
37bcf52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Recorder
import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TapeCoordinates

namespace OAI

/-! Exact two-stream coordinates of a one-head tape update. -/

namespace ForcedComputation.Recorder

variable {Q A : Type*}

def tapeAt (C : Configuration Q A) : Radix.Tape (Symbol Q A) :=
  (fun n => C.tape (C.head - ((n : ℤ) + 1)), fun n => C.tape (C.head + (n : ℤ)))

theorem tapeAt_right (C : Configuration Q A) (q' : Control Q A) (b : Symbol Q A) :
    tapeAt ⟨q', C.head + 1, Function.update C.tape C.head b⟩ =
      Radix.writeRight b (tapeAt C) := by
  apply Prod.ext
  · funext n
    cases n with
    | zero => simp [tapeAt, Radix.writeRight, Radix.prepend]
    | succ n =>
      dsimp [tapeAt, Radix.writeRight, Radix.prepend]
      rw [Function.update_of_ne (by omega)]
      congr 1
      omega
  · funext n
    dsimp [tapeAt, Radix.writeRight]
    rw [Function.update_of_ne (by omega)]
    congr 1
    omega

theorem tapeAt_stay (C : Configuration Q A) (q' : Control Q A) (b : Symbol Q A) :
    tapeAt ⟨q', C.head, Function.update C.tape C.head b⟩ =
      Radix.writeStay b (tapeAt C) := by
  apply Prod.ext
  · funext n
    dsimp [tapeAt, Radix.writeStay]
    rw [Function.update_of_ne (by omega)]
  · funext n
    cases n with
    | zero => simp [tapeAt, Radix.writeStay, Radix.prepend]
    | succ n =>
      dsimp [tapeAt, Radix.writeStay, Radix.prepend]
      rw [Function.update_of_ne (by omega)]

theorem tapeAt_left (C : Configuration Q A) (q' : Control Q A) (b : Symbol Q A) :
    tapeAt ⟨q', C.head - 1, Function.update C.tape C.head b⟩ =
      Radix.writeLeft b (tapeAt C) := by
  apply Prod.ext
  · funext n
    dsimp [tapeAt, Radix.writeLeft]
    rw [Function.update_of_ne (by omega)]
    congr 1
    omega
  · funext n
    cases n with
    | zero =>
      dsimp [tapeAt, Radix.writeLeft, Radix.prepend]
      rw [Function.update_of_ne (by omega)]
      congr 1
      omega
    | succ n =>
      cases n with
      | zero => simp [tapeAt, Radix.writeLeft, Radix.prepend]
      | succ n =>
        dsimp [tapeAt, Radix.writeLeft, Radix.prepend]
        rw [Function.update_of_ne (by omega)]
        congr 1
        omega

end ForcedComputation.Recorder

end OAI