Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

86 views

Published on

YouTube Video
https://youtu.be/6q15ytIOE3U

Speaker
Dr. Leemon Baird | Co-Founder & Chief Scientist | Hedera Hashgraph

Abstract
Dr. Leemon Baird will present an introduction to how mathematical proofs can be checked by a computer, and how this can be useful in projects where security and correctness is important. These formal methods can increase our confidence that a consensus algorithm is truly Asynchronous Byzantine Fault Tolerant (aBFT), or that a given program correctly implements that algorithm. Examples will be shown from the proofs that have been developed for the Hashgraph consensus algorithm, using the Coq Proof Assistant.

Published in: Software
  • Be the first to comment

  • Be the first to like this

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

  1. 1. Dr.Leemon Baird Co-founder + Chief Scientist
  2. 2. Formal Methods
  3. 3. FORMAL METHODS Math proofs, checked by computer 
 Prove an algorithm is “good” 
 Prove source code is “correct”
  4. 4. FORMAL METHODS Math proofs, checked by computer •Coq proof assistant
 Prove an algorithm is “good” 
 Prove source code is “correct”
  5. 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. 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. 7. Hashgraph ABFT proof Order Median          Received Famous Consensus Decision           Progress Vote Round Sees HashgraphFacts Hashgraph Majority Calculate          Cardinality Decide Relation Tact 18 Libraries
  8. 8. Library Sees SEES.HTML
  9. 9. SEES.HTML
  10. 10. x y DEFINITION OF SEES IN SEES.V
  11. 11. z z’ x y DEFINITION OF SEES IN SEES.V
  12. 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. 13. Informal lemma Informal proof Math journal lemma Math journal proof Coq lemma Coq proof 1 2 3 4 5 6 MATH PROOFS
  14. 14. v x Strongly Seeing Lemma: If any event strongly sees x, then no event strongly sees a fork of x. INFORMAL LEMMA
  15. 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. 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. 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. 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. 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. 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
  21. 21. MATH JOURNAL LEMMA
  22. 22. MATH JOURNAL PROOF
  23. 23. Coq Lemma Statement
  24. 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. 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. 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. 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. 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. 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. 30. THE TRUST LAYER OF THE INTERNET

×