lean4-htt/tests/lean/getElem.lean.expected.out
Kyle Miller d39b0415f0
feat: enable pp.fieldNotation.generalized globally (#3744)
Sets the default value to `pp.fieldNotation.generalized` to `true`.
Updates tests, and fixes some minor flaws in the implementation of the
generalized field notation pretty printer.

Now generalized field notation won't be used for any function that has a
`motive` argument. This is intended to prevent recursors from pretty
printing using it as (1) recursors are more like control flow structures
than actual functions and (2) generalized field notation tends to cause
elaboration problems for recursors.

Note: be sure functions that have an `@[app_unexpander]` use
`@[pp_nodot]` if applicable. For example, `List.toArray` needs
`@[pp_nodot]` to ensure the unexpander prints it using `#[...]`
notation.
2024-03-23 02:38:09 +00:00

18 lines
738 B
Text

getElem.lean:2:2-2:6: error: failed to prove index is valid, possible solutions:
- Use `have`-expressions to prove the index is valid
- Use `a[i]!` notation instead, runtime check is perfomed, and 'Panic' error message is produced if index is not valid
- Use `a[i]?` notation instead, result is an `Option` type
- Use `a[i]'h` notation instead, where `h` is a proof that index is valid
a : Array Nat
i : Nat
⊢ i < a.size
def f2 : (a : Array Nat) → Fin a.size → Nat :=
fun a i => a[i]
def f3 : {n : Nat} → (a : Array Nat) → n ≤ a.size → Fin n → Nat :=
fun {n} a h i => a[i]
def f5 : (i : Nat) → i < n → Nat :=
fun i h => a[i]
def f6 : Nat → Nat :=
fun i => a[i]!
def f7 : Nat → Option Nat :=
fun i => a[i]?