src/HOL/Algebra/FiniteProduct.thy
changeset 20318 0e0ea63fe768
parent 16638 3dc904d93767
child 22265 3c5c6bdf61de
equal deleted inserted replaced
20317:6e070b33e72b 20318:0e0ea63fe768
     3     Author:     Clemens Ballarin, started 19 November 2002
     3     Author:     Clemens Ballarin, started 19 November 2002
     4 
     4 
     5 This file is largely based on HOL/Finite_Set.thy.
     5 This file is largely based on HOL/Finite_Set.thy.
     6 *)
     6 *)
     7 
     7 
     8 header {* Product Operator for Commutative Monoids *}
       
     9 
       
    10 theory FiniteProduct imports Group begin
     8 theory FiniteProduct imports Group begin
       
     9 
       
    10 
       
    11 section {* Product Operator for Commutative Monoids *}
       
    12 
       
    13 
       
    14 subsection {* Inductive Definition of a Relation for Products over Sets *}
    11 
    15 
    12 text {* Instantiation of locale @{text LC} of theory @{text Finite_Set} is not
    16 text {* Instantiation of locale @{text LC} of theory @{text Finite_Set} is not
    13   possible, because here we have explicit typing rules like 
    17   possible, because here we have explicit typing rules like 
    14   @{text "x \<in> carrier G"}.  We introduce an explicit argument for the domain
    18   @{text "x \<in> carrier G"}.  We introduce an explicit argument for the domain
    15   @{text D}. *}
    19   @{text D}. *}
    56   with y and insert have "(insert x F, f x y) \<in> foldSetD D f e"
    60   with y and insert have "(insert x F, f x y) \<in> foldSetD D f e"
    57     by (intro foldSetD.intros) auto
    61     by (intro foldSetD.intros) auto
    58   then show ?case ..
    62   then show ?case ..
    59 qed
    63 qed
    60 
    64 
    61 subsection {* Left-commutative operations *}
    65 
       
    66 subsection {* Left-Commutative Operations *}
    62 
    67 
    63 locale LCD =
    68 locale LCD =
    64   fixes B :: "'b set"
    69   fixes B :: "'b set"
    65   and D :: "'a set"
    70   and D :: "'a set"
    66   and f :: "'b => 'a => 'a"    (infixl "\<cdot>" 70)
    71   and f :: "'b => 'a => 'a"    (infixl "\<cdot>" 70)
   224   empty_foldSetDE [rule del]
   229   empty_foldSetDE [rule del]
   225   foldSetD.intros [rule del]
   230   foldSetD.intros [rule del]
   226 declare (in LCD)
   231 declare (in LCD)
   227   foldSetD_closed [rule del]
   232   foldSetD_closed [rule del]
   228 
   233 
   229 subsection {* Commutative monoids *}
   234 
       
   235 subsection {* Commutative Monoids *}
   230 
   236 
   231 text {*
   237 text {*
   232   We enter a more restrictive context, with @{text "f :: 'a => 'a => 'a"}
   238   We enter a more restrictive context, with @{text "f :: 'a => 'a => 'a"}
   233   instead of @{text "'b => 'a => 'a"}.
   239   instead of @{text "'b => 'a => 'a"}.
   234 *}
   240 *}
   277 lemma (in ACeD) foldD_Un_disjoint:
   283 lemma (in ACeD) foldD_Un_disjoint:
   278   "[| finite A; finite B; A Int B = {}; A \<subseteq> D; B \<subseteq> D |] ==>
   284   "[| finite A; finite B; A Int B = {}; A \<subseteq> D; B \<subseteq> D |] ==>
   279     foldD D f e (A Un B) = foldD D f e A \<cdot> foldD D f e B"
   285     foldD D f e (A Un B) = foldD D f e A \<cdot> foldD D f e B"
   280   by (simp add: foldD_Un_Int
   286   by (simp add: foldD_Un_Int
   281     left_commute LCD.foldD_closed [OF LCD.intro [of D]] Un_subset_iff)
   287     left_commute LCD.foldD_closed [OF LCD.intro [of D]] Un_subset_iff)
       
   288 
   282 
   289 
   283 subsection {* Products over Finite Sets *}
   290 subsection {* Products over Finite Sets *}
   284 
   291 
   285 constdefs (structure G)
   292 constdefs (structure G)
   286   finprod :: "[('b, 'm) monoid_scheme, 'a => 'b, 'a set] => 'b"
   293   finprod :: "[('b, 'm) monoid_scheme, 'a => 'b, 'a set] => 'b"