@@ -1310,6 +1310,49 @@ THEOREM SumFunctionOnSetZero ==
13101310 < 2 > . P ( S ) BY < 1 > 1 , < 1 > 2 , FS_Induction , IsaM ( "iprover" )
13111311 < 2 > . QED BY DEF P
13121312
1313+ (* ************************************************************************)
1314+ (* Summing a constant function over a finite set yields the constant *)
1315+ (* multiplied by the cardinality of the set. *)
1316+ (************************************************************************ *)
1317+ THEOREM SumFunctionOnSetConst ==
1318+ ASSUME NEW S , IsFiniteSet ( S ) , NEW c \in Int
1319+ PROVE SumFunctionOnSet ( [ s \in S |-> c ] , S ) = c * Cardinality ( S )
1320+ < 1 > . DEFINE fun == [ s \in S |-> c ]
1321+ < 1 > . DEFINE P ( T ) == SumFunctionOnSet ( fun , T ) = c * Cardinality ( T )
1322+ < 1 > 1 . P ( { } )
1323+ < 2 > 1 . SumFunctionOnSet ( fun , { } ) = 0
1324+ BY SumFunctionOnSetEmpty
1325+ < 2 > 2 . Cardinality ( { } ) = 0
1326+ BY FS_EmptySet
1327+ < 2 > 3 . c * Cardinality ( { } ) = 0
1328+ BY < 2 > 2
1329+ < 2 > . QED BY < 2 > 1 , < 2 > 3
1330+ < 1 > 2 . ASSUME NEW T \in SUBSET S , IsFiniteSet ( T ) , P ( T ) , NEW x \in S \ T
1331+ PROVE P ( T \union { x } )
1332+ < 2 > 1 . \A j \in T \union { x } : fun [ j ] = c
1333+ BY < 1 > 2
1334+ < 2 > 2 . \A j \in T \union { x } : fun [ j ] \in Int
1335+ BY < 2 > 1 , c \in Int
1336+ < 2 > 3 . SumFunctionOnSet ( fun , T \union { x } ) = fun [ x ] + SumFunctionOnSet ( fun , T )
1337+ BY < 1 > 2 , < 2 > 2 , SumFunctionOnSetAddIndex
1338+ < 2 > 4 . fun [ x ] = c
1339+ BY < 1 > 2
1340+ < 2 > 5 . Cardinality ( T \union { x } ) = Cardinality ( T ) + 1
1341+ BY < 1 > 2 , FS_AddElement
1342+ < 2 > 6 . Cardinality ( T ) \in Nat
1343+ BY < 1 > 2 , FS_CardinalityType
1344+ < 2 > 7 . SumFunctionOnSet ( fun , T \union { x } ) = c + c * Cardinality ( T )
1345+ BY < 1 > 2 , < 2 > 3 , < 2 > 4
1346+ < 2 > 8 . c + c * Cardinality ( T ) = c * ( Cardinality ( T ) + 1 )
1347+ BY < 2 > 6
1348+ < 2 > 9 . c * ( Cardinality ( T ) + 1 ) = c * Cardinality ( T \union { x } )
1349+ BY < 2 > 5
1350+ < 2 > . QED BY < 2 > 7 , < 2 > 8 , < 2 > 9
1351+ < 1 > . QED
1352+ < 2 > . HIDE DEF P
1353+ < 2 > . P ( S ) BY < 1 > 1 , < 1 > 2 , FS_Induction , IsaM ( "iprover" )
1354+ < 2 > . QED BY DEF P
1355+
13131356(* ************************************************************************)
13141357(* Summing a function is monotonic in the function argument. *)
13151358(************************************************************************ *)
@@ -1401,6 +1444,18 @@ THEOREM SumFunctionZero ==
14011444 PROVE SumFunction ( fun ) = 0 <=> \A x \in DOMAIN fun : fun [ x ] = 0
14021445BY SumFunctionOnSetZero DEF SumFunction
14031446
1447+ THEOREM SumFunctionConst ==
1448+ ASSUME NEW S , IsFiniteSet ( S ) , NEW c \in Int
1449+ PROVE SumFunction ( [ s \in S |-> c ] ) = c * Cardinality ( S )
1450+ < 1 > . DEFINE fun == [ s \in S |-> c ]
1451+ < 1 > 1 . DOMAIN fun = S
1452+ OBVIOUS
1453+ < 1 > 2 . SumFunction ( fun ) = SumFunctionOnSet ( fun , S )
1454+ BY < 1 > 1 DEF SumFunction
1455+ < 1 > 3 . SumFunctionOnSet ( fun , S ) = c * Cardinality ( S )
1456+ BY SumFunctionOnSetConst
1457+ < 1 > . QED BY < 1 > 2 , < 1 > 3
1458+
14041459THEOREM SumFunctionMonotonic ==
14051460 ASSUME NEW f , IsFiniteSet ( DOMAIN f ) , NEW g , DOMAIN g = DOMAIN f ,
14061461 \A x \in DOMAIN f : f [ x ] \in Int ,
0 commit comments