2014-08-02 21:30:25 +00:00
|
|
|
----------------------------------------------------------------------------------------------------
|
|
|
|
--- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
--- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
--- Author: Jeremy Avigad
|
|
|
|
----------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
import logic data.nat
|
2014-09-03 23:00:38 +00:00
|
|
|
open nat
|
2014-08-02 21:30:25 +00:00
|
|
|
|
|
|
|
-- first define a class of homogeneous equality
|
2014-10-08 01:02:15 +00:00
|
|
|
inductive simplifies_to [class] {T : Type} (t1 t2 : T) : Prop :=
|
2014-08-22 22:46:10 +00:00
|
|
|
mk : t1 = t2 → simplifies_to t1 t2
|
2014-08-02 21:30:25 +00:00
|
|
|
|
2014-09-04 23:36:06 +00:00
|
|
|
namespace simplifies_to
|
|
|
|
|
2014-08-02 21:30:25 +00:00
|
|
|
theorem get_eq {T : Type} {t1 t2 : T} (C : simplifies_to t1 t2) : t1 = t2 :=
|
2014-09-04 22:03:59 +00:00
|
|
|
simplifies_to.rec (λx, x) C
|
2014-08-02 21:30:25 +00:00
|
|
|
|
|
|
|
theorem infer_eq {T : Type} (t1 t2 : T) {C : simplifies_to t1 t2} : t1 = t2 :=
|
2014-09-04 22:03:59 +00:00
|
|
|
simplifies_to.rec (λx, x) C
|
2014-08-02 21:30:25 +00:00
|
|
|
|
|
|
|
theorem simp_app [instance] (S : Type) (T : Type) (f1 f2 : S → T) (s1 s2 : S)
|
|
|
|
(C1 : simplifies_to f1 f2) (C2 : simplifies_to s1 s2) : simplifies_to (f1 s1) (f2 s2) :=
|
|
|
|
mk (congr (get_eq C1) (get_eq C2))
|
|
|
|
|
|
|
|
theorem test1 (S : Type) (T : Type) (f1 f2 : S → T) (s1 s2 : S) (Hf : f1 = f2) (Hs : s1 = s2) :
|
|
|
|
f1 s1 = f2 s2 :=
|
2014-09-08 14:47:42 +00:00
|
|
|
have Rs [visible] : simplifies_to f1 f2, from mk Hf,
|
|
|
|
have Cs [visible] : simplifies_to s1 s2, from mk Hs,
|
2014-08-02 21:30:25 +00:00
|
|
|
infer_eq _ _
|
2014-08-08 00:08:59 +00:00
|
|
|
|
2014-09-04 23:36:06 +00:00
|
|
|
end simplifies_to
|