From 645d17fb20a660e51ff535285f1e5e5d8e059bd6 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Tue, 29 Oct 2019 07:44:43 +1100 Subject: [PATCH] Add doc/slices-arrays-and-tables.md link; fix typo --- doc/note/slices-arrays-and-tables.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/note/slices-arrays-and-tables.md b/doc/note/slices-arrays-and-tables.md index 0935ec9c..5fc308c6 100644 --- a/doc/note/slices-arrays-and-tables.md +++ b/doc/note/slices-arrays-and-tables.md @@ -57,12 +57,13 @@ An expression like `x[i .. j]` is invalid unless the compiler can prove that `x.length()`, and a slice or array cannot have negative length. Similarly, an expression like `x[i]` is invalid unless there is a compile-time -proof that `i` is in bounds: that ((0 <= i) and (i < x.length()))`. Proofs can +proof that `i` is in bounds: that `((0 <= i) and (i < x.length()))`. Proofs can involve natural bounds (e.g. if `i` has type `base.u8` then `(0 <= i)` is trivially true since a `base.u8` is unsigned), refinements (e.g. if `i`has type -`base.u32[..100]` then 100 is an upper bound for `i`) and interval arithmetic -(e.g. for an expression like `x[m + n]`, the upper bound for `m + n` is the sum -of the upper bounds of `m` and `n`). +`base.u32[..100]` then 100 is an upper bound for `i`) and [interval +arithmetic](/doc/note/interval-arithmetic.md) (e.g. for an expression like +`x[m + n]`, the upper bound for `m + n` is the sum of the upper bounds of `m` +and `n`). For example, if `a` is an `array[1024] base.u8`, and `expr` is some expression of type `base.u32`, then `a[expr & 1023]` is valid, because the bitwise-and