@@ -1310,10 +1310,38 @@ THEOREM SumFunctionOnSetZero ==
13101310 < 2 > . P ( S ) BY < 1 > 1 , < 1 > 2 , FS_Induction , IsaM ( "iprover" )
13111311 < 2 > . QED BY DEF P
13121312
1313+ (* ************************************************************************)
1314+ (* Given any Int-valued function f and finite set S such that f[s] = c *)
1315+ (* for all s \in S, summing f over S yields c multiplied by the *)
1316+ (* cardinality of S. *)
1317+ (************************************************************************ *)
1318+ THEOREM SumFunctionOnSetConst ==
1319+ ASSUME NEW D , NEW S \in SUBSET D , IsFiniteSet ( S ) ,
1320+ NEW f \in [ D -> Int ] , NEW c \in Int , \A x \in S : f [ x ] = c
1321+ PROVE SumFunctionOnSet ( f , S ) = c * Cardinality ( S )
1322+ < 1 > . DEFINE P ( T ) == SumFunctionOnSet ( f , T ) = c * Cardinality ( T )
1323+ < 1 > 1 . P ( { } )
1324+ < 2 > 1 . SumFunctionOnSet ( f , { } ) = 0
1325+ BY SumFunctionOnSetEmpty
1326+ < 2 > 2 . Cardinality ( { } ) = 0
1327+ BY FS_EmptySet
1328+ < 2 > . QED BY < 2 > 1 , < 2 > 2
1329+ < 1 > 2 . ASSUME NEW T \in SUBSET S , IsFiniteSet ( T ) , P ( T ) , NEW x \in S \ T
1330+ PROVE P ( T \union { x } )
1331+ < 2 > 1 . SumFunctionOnSet ( f , T \union { x } ) = c + SumFunctionOnSet ( f , T )
1332+ BY < 1 > 2 , SumFunctionOnSetAddIndex
1333+ < 2 > 2 . Cardinality ( T \union { x } ) = Cardinality ( T ) + 1
1334+ BY < 1 > 2 , FS_AddElement
1335+ < 2 > 3 . Cardinality ( T ) \in Nat
1336+ BY < 1 > 2 , FS_CardinalityType
1337+ < 2 > . QED BY < 1 > 2 , < 2 > 1 , < 2 > 2 , < 2 > 3
1338+ < 1 > . QED BY < 1 > 1 , < 1 > 2 , FS_Induction , IsaM ( "iprover" )
1339+
13131340(* ************************************************************************)
13141341(* Summing a constant function over a finite set yields the constant *)
13151342(* multiplied by the cardinality of the set. *)
13161343(*************************************************************************)
1344+ (*
13171345THEOREM SumFunctionOnSetConst ==
13181346 ASSUME NEW S, IsFiniteSet(S), NEW c \in Int
13191347 PROVE SumFunctionOnSet([s \in S |-> c], S) = c * Cardinality(S)
@@ -1352,6 +1380,7 @@ THEOREM SumFunctionOnSetConst ==
13521380 <2>. HIDE DEF P
13531381 <2>. P(S) BY <1>1, <1>2, FS_Induction, IsaM("iprover")
13541382 <2>. QED BY DEF P
1383+ *)
13551384
13561385(* ************************************************************************)
13571386(* Summing a function is monotonic in the function argument. *)
@@ -1447,6 +1476,8 @@ BY SumFunctionOnSetZero DEF SumFunction
14471476THEOREM SumFunctionConst ==
14481477 ASSUME NEW S , IsFiniteSet ( S ) , NEW c \in Int
14491478 PROVE SumFunction ( [ s \in S |-> c ] ) = c * Cardinality ( S )
1479+ BY SumFunctionOnSetConst DEF SumFunction
1480+ (*
14501481<1>. DEFINE fun == [s \in S |-> c]
14511482<1>1. DOMAIN fun = S
14521483 OBVIOUS
@@ -1455,6 +1486,7 @@ THEOREM SumFunctionConst ==
14551486<1>3. SumFunctionOnSet(fun, S) = c * Cardinality(S)
14561487 BY SumFunctionOnSetConst
14571488<1>. QED BY <1>2, <1>3
1489+ *)
14581490
14591491THEOREM SumFunctionMonotonic ==
14601492 ASSUME NEW f , IsFiniteSet ( DOMAIN f ) , NEW g , DOMAIN g = DOMAIN f ,
0 commit comments