]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/library/higher_order_defs/functions.ma
Preparing for 0.5.9 release.
[helm.git] / helm / software / matita / library / higher_order_defs / functions.ma
1 (**************************************************************************)
2 (*       ___                                                                *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||       A.Asperti, C.Sacerdoti Coen,                          *)
8 (*      ||A||       E.Tassi, S.Zacchiroli                                 *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU Lesser General Public License Version 2.1         *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "logic/equality.ma".
16
17 definition compose \def
18   \lambda A,B,C:Type.\lambda f:(B\to C).\lambda g:(A\to B).\lambda x:A.
19   f (g x).
20
21 interpretation "function composition" 'compose f g = (compose ? ? ? f g).
22
23 definition injective: \forall A,B:Type.\forall f:A \to B.Prop
24 \def \lambda A,B.\lambda f.
25   \forall x,y:A.f x = f y \to x=y.
26
27 definition surjective: \forall A,B:Type.\forall f:A \to B.Prop
28 \def \lambda A,B.\lambda f.
29   \forall z:B. \exists x:A.z=f x.
30
31 definition symmetric: \forall A:Type.\forall f:A \to A\to A.Prop
32 \def \lambda A.\lambda f.\forall x,y.f x y = f y x.
33
34 definition symmetric2: \forall A,B:Type.\forall f:A \to A\to B.Prop
35 \def \lambda A,B.\lambda f.\forall x,y.f x y = f y x.
36
37 definition associative: \forall A:Type.\forall f:A \to A\to A.Prop
38 \def \lambda A.\lambda f.\forall x,y,z.f (f x y) z = f x (f y z).
39
40 theorem eq_f_g_h:
41   \forall A,B,C,D:Type.
42   \forall f:C \to D.\forall g:B \to C.\forall h:A \to B.
43   f \circ (g \circ h) = (f \circ g) \circ h.
44   intros.
45   reflexivity.
46 qed.
47
48 (* functions and relations *)
49 definition monotonic : \forall A:Type.\forall R:A \to A \to Prop.
50 \forall f:A \to A.Prop \def
51 \lambda A. \lambda R. \lambda f. \forall x,y:A.R x y \to R (f x) (f y).
52
53 (* functions and functions *)
54 definition distributive: \forall A:Type.\forall f,g:A \to A \to A.Prop
55 \def \lambda A.\lambda f,g.\forall x,y,z:A. f x (g y z) = g (f x y) (f x z).
56
57 definition distributive2: \forall A,B:Type.\forall f:A \to B \to B.
58 \forall g: B\to B\to B. Prop
59 \def \lambda A,B.\lambda f,g.\forall x:A.\forall y,z:B. f x (g y z) = g (f x y) (f x z).
60
61 lemma injective_compose : ∀A,B,C,f,g.injective A B f → injective B C g → 
62   injective A C (λx.g (f x)).
63 intros;unfold;intros;simplify in H2;apply H;apply H1;assumption;
64 qed.