lean4-htt/tests/lean/run/new_frontend2.lean
Leonardo de Moura b37158f4f8 fix: apply
2020-09-16 16:18:30 -07:00

47 lines
772 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

new_frontend
declare_syntax_cat foo
variable {m : Type → Type}
variable [s : Functor m]
#check @Nat.rec
#check s.map
/-
The following doesn't work because
```
variable [r : Monad m]
#check r.map
```
because `Monad.to* methods have bad binder annotations
-/
theorem aux (a b c : Nat) (h₁ : a = b) (h₂ : c = b) : a = c :=
by {
let! aux := h₂.symm;
subst aux;
subst h₁;
exact rfl
}
def ex1 : {α : Type} → {a b c : α} → a = b → b = c → a = c :=
@(by intro α a b c h₁ h₂;
exact Eq.trans h₁ h₂)
def f1 (x : Nat) : Nat := by
apply (· + ?hole);
exact 1;
case hole => exact x
theorem ex2 (x : Nat) : f1 x = 1 + x :=
rfl
def f2 (x : Nat) : Nat := by
apply Nat.add _;
exact 1;
exact x
theorem ex3 (x : Nat) : f2 x = x + 1 :=
rfl