src/HOL/Relation.ML
changeset 5978 fa2c2dd74f8c
parent 5811 0867068942e6
child 5995 450cd1f0270b
     1.1 --- a/src/HOL/Relation.ML	Thu Nov 26 17:40:10 1998 +0100
     1.2 +++ b/src/HOL/Relation.ML	Fri Nov 27 10:40:29 1998 +0100
     1.3 @@ -26,6 +26,38 @@
     1.4  Addsimps [pair_in_Id_conv];
     1.5  
     1.6  
     1.7 +(** Diagonal relation: indentity restricted to some set **)
     1.8 +
     1.9 +(*** Equality : the diagonal relation ***)
    1.10 +
    1.11 +Goalw [diag_def] "[| a=b;  a:A |] ==> (a,b) : diag(A)";
    1.12 +by (Blast_tac 1);
    1.13 +qed "diag_eqI";
    1.14 +
    1.15 +val diagI = refl RS diag_eqI |> standard;
    1.16 +
    1.17 +(*The general elimination rule*)
    1.18 +val major::prems = Goalw [diag_def]
    1.19 +    "[| c : diag(A);  \
    1.20 +\       !!x y. [| x:A;  c = (x,x) |] ==> P \
    1.21 +\    |] ==> P";
    1.22 +by (rtac (major RS UN_E) 1);
    1.23 +by (REPEAT (eresolve_tac [asm_rl,singletonE] 1 ORELSE resolve_tac prems 1));
    1.24 +qed "diagE";
    1.25 +
    1.26 +AddSIs [diagI];
    1.27 +AddSEs [diagE];
    1.28 +
    1.29 +Goal "((x,y) : diag A) = (x=y & x : A)";
    1.30 +by (Blast_tac 1);
    1.31 +qed "diag_iff";
    1.32 +
    1.33 +Goal "diag(A) <= A Times A";
    1.34 +by (Blast_tac 1);
    1.35 +qed "diag_subset_Sigma";
    1.36 +
    1.37 +
    1.38 +
    1.39  (** Composition of two relations **)
    1.40  
    1.41  Goalw [comp_def]
    1.42 @@ -152,6 +184,11 @@
    1.43  qed "Domain_Id";
    1.44  Addsimps [Domain_Id];
    1.45  
    1.46 +Goal "Domain (diag A) = A";
    1.47 +by Auto_tac;
    1.48 +qed "Domain_diag";
    1.49 +Addsimps [Domain_diag];
    1.50 +
    1.51  Goal "Domain(A Un B) = Domain(A) Un Domain(B)";
    1.52  by (Blast_tac 1);
    1.53  qed "Domain_Un_eq";