SlideShare a Scribd company logo
Dr.Leemon Baird
Co-founder + Chief Scientist
Formal Methods
FORMAL METHODS
Math proofs, checked by computer


Prove an algorithm is “good”


Prove source code is “correct”
FORMAL METHODS
Math proofs, checked by computer
•Coq proof assistant

Prove an algorithm is “good”


Prove source code is “correct”
FORMAL METHODS
Math proofs, checked by computer
•Coq proof assistant

Prove an algorithm is “good”
•Hashgraph consensus is ABFT

Prove source code is “correct”
FORMAL METHODS
Math proofs, checked by computer
•Coq proof assistant

Prove an algorithm is “good”
•Hashgraph consensus is ABFT

Prove source code is “correct”
•Java implements Hashgraph consensus
•Source code open review
Hashgraph
ABFT proof
Order
Median         
Received
Famous
Consensus
Decision       
  
Progress
Vote
Round
Sees
HashgraphFacts
Hashgraph
Majority
Calculate         
Cardinality
Decide
Relation
Tact
18 Libraries
Library Sees
SEES.HTML
SEES.HTML
x
y
DEFINITION OF SEES IN SEES.V
z z’
x
y
DEFINITION OF SEES IN SEES.V
x is an ancestor of y
AND there are no two events z and z’ for which:
z is an ancestor of y
AND z’ is an ancestor of y
AND z and z’ are “forks” 

AND z and x have the same creator
x @= y
/ ~ exists z z’,
z @= y
/ z’ @= y
/ fork z z’
/ creator z = creator x.
Say “sees x y” which means event y can see event x, meaning:
Definition sees ( x y : event) : Prop :=
z z’
x
y
DEFINITION OF SEES IN SEES.V
Informal lemma
Informal proof
Math journal lemma
Math journal proof
Coq lemma
Coq proof
1
2
3
4
5
6
MATH PROOFS
v
x
Strongly Seeing Lemma:
If any event strongly sees x, then no event strongly sees a fork of x.
INFORMAL LEMMA
Informal
Proof
Strongly Seeing Lemma:
If any event strongly sees x, then no event strongly
sees a fork of x.
v
x
> 2/3
Strongly Seeing Lemma:
If any event strongly sees x, then no event strongly
sees a fork of x.
v
x
w
y
Informal
Proof > 2/3 > 2/3
Strongly Seeing Lemma:
If any event strongly sees x, then no event strongly
sees a fork of x.
v
x
> 2/3
w
y
> 2/3> 1/3Informal
Proof
Strongly Seeing Lemma:
If any event strongly sees x, then no event strongly
sees a fork of x.
v
x
w
y
< 1/3
Informal
Proof > 2/3 > 2/3> 1/3
Strongly Seeing Lemma:
If any event strongly sees x, then no event strongly
sees a fork of x.
v
x
w
y
a
b
Informal
Proof
< 1/3
> 2/3 > 2/3> 1/3
Strongly Seeing Lemma:
If any event strongly sees x, then no event strongly
sees a fork of x.
v
x
w
y
a
b
Informal
Proof
< 1/3
> 2/3 > 2/3> 1/3
MATH JOURNAL LEMMA
MATH JOURNAL PROOF
Coq Lemma
Statement
Coq Lemma
Proof
Proof.
1 subgoal
______________________________________(1/1)
forall (W : world) (x y v w : event),
member W v ->
member W w -> fork x y -> stsees x v -> stsees y w -> False
Proof.
intros W x y v w Wv Ww Hfork Hssx Hssy.
1 subgoal
W : world
x, y, v, w : event
Wv : member W v
Ww : member W w
Hfork : fork x y
Hssx : stsees x v
Hssy : stsees y w
______________________________________(1/1)
False
Coq Lemma
Proof
Proof.
intros W x y v w Wv Ww Hfork Hssx Hssy.
Coq Lemma
Proof
1 subgoal
W : world
x, y, v, w : event
Wv : member W v
Ww : member W w
Hfork : fork x y
Hssx : stsees x v
Hssy : stsees y w
______________________________________(1/1)
False
Proof.
intros W x y v w Wv Ww Hfork Hssx Hssy.
destruct Hssx as (v' & Hv & Hmajx).
Coq Lemma
Proof
1 subgoal
W : world
x, y, v, w : event
Wv : member W v
Ww : member W w
Hfork : fork x y
v' : event
Hv : v' @= v
Hmajx : supermajority
(fun a : peer =>
exists z : event,
creator z = a / sees x z / sees z v') every
Hssy : stsees y w
______________________________________(1/1)
False
Proof.
intros W x y v w Wv Ww Hfork Hssx Hssy.
destruct Hssx as (v' & Hv & Hmajx).
destruct Hssy as (w' & Hw & Hmajy).
so (supermajority_intersect_3 _#5 eq_peer_decide
supermajority_honest Hmajx Hmajy) as
(a & Hhonest & Hseesx & Hseesy).
destruct Hseesx as (q & Hcrq & Hxq & Hqv').
destruct Hseesy as (r & Hcrr & Hyr & Hqw').
assert (q @= r / r @= q) as Hordered.
{
so (ancestor_decide q r) as [? | Hnqr]; auto.
so (ancestor_decide r q) as [? | Hnrq]; auto.
exfalso.
so (world_forks W _ Hhonest) as H.
destruct H.
exists q, r.
do2 3 split; auto.
{
apply (world_closed _ _ v); auto.
eapply star_trans; eauto.
apply sees_impl_ancestor; auto.
}
{
apply (world_closed _ _ w); auto.
eapply star_trans; eauto.
apply sees_impl_ancestor; auto.
}
{
do2 2 split.
{
subst a; auto.
}
{
contradict Hnqr.
apply self_ancestor_impl_ancestor; auto.
}
{
contradict Hnrq.
apply self_ancestor_impl_ancestor; auto.
}
}
}
cut (forall x y q r,
fork x y
-> sees x q
-> sees y r
-> q @= r
-> False).
{
intros H.
destruct Hordered; [eapply (H x) | eapply (H y)];
eauto using fork_symm.
}
repeat (match goal with H : _ |- _ => clear H end).
intros x y q r Hfork Hxq Hyr Hqr.
destruct Hyr as (Hyr & Hnofork).
destruct Hnofork.
exists x, y.
do2 3 split; auto using fork_creator.
destruct Hxq as (Hxq & _).
eapply star_trans; eauto.
Qed.
Coq Lemma
Proof
Prove code correctness
• Krakatoa: Prove Java code implements the
algorithm
• Coq: automatically generate code 

(OCaml, Haskell or Scheme)
Extend the algorithms
Prove the compiler, JVM, OS, microprocessor
NEXT STEPS
THE TRUST LAYER OF THE INTERNET

More Related Content

More from Hedera Hashgraph

Keynote: The Hedera Hashgraph Advantage | Hedera18
Keynote: The Hedera Hashgraph Advantage | Hedera18Keynote: The Hedera Hashgraph Advantage | Hedera18
Keynote: The Hedera Hashgraph Advantage | Hedera18
Hedera Hashgraph
 
Almond: The Reward Platform Changing the World One Scan at a Time | Hedera18
Almond: The Reward Platform Changing the World One Scan at a Time | Hedera18Almond: The Reward Platform Changing the World One Scan at a Time | Hedera18
Almond: The Reward Platform Changing the World One Scan at a Time | Hedera18
Hedera Hashgraph
 
Tracking Drug Shortages with Open APIs and Hedera Hashgraph | Hedera18
Tracking Drug Shortages with Open APIs and Hedera Hashgraph | Hedera18Tracking Drug Shortages with Open APIs and Hedera Hashgraph | Hedera18
Tracking Drug Shortages with Open APIs and Hedera Hashgraph | Hedera18
Hedera Hashgraph
 
Managing Energy Microgrids using Decentralized Structured Databases | Hedera18
Managing Energy Microgrids using Decentralized Structured Databases | Hedera18Managing Energy Microgrids using Decentralized Structured Databases | Hedera18
Managing Energy Microgrids using Decentralized Structured Databases | Hedera18
Hedera Hashgraph
 
Carbon: Accessible, Stable Money | Hedera18
Carbon: Accessible, Stable Money | Hedera18Carbon: Accessible, Stable Money | Hedera18
Carbon: Accessible, Stable Money | Hedera18
Hedera Hashgraph
 
Keynote: The future of Micropayments with Hedera Hashgraph | Hedera18
Keynote: The future of Micropayments with Hedera Hashgraph | Hedera18Keynote: The future of Micropayments with Hedera Hashgraph | Hedera18
Keynote: The future of Micropayments with Hedera Hashgraph | Hedera18
Hedera Hashgraph
 
Hedera for Music Streaming Micropayments | Hedera18
Hedera for Music Streaming Micropayments | Hedera18Hedera for Music Streaming Micropayments | Hedera18
Hedera for Music Streaming Micropayments | Hedera18
Hedera Hashgraph
 
Hedera API: Cryptocurrency 101 | Hedera18
Hedera API: Cryptocurrency 101 | Hedera18Hedera API: Cryptocurrency 101 | Hedera18
Hedera API: Cryptocurrency 101 | Hedera18
Hedera Hashgraph
 
Smart Contracts: From Zero to Dapp Hero | Hedera18
Smart Contracts: From Zero to Dapp Hero | Hedera18Smart Contracts: From Zero to Dapp Hero | Hedera18
Smart Contracts: From Zero to Dapp Hero | Hedera18
Hedera Hashgraph
 
Demystifying Distributed Ledgers | Hedera18
Demystifying Distributed Ledgers | Hedera18Demystifying Distributed Ledgers | Hedera18
Demystifying Distributed Ledgers | Hedera18
Hedera Hashgraph
 
The Power of the Memo Field | Hedera18
The Power of the Memo Field | Hedera18The Power of the Memo Field | Hedera18
The Power of the Memo Field | Hedera18
Hedera Hashgraph
 
Keynote: Hedera Cryptoeconomics with Dr. Leemon Baird | Hedera18
Keynote: Hedera Cryptoeconomics with Dr. Leemon Baird | Hedera18Keynote: Hedera Cryptoeconomics with Dr. Leemon Baird | Hedera18
Keynote: Hedera Cryptoeconomics with Dr. Leemon Baird | Hedera18
Hedera Hashgraph
 

More from Hedera Hashgraph (12)

Keynote: The Hedera Hashgraph Advantage | Hedera18
Keynote: The Hedera Hashgraph Advantage | Hedera18Keynote: The Hedera Hashgraph Advantage | Hedera18
Keynote: The Hedera Hashgraph Advantage | Hedera18
 
Almond: The Reward Platform Changing the World One Scan at a Time | Hedera18
Almond: The Reward Platform Changing the World One Scan at a Time | Hedera18Almond: The Reward Platform Changing the World One Scan at a Time | Hedera18
Almond: The Reward Platform Changing the World One Scan at a Time | Hedera18
 
Tracking Drug Shortages with Open APIs and Hedera Hashgraph | Hedera18
Tracking Drug Shortages with Open APIs and Hedera Hashgraph | Hedera18Tracking Drug Shortages with Open APIs and Hedera Hashgraph | Hedera18
Tracking Drug Shortages with Open APIs and Hedera Hashgraph | Hedera18
 
Managing Energy Microgrids using Decentralized Structured Databases | Hedera18
Managing Energy Microgrids using Decentralized Structured Databases | Hedera18Managing Energy Microgrids using Decentralized Structured Databases | Hedera18
Managing Energy Microgrids using Decentralized Structured Databases | Hedera18
 
Carbon: Accessible, Stable Money | Hedera18
Carbon: Accessible, Stable Money | Hedera18Carbon: Accessible, Stable Money | Hedera18
Carbon: Accessible, Stable Money | Hedera18
 
Keynote: The future of Micropayments with Hedera Hashgraph | Hedera18
Keynote: The future of Micropayments with Hedera Hashgraph | Hedera18Keynote: The future of Micropayments with Hedera Hashgraph | Hedera18
Keynote: The future of Micropayments with Hedera Hashgraph | Hedera18
 
Hedera for Music Streaming Micropayments | Hedera18
Hedera for Music Streaming Micropayments | Hedera18Hedera for Music Streaming Micropayments | Hedera18
Hedera for Music Streaming Micropayments | Hedera18
 
Hedera API: Cryptocurrency 101 | Hedera18
Hedera API: Cryptocurrency 101 | Hedera18Hedera API: Cryptocurrency 101 | Hedera18
Hedera API: Cryptocurrency 101 | Hedera18
 
Smart Contracts: From Zero to Dapp Hero | Hedera18
Smart Contracts: From Zero to Dapp Hero | Hedera18Smart Contracts: From Zero to Dapp Hero | Hedera18
Smart Contracts: From Zero to Dapp Hero | Hedera18
 
Demystifying Distributed Ledgers | Hedera18
Demystifying Distributed Ledgers | Hedera18Demystifying Distributed Ledgers | Hedera18
Demystifying Distributed Ledgers | Hedera18
 
The Power of the Memo Field | Hedera18
The Power of the Memo Field | Hedera18The Power of the Memo Field | Hedera18
The Power of the Memo Field | Hedera18
 
Keynote: Hedera Cryptoeconomics with Dr. Leemon Baird | Hedera18
Keynote: Hedera Cryptoeconomics with Dr. Leemon Baird | Hedera18Keynote: Hedera Cryptoeconomics with Dr. Leemon Baird | Hedera18
Keynote: Hedera Cryptoeconomics with Dr. Leemon Baird | Hedera18
 

Recently uploaded

DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
Drona Infotech
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 

Recently uploaded (20)

DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Mobile app Development Services | Drona Infotech
Mobile app Development Services  | Drona InfotechMobile app Development Services  | Drona Infotech
Mobile app Development Services | Drona Infotech
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 

Deep Dive: Formal Methods with Dr. Leemon Baird | Hedera18

  • 3. FORMAL METHODS Math proofs, checked by computer 
 Prove an algorithm is “good” 
 Prove source code is “correct”
  • 4. FORMAL METHODS Math proofs, checked by computer •Coq proof assistant
 Prove an algorithm is “good” 
 Prove source code is “correct”
  • 5. FORMAL METHODS Math proofs, checked by computer •Coq proof assistant
 Prove an algorithm is “good” •Hashgraph consensus is ABFT
 Prove source code is “correct”
  • 6. FORMAL METHODS Math proofs, checked by computer •Coq proof assistant
 Prove an algorithm is “good” •Hashgraph consensus is ABFT
 Prove source code is “correct” •Java implements Hashgraph consensus •Source code open review
  • 7. Hashgraph ABFT proof Order Median          Received Famous Consensus Decision           Progress Vote Round Sees HashgraphFacts Hashgraph Majority Calculate          Cardinality Decide Relation Tact 18 Libraries
  • 11. z z’ x y DEFINITION OF SEES IN SEES.V
  • 12. x is an ancestor of y AND there are no two events z and z’ for which: z is an ancestor of y AND z’ is an ancestor of y AND z and z’ are “forks” 
 AND z and x have the same creator x @= y / ~ exists z z’, z @= y / z’ @= y / fork z z’ / creator z = creator x. Say “sees x y” which means event y can see event x, meaning: Definition sees ( x y : event) : Prop := z z’ x y DEFINITION OF SEES IN SEES.V
  • 13. Informal lemma Informal proof Math journal lemma Math journal proof Coq lemma Coq proof 1 2 3 4 5 6 MATH PROOFS
  • 14. v x Strongly Seeing Lemma: If any event strongly sees x, then no event strongly sees a fork of x. INFORMAL LEMMA
  • 15. Informal Proof Strongly Seeing Lemma: If any event strongly sees x, then no event strongly sees a fork of x. v x > 2/3
  • 16. Strongly Seeing Lemma: If any event strongly sees x, then no event strongly sees a fork of x. v x w y Informal Proof > 2/3 > 2/3
  • 17. Strongly Seeing Lemma: If any event strongly sees x, then no event strongly sees a fork of x. v x > 2/3 w y > 2/3> 1/3Informal Proof
  • 18. Strongly Seeing Lemma: If any event strongly sees x, then no event strongly sees a fork of x. v x w y < 1/3 Informal Proof > 2/3 > 2/3> 1/3
  • 19. Strongly Seeing Lemma: If any event strongly sees x, then no event strongly sees a fork of x. v x w y a b Informal Proof < 1/3 > 2/3 > 2/3> 1/3
  • 20. Strongly Seeing Lemma: If any event strongly sees x, then no event strongly sees a fork of x. v x w y a b Informal Proof < 1/3 > 2/3 > 2/3> 1/3
  • 24. Coq Lemma Proof Proof. 1 subgoal ______________________________________(1/1) forall (W : world) (x y v w : event), member W v -> member W w -> fork x y -> stsees x v -> stsees y w -> False
  • 25. Proof. intros W x y v w Wv Ww Hfork Hssx Hssy. 1 subgoal W : world x, y, v, w : event Wv : member W v Ww : member W w Hfork : fork x y Hssx : stsees x v Hssy : stsees y w ______________________________________(1/1) False Coq Lemma Proof
  • 26. Proof. intros W x y v w Wv Ww Hfork Hssx Hssy. Coq Lemma Proof 1 subgoal W : world x, y, v, w : event Wv : member W v Ww : member W w Hfork : fork x y Hssx : stsees x v Hssy : stsees y w ______________________________________(1/1) False
  • 27. Proof. intros W x y v w Wv Ww Hfork Hssx Hssy. destruct Hssx as (v' & Hv & Hmajx). Coq Lemma Proof 1 subgoal W : world x, y, v, w : event Wv : member W v Ww : member W w Hfork : fork x y v' : event Hv : v' @= v Hmajx : supermajority (fun a : peer => exists z : event, creator z = a / sees x z / sees z v') every Hssy : stsees y w ______________________________________(1/1) False
  • 28. Proof. intros W x y v w Wv Ww Hfork Hssx Hssy. destruct Hssx as (v' & Hv & Hmajx). destruct Hssy as (w' & Hw & Hmajy). so (supermajority_intersect_3 _#5 eq_peer_decide supermajority_honest Hmajx Hmajy) as (a & Hhonest & Hseesx & Hseesy). destruct Hseesx as (q & Hcrq & Hxq & Hqv'). destruct Hseesy as (r & Hcrr & Hyr & Hqw'). assert (q @= r / r @= q) as Hordered. { so (ancestor_decide q r) as [? | Hnqr]; auto. so (ancestor_decide r q) as [? | Hnrq]; auto. exfalso. so (world_forks W _ Hhonest) as H. destruct H. exists q, r. do2 3 split; auto. { apply (world_closed _ _ v); auto. eapply star_trans; eauto. apply sees_impl_ancestor; auto. } { apply (world_closed _ _ w); auto. eapply star_trans; eauto. apply sees_impl_ancestor; auto. } { do2 2 split. { subst a; auto. } { contradict Hnqr. apply self_ancestor_impl_ancestor; auto. } { contradict Hnrq. apply self_ancestor_impl_ancestor; auto. } } } cut (forall x y q r, fork x y -> sees x q -> sees y r -> q @= r -> False). { intros H. destruct Hordered; [eapply (H x) | eapply (H y)]; eauto using fork_symm. } repeat (match goal with H : _ |- _ => clear H end). intros x y q r Hfork Hxq Hyr Hqr. destruct Hyr as (Hyr & Hnofork). destruct Hnofork. exists x, y. do2 3 split; auto using fork_creator. destruct Hxq as (Hxq & _). eapply star_trans; eauto. Qed. Coq Lemma Proof
  • 29. Prove code correctness • Krakatoa: Prove Java code implements the algorithm • Coq: automatically generate code 
 (OCaml, Haskell or Scheme) Extend the algorithms Prove the compiler, JVM, OS, microprocessor NEXT STEPS
  • 30. THE TRUST LAYER OF THE INTERNET