lean4-htt/tests/lean/inaccessible2.lean
Leonardo de Moura c6a10b127f chore(tests/lean): fix tests
Remarks:
- Some tests do not produce error messages anymore because they can be
  processed using the new equation compiler preprocessor.

- Some error messages got worse because of the preprocessing step.
  We use metavariables in the preprocessing step. This information
  may "leak" to users. Another problem is that some variable names
  are lost. Example: in the following definition

  def to_nat : ∀ {n}, fi n → nat
  | (succ n) f0     := 0
  | (succ n) (fs i) := succ (to_nat i)

  The preprocessing step uses metavariables for pattern variables.
  Thus, we have

  def to_nat : ∀ {n}, fi n → nat
  | (succ ?n) (@f0 ?x)    := 0
  | (succ ?n) (@fs ?x ?i) := succ (to_nat i)

  when solving the constraint `succ ?n =?= succ ?x`, Lean assigns
        ?n := ?x
  after solving these constraints, the preprocessor converts
  metavariables into pattern variables again, and we have

  def to_nat : ∀ {n}, fi n → nat
  | (succ x) (@f0 x)   := 0
  | (succ x) (@fs x i) := succ (to_nat i)

  So, we get the following equation lemmas:

  to_nat.equations._eqn_1 : ∀ (x : ℕ), @to_nat (succ x) (@f0 x) = 0
  to_nat.equations._eqn_2 : ∀ (x : ℕ) (i : fi x), @to_nat (succ x) (@fs x i) = succ (@to_nat x i)

  instead of

  to_nat.equations._eqn_1 : ∀ (n : ℕ), @to_nat (succ n) (@f0 n) = 0
  to_nat.equations._eqn_2 : ∀ (n : ℕ) (i : fi n), @to_nat (succ n) (@fs n i) = succ (@to_nat n i)
2017-08-18 17:32:13 -07:00

17 lines
899 B
Text

inductive imf {A B : Sort*} (f : A → B) : B → Sort*
| mk : ∀ (a : A), imf (f a)
definition inv_1 {A B : Sort*} (f : A → B) : ∀ (b : B), imf f b → A
| .(f .(a)) (imf.mk .(f) a) := a -- Error inaccessible annotation inside inaccessible annotation
definition inv_2 {A B : Sort*} (f : A → B) : ∀ (b : B), imf f b → A
| .(f a) (let x := (imf.mk .(f) a) in x) := a -- Error invalid occurrence of 'let' expression
definition inv_3 {A B : Sort*} (f : A → B) : ∀ (b : B), imf f b → A
| .(f a) ((λ (x : imf f b), x) (imf.mk .(f) a)) := a -- Error invalid occurrence of 'lambda' expression
definition symm {A : Sort*} : ∀ a b : A, a = b → b = a
| .(a) .(a) (eq.refl a) := rfl -- Error `a` in eq.refl must be marked as inaccessible since it is an inductive datatype parameter
definition symm2 {A : Sort*} : ∀ a b : A, a = b → b = a
| _ _ rfl := rfl -- correct version