]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/library/higher_order_defs/functions.ma
ocaml 3.09 transition
[helm.git] / helm / 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 set "baseuri" "cic:/matita/higher_order_defs/functions/".
16
17 include "logic/equality.ma".
18
19 definition compose \def
20   \lambda A,B,C:Type.\lambda f:(B\to C).\lambda g:(A\to B).\lambda x:A.
21   f (g x).
22
23 notation "hvbox(a break \circ b)" 
24   left associative with precedence 70
25 for @{ 'compose $a $b }.
26
27 interpretation "function composition" 'compose f g =
28   (cic:/matita/higher_order_defs/functions/compose.con _ _ _ f g).
29
30 definition injective: \forall A,B:Type.\forall f:A \to B.Prop
31 \def \lambda A,B.\lambda f.
32   \forall x,y:A.f x = f y \to x=y.
33
34 definition surjective: \forall A,B:Type.\forall f:A \to B.Prop
35 \def \lambda A,B.\lambda f.
36   \forall z:B. \exists x:A.z=f x.
37
38 definition symmetric: \forall A:Type.\forall f:A \to A\to A.Prop
39 \def \lambda A.\lambda f.\forall x,y.f x y = f y x.
40
41 definition symmetric2: \forall A,B:Type.\forall f:A \to A\to B.Prop
42 \def \lambda A,B.\lambda f.\forall x,y.f x y = f y x.
43
44 definition associative: \forall A:Type.\forall f:A \to A\to A.Prop
45 \def \lambda A.\lambda f.\forall x,y,z.f (f x y) z = f x (f y z).
46
47 theorem eq_f_g_h:
48   \forall A,B,C,D:Type.
49   \forall f:C \to D.\forall g:B \to C.\forall h:A \to B.
50   f \circ (g \circ h) = (f \circ g) \circ h.
51   intros.
52   reflexivity.
53 qed.
54
55 (* functions and relations *)
56 definition monotonic : \forall A:Type.\forall R:A \to A \to Prop.
57 \forall f:A \to A.Prop \def
58 \lambda A. \lambda R. \lambda f. \forall x,y:A.R x y \to R (f x) (f y).
59
60 (* functions and functions *)
61 definition distributive: \forall A:Type.\forall f,g:A \to A \to A.Prop
62 \def \lambda A.\lambda f,g.\forall x,y,z:A. f x (g y z) = g (f x y) (f x z).
63
64 definition distributive2: \forall A,B:Type.\forall f:A \to B \to B.
65 \forall g: B\to B\to B. Prop
66 \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).
67