Skip to content

Commit b17be0a

Browse files
split example into specification and proof modules
1 parent c77859c commit b17be0a

8 files changed

+2401
-714
lines changed
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
------------------------------ MODULE Functions -----------------------------
2+
(***************************************************************************)
3+
(* `^{\large\bf \vspace{12pt} *)
4+
(* Notions about functions including injection, surjection, and bijection.*)
5+
(* Originally contributed by Tom Rodeheffer, MSR. *)
6+
(* \vspace{12pt}}^' *)
7+
(***************************************************************************)
8+
9+
10+
(***************************************************************************)
11+
(* Restriction of a function to a set (should be a subset of the domain). *)
12+
(***************************************************************************)
13+
Restrict(f,S) == [ x \in S |-> f[x] ]
14+
15+
(***************************************************************************)
16+
(* Range of a function. *)
17+
(* Note: The image of a set under function f can be defined as *)
18+
(* Range(Restrict(f,S)). *)
19+
(***************************************************************************)
20+
Range(f) == { f[x] : x \in DOMAIN f }
21+
22+
23+
(***************************************************************************)
24+
(* The inverse of a function. *)
25+
(***************************************************************************)
26+
Inverse(f,S,T) == [t \in T |-> CHOOSE s \in S : t \in Range(f) => f[s] = t]
27+
28+
29+
(***************************************************************************)
30+
(* A map is an injection iff each element in the domain maps to a distinct *)
31+
(* element in the range. *)
32+
(***************************************************************************)
33+
Injection(S,T) == { M \in [S -> T] : \A a,b \in S : M[a] = M[b] => a = b }
34+
35+
36+
(***************************************************************************)
37+
(* A map is a surjection iff for each element in the range there is some *)
38+
(* element in the domain that maps to it. *)
39+
(***************************************************************************)
40+
Surjection(S,T) == { M \in [S -> T] : \A t \in T : \E s \in S : M[s] = t }
41+
42+
43+
(***************************************************************************)
44+
(* A map is a bijection iff it is both an injection and a surjection. *)
45+
(***************************************************************************)
46+
Bijection(S,T) == Injection(S,T) \cap Surjection(S,T)
47+
48+
49+
(***************************************************************************)
50+
(* An injection, surjection, or bijection exists if the corresponding set *)
51+
(* is nonempty. *)
52+
(***************************************************************************)
53+
ExistsInjection(S,T) == Injection(S,T) # {}
54+
ExistsSurjection(S,T) == Surjection(S,T) # {}
55+
ExistsBijection(S,T) == Bijection(S,T) # {}
56+
57+
58+
=============================================================================
59+
\* Modification History
60+
\* Last modified Wed Jul 10 20:32:37 CEST 2013 by merz
61+
\* Last modified Wed Jun 05 12:14:19 CEST 2013 by bhargav
62+
\* Last modified Fri May 03 12:55:35 PDT 2013 by tomr
63+
\* Created Thu Apr 11 10:30:48 PDT 2013 by tomr

0 commit comments

Comments
 (0)