Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Shannon Probabilistic Proofs #899

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
069851f
Probabilistic proofs doc WIP
Olshansk Oct 30, 2024
afe4c6a
Quick interim commit
Olshansk Oct 31, 2024
a015163
Checkpoint commit
Olshansk Oct 31, 2024
4b990fc
First draft complete
Olshansk Oct 31, 2024
b683816
Made docusarusu work
Olshansk Oct 31, 2024
384d796
Merge branch 'main' into probabilistic_proofs_docs
Olshansk Nov 6, 2024
a8dbec0
Merge branch 'main' into probabilistic_proofs_docs
Olshansk Nov 11, 2024
13a5f50
Merge with main
Olshansk Dec 17, 2024
c49d344
Update package log
Olshansk Dec 17, 2024
790d1e9
Apply suggestions from code review
Olshansk Dec 17, 2024
c92fc1a
A few TODOs
Olshansk Dec 17, 2024
05d7407
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
fe31c76
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
56a1276
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
b37e10f
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
0659d9b
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
a4f346c
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
e2505ba
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
8f8d320
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
f953a98
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
5f16e9c
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
24649dc
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
79580b8
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
c9c7fed
Some nits
Olshansk Dec 17, 2024
aadb39c
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
918b215
Update docusaurus/docs/protocol/primitives/probabilistic_proofs.md
Olshansk Dec 17, 2024
4b767c2
Incoporating everyone's feedback before doing the hard work
Olshansk Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus/docs/protocol/primitives/gateways.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Gateways
sidebar_position: 4
sidebar_position: 3
---

# Gateways <!-- omit in toc -->
Expand Down
672 changes: 660 additions & 12 deletions docusaurus/docs/protocol/primitives/probabilistic_proofs.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import matplotlib.pyplot as plt
import numpy as np

# Define different ProofRequestProbability values
p_values = [0.1, 0.25, 0.5, 0.75] # Modify as needed
k_values = np.arange(0, 21) # Range of k values starting from 0

# Create subplots side by side
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6))

# Plot Geometric PDF for different p values
for p in p_values:
q = 1 - p
pdf_values = p * (1 - p) ** k_values
ax1.plot(k_values, pdf_values, marker="o", linestyle="-", label=f"p = {p}")

ax1.set_title("Geometric PDF: Exactly k Failures Until 1st Success")
ax1.set_xlabel("Number of Failures before First Success (k)")
ax1.set_ylabel("Probability Pr(X = k)")
ax1.set_xticks(k_values)
ax1.grid(True)
ax1.legend()

# Plot Geometric CDF for different p values
for p in p_values:
q = 1 - p
cdf_values = 1 - (1 - p) ** (k_values + 1)
ax2.plot(k_values, cdf_values, marker="o", linestyle="-", label=f"p = {p}")

ax2.set_title("Geometric CDF: ≤ k Failures Until 1st Success")
ax2.set_xlabel("Number of Failures before First Success (k)")
ax2.set_ylabel("Cumulative Probability P(X ≤ k)")
ax2.set_xticks(k_values)
ax2.grid(True)
ax2.legend()

# Adjust layout and display the plots
plt.tight_layout()
plt.show()
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import matplotlib.pyplot as plt
import numpy as np

p_values = np.linspace(0.01, 0.5, 100)
R_values = [10, 100, 1000, 10000]

for R in R_values:
S_values = R * ((1 - p_values) / p_values)
plt.plot(p_values, S_values, label=f"R = {R} POKT")

plt.xlabel("ProofRequestProbability (p)")
plt.ylabel("Required Penalty (S POKT)")
plt.title("Penalty vs. ProofRequestProbability for Different Reward Values")
plt.legend()
plt.yscale("log") # Use logarithmic scale for y-axis (optional)
plt.grid(True, which="both", ls="--")
plt.show()
Loading
Loading