2014-08-01 17:58:20 +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
|
|
|
|
----------------------------------------------------------------------------------------------------
|
2014-10-05 17:50:13 +00:00
|
|
|
import logic.connectives algebra.function
|
2014-09-03 23:00:38 +00:00
|
|
|
open function
|
2014-08-01 17:58:20 +00:00
|
|
|
|
|
|
|
namespace congr
|
|
|
|
|
2014-10-08 01:02:15 +00:00
|
|
|
inductive struc [class] {T1 : Type} {T2 : Type} (R1 : T1 → T1 → Prop) (R2 : T2 → T2 → Prop)
|
2014-08-01 17:58:20 +00:00
|
|
|
(f : T1 → T2) : Prop :=
|
2014-08-22 22:46:10 +00:00
|
|
|
mk : (∀x y : T1, R1 x y → R2 (f x) (f y)) → struc R1 R2 f
|
2014-08-01 17:58:20 +00:00
|
|
|
|
2014-09-17 21:39:05 +00:00
|
|
|
definition app {T1 : Type} {T2 : Type} {R1 : T1 → T1 → Prop} {R2 : T2 → T2 → Prop}
|
2014-08-01 17:58:20 +00:00
|
|
|
{f : T1 → T2} (C : struc R1 R2 f) {x y : T1} : R1 x y → R2 (f x) (f y) :=
|
2014-09-04 22:03:59 +00:00
|
|
|
struc.rec id C x y
|
2014-08-01 17:58:20 +00:00
|
|
|
|
|
|
|
inductive struc2 {T1 : Type} {T2 : Type} {T3 : Type} (R1 : T1 → T1 → Prop)
|
|
|
|
(R2 : T2 → T2 → Prop) (R3 : T3 → T3 → Prop) (f : T1 → T2 → T3) : Prop :=
|
2014-08-22 22:46:10 +00:00
|
|
|
mk2 : (∀(x1 y1 : T1) (x2 y2 : T2), R1 x1 y1 → R2 x2 y2 → R3 (f x1 x2) (f y1 y2)) →
|
2014-08-01 17:58:20 +00:00
|
|
|
struc2 R1 R2 R3 f
|
|
|
|
|
2014-09-17 21:39:05 +00:00
|
|
|
definition app2 {T1 : Type} {T2 : Type} {T3 : Type} {R1 : T1 → T1 → Prop}
|
2014-08-01 17:58:20 +00:00
|
|
|
{R2 : T2 → T2 → Prop} {R3 : T3 → T3 → Prop} {f : T1 → T2 → T3}
|
|
|
|
(C : struc2 R1 R2 R3 f) {x1 y1 : T1} {x2 y2 : T2}
|
|
|
|
: R1 x1 y1 → R2 x2 y2 → R3 (f x1 x2) (f y1 y2) :=
|
2014-09-04 22:03:59 +00:00
|
|
|
struc2.rec id C x1 y1 x2 y2
|
2014-08-01 17:58:20 +00:00
|
|
|
|
|
|
|
theorem compose21
|
|
|
|
{T2 : Type} {R2 : T2 → T2 → Prop}
|
|
|
|
{T3 : Type} {R3 : T3 → T3 → Prop}
|
|
|
|
{T4 : Type} {R4 : T4 → T4 → Prop}
|
|
|
|
{g : T2 → T3 → T4} (C3 : congr.struc2 R2 R3 R4 g)
|
|
|
|
⦃T1 : Type⦄ -- nice!
|
|
|
|
{R1 : T1 → T1 → Prop}
|
|
|
|
{f1 : T1 → T2} (C1 : congr.struc R1 R2 f1)
|
|
|
|
{f2 : T1 → T3} (C2 : congr.struc R1 R3 f2) :
|
2014-09-04 23:36:06 +00:00
|
|
|
congr.struc R1 R4 (λx, g (f1 x) (f2 x)) := struc.mk (take x1 x2 H, app2 C3 (app C1 H) (app C2 H))
|
2014-08-01 17:58:20 +00:00
|
|
|
|
|
|
|
theorem congr_and : congr.struc2 iff iff iff and := sorry
|
|
|
|
|
|
|
|
theorem congr_and_comp [instance] {T : Type} {R : T → T → Prop} {f1 f2 : T → Prop}
|
|
|
|
(C1 : struc R iff f1) (C2 : struc R iff f2) :
|
|
|
|
congr.struc R iff (λx, f1 x ∧ f2 x) := congr.compose21 congr_and C1 C2
|
|
|
|
|
2014-08-28 01:39:55 +00:00
|
|
|
end congr
|