lean2/tests/lean/replace_tac.lean
2016-01-04 14:43:31 -05:00

38 lines
925 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.

import data.list
open nat list
example (H : false) : (1 : ) + 1 = (2 : ) :=
begin
replace (1 : ) with (succ 0) at {1},
end
example (H : false) : (1 : ) + 1 = (2 : ) :=
begin
replace (1 : ) with (succ 1),
end
definition foo (n : ) : := n
definition bar := foo
example (h : true) : foo 2 = bar 2 :=
begin
replace foo 2 with bar 2 at h,
reflexivity
end
constants (P : → Type₁) (p : P (3 + 1)) (f : Πn, P n)
example : f (3 + 1) = p :=
begin
replace ((3 : ) + 1) with (4 : ),
end
variables {A B : Type}
lemma my_map_concat (f : A → B) (a : A) : Πl, map f (concat a l) = concat (f a) (map f l)
| nil := rfl
| (b::l) := begin
replace concat a (b :: l) with b :: concat a l,
replace concat (f a) (map f (b :: l)) with f b :: concat (f a) (map f l),
replace map f (b :: concat a l) with f b :: map f (concat a l),
congruence,
apply my_map_concat
end