@EricHolloway/

# ASC Lower Bound Violations

## Shows that deriving a probability lower bound from ASC does not result in violations of an a priori discount.

Files
• main.py
main.py
```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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
```
```import math

f = math.factorial
def nCk(n,k):
return f(n) / f(k) / f(n-k)

def binom(n,k,p):
return nCk(n,k)*p**k*(1-p)**(n-k)

def lg2(n):
if n == 0:
return 0
return math.log(n, 2)

def err_penalty(errs, bits):
if errs == 0:
return 2
prefix = (lg2(errs)+1)*2 + (lg2(bits)+1)*2
penalty = errs * bits
return prefix + penalty

bits = 8

total = 2**bits

discount = bits

violations = 0
for cls0_cnt in range(0, total/2):
cls1_cnt = total - cls0_cnt

penalty = err_penalty(cls0_cnt, bits) + discount
ASC = total - penalty
lower_bound = 2**(-penalty/float(total))

rslt_prob = 0
for cls0_cnt2 in range(0, cls0_cnt+1):
rslt_prob += binom(total, cls0_cnt2, 1-lower_bound)

accidental_generation = -int(round(lg2(rslt_prob)))

if accidental_generation < discount:
violations += 1

print "Violations:", violations

```