This PR redefines `String` to be the type of byte arrays `b` for which `b.IsValidUtf8`. This moves the data model of strings much closer to the actual data representation at runtime. In the near future, we will - provide variants of `String.Pos` and `Substring` that only allow for valid positions - redefine all `String` functions to be much closer to their C++ implementations In the near-to-medium future we will then provide comprehensive verification of `String` based on these refactors.
31 lines
974 B
Text
31 lines
974 B
Text
/--
|
||
info: equations:
|
||
@[defeq] theorem List.append.eq_1.{u_1} : ∀ {α : Type u_1} (x : List α), [].append x = x
|
||
@[defeq] theorem List.append.eq_2.{u_1} : ∀ {α : Type u_1} (x : List α) (a : α) (as : List α),
|
||
(a :: as).append x = a :: as.append x
|
||
-/
|
||
#guard_msgs in
|
||
#print eqns List.append
|
||
|
||
/--
|
||
info: equations:
|
||
@[defeq] theorem List.append.eq_1.{u_1} : ∀ {α : Type u_1} (x : List α), [].append x = x
|
||
@[defeq] theorem List.append.eq_2.{u_1} : ∀ {α : Type u_1} (x : List α) (a : α) (as : List α),
|
||
(a :: as).append x = a :: as.append x
|
||
-/
|
||
#guard_msgs in
|
||
#print equations List.append
|
||
|
||
@[simp] def ack : Nat → Nat → Nat
|
||
| 0, y => y+1
|
||
| x+1, 0 => ack x 1
|
||
| x+1, y+1 => ack x (ack (x+1) y)
|
||
|
||
/--
|
||
info: equations:
|
||
theorem ack.eq_1 : ∀ (x : Nat), ack 0 x = x + 1
|
||
theorem ack.eq_2 : ∀ (x_2 : Nat), ack x_2.succ 0 = ack x_2 1
|
||
theorem ack.eq_3 : ∀ (x_2 y : Nat), ack x_2.succ y.succ = ack x_2 (ack (x_2 + 1) y)
|
||
-/
|
||
#guard_msgs in
|
||
#print eqns ack
|