Syllabus

Initial tactic, brackets and basic logic symbols

Some tactics

Brackets

There are four kinds of brackets for arguments of functions/assumptions of theorems.

Difference between implicit brackets {} and strict implicit brackets ⦃⦄

--  `fe` takes two explicit natural numbers
def fe (m : ) (n : ) := m + n

--  `fi` takes an explicit natural number and an implicit one
def fi (m : ) {n : } := m + n

--  `fs` takes an explicit natural number and a strict implicit one
def fs (m : ) n :  := m + n

/-
When we supply to `fi` or `fs` its first (explicit) argument, there is a potential ambiguity:
are we left with a function of the remaining (strict or not implicit) argument,
or does Lean expect to have filled that argument already?

Here is a way of checking!
-/

/-  if we have two explicit arguments, we pass the first, then
we are left with a function of one explicit argument
-/
#check fe 0  -- fe 0 : ℕ → ℕ

/-  if we have an explicit and an implicit one, we pass the first, we are left with a natural number:
Lean expects to have filled in the implicit argument already
-/
#check fi 0  -- fi 0 : ℕ

/-  if we have an explicit and a strict implicit one, we pass the first, we are left with a function:
Lean *waits* to fill in the left-over strict implicit and thus tells that we still have a function
-/
#check fs 0  -- fs 0 : ⦃n : ℕ⦄ → ℕ

Summarising, Lean

In fact, if our function has further arguments beyond a strict implicit, Lean will try to fill in the strict implicit only after we pass the next explicit argument. The distinction between implicit and strict implicit arguments is not too important and you can safely ignore it!

Commonly used symbols

Name Symbol
and
or
not ¬
iff
implies
for all
there exists
goal

You can find a cheat-sheet with commonly used symbols and tactics here and also here (these page are externally maintained – let me know if they stop working).


Back to the Theorem Proving with Lean webpage

Back to the Mathlib project for the module

Open in Gitpod

Back to Moodle