src/HOL/Relation.ML
changeset 5978 fa2c2dd74f8c
parent 5811 0867068942e6
child 5995 450cd1f0270b
equal deleted inserted replaced
5977:9f0c8869cf71 5978:fa2c2dd74f8c
    22 
    22 
    23 Goalw [Id_def] "(a,b):Id = (a=b)";
    23 Goalw [Id_def] "(a,b):Id = (a=b)";
    24 by (Blast_tac 1);
    24 by (Blast_tac 1);
    25 qed "pair_in_Id_conv";
    25 qed "pair_in_Id_conv";
    26 Addsimps [pair_in_Id_conv];
    26 Addsimps [pair_in_Id_conv];
       
    27 
       
    28 
       
    29 (** Diagonal relation: indentity restricted to some set **)
       
    30 
       
    31 (*** Equality : the diagonal relation ***)
       
    32 
       
    33 Goalw [diag_def] "[| a=b;  a:A |] ==> (a,b) : diag(A)";
       
    34 by (Blast_tac 1);
       
    35 qed "diag_eqI";
       
    36 
       
    37 val diagI = refl RS diag_eqI |> standard;
       
    38 
       
    39 (*The general elimination rule*)
       
    40 val major::prems = Goalw [diag_def]
       
    41     "[| c : diag(A);  \
       
    42 \       !!x y. [| x:A;  c = (x,x) |] ==> P \
       
    43 \    |] ==> P";
       
    44 by (rtac (major RS UN_E) 1);
       
    45 by (REPEAT (eresolve_tac [asm_rl,singletonE] 1 ORELSE resolve_tac prems 1));
       
    46 qed "diagE";
       
    47 
       
    48 AddSIs [diagI];
       
    49 AddSEs [diagE];
       
    50 
       
    51 Goal "((x,y) : diag A) = (x=y & x : A)";
       
    52 by (Blast_tac 1);
       
    53 qed "diag_iff";
       
    54 
       
    55 Goal "diag(A) <= A Times A";
       
    56 by (Blast_tac 1);
       
    57 qed "diag_subset_Sigma";
       
    58 
    27 
    59 
    28 
    60 
    29 (** Composition of two relations **)
    61 (** Composition of two relations **)
    30 
    62 
    31 Goalw [comp_def]
    63 Goalw [comp_def]
   150 Goal "Domain Id = UNIV";
   182 Goal "Domain Id = UNIV";
   151 by (Blast_tac 1);
   183 by (Blast_tac 1);
   152 qed "Domain_Id";
   184 qed "Domain_Id";
   153 Addsimps [Domain_Id];
   185 Addsimps [Domain_Id];
   154 
   186 
       
   187 Goal "Domain (diag A) = A";
       
   188 by Auto_tac;
       
   189 qed "Domain_diag";
       
   190 Addsimps [Domain_diag];
       
   191 
   155 Goal "Domain(A Un B) = Domain(A) Un Domain(B)";
   192 Goal "Domain(A Un B) = Domain(A) Un Domain(B)";
   156 by (Blast_tac 1);
   193 by (Blast_tac 1);
   157 qed "Domain_Un_eq";
   194 qed "Domain_Un_eq";
   158 
   195 
   159 Goal "Domain(A Int B) <= Domain(A) Int Domain(B)";
   196 Goal "Domain(A Int B) <= Domain(A) Int Domain(B)";