-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathproduct_seq_scaf.pvs
33 lines (24 loc) · 1.04 KB
/
product_seq_scaf.pvs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
product_seq_scaf: THEORY
BEGIN
IMPORTING finite_sequences[posnat]
fs: VAR finite_sequence
product_rec(fs: finite_sequence, i: below(length(fs)) ): RECURSIVE posnat =
IF i = 0 THEN seq(fs)(0)
ELSE seq(fs)(i) * product_rec(fs,i-1)
ENDIF MEASURE i
fs1,fs2: VAR finite_sequence
n,m: VAR nat
product_rec_mult: LEMMA n < length(fs1 o fs2) IMPLIES
product_rec(fs1 o fs2,n) =
IF n < length(fs1) THEN
product_rec(fs1,n)
ELSIF length(fs1) = 0 THEN
product_rec(fs2,n)
ELSE
product_rec(fs1,length(fs1)-1)
* product_rec(fs2,n-length(fs1))
ENDIF
product_rec_caret: LEMMA n < length(fs) AND m < length(fs)
AND n <= m IMPLIES product_rec(fs, n) =
product_rec(fs ^ (0, m), n)
END product_seq_scaf