The main function
The possible types of main function are the following:
IO Unit
List String -> IO Unit
The arguments are passed as List String. If the type of main is not fully specified, it compiles only if the type inference resolves it to one of the two.
(Other return types such as IO PUnit and IO UInt32 exist, but they are not really relevant to solving Code Golf holes.)
List/Array indexing
Indexing notation comes in multiple forms:
a[i] returns the i-th element of a, but only typechecks if "indexing is valid" can be proven automatically
a[i]'h does the same, with user-supplied proof h
a[i]? returns an Option
a[i]! panics if out of bounds (see Panic section below)
Inside a for-loop or an if-branch, you can write for h:i in 0...10 or if h:i < 10 then to create a proof of range of i.
This is then picked up by the indexing auto-prover, which may save some !s in indexing.
Sorry
If you need a non-indexing proof and you don't have one right away, often the best bet is to throw sorry at it.
It fills any proof goal at the cost of emitting a compile-time warning.
Panic in Lean
Due to how the theory of Lean works, panic of type a is designed to evaluate to the default element of type a. This propagates to actual execution, which means [0,1,2][3]! will give a panic message on stderr, but then proceed to evaluate the default element of Nat, which is 0.