SlideShare a Scribd company logo
1 of 34
Program Analysis using  Random  Interpretation Sumit Gulwani UC-Berkeley March 2005
Program Analysis ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Design choices in Program Analysis ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Random   Interpretation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example 1 a := 0; b := i; a := i-2; b := 2; c := b – a;  d := i – 2b; assert(c+d = 0); assert(c = a+i) c := 2a + b; d := b – 2i; True False False True * *
Example 1: Random Testing a := 0; b := i; a := i-2; b := 2; c := b – a;  d := i – 2b; assert(c+d = 0); assert(c = a+i) c := 2a + b; d := b – 2i; True False False True * * ,[object Object],[object Object],[object Object]
Example 1: Abstract Interpretation a+b=i a+b=i, c=-d a=i-2, b=2 a+b=i  c=2a+b, d=b-2i a+b=i c=b-a, d=i-2b a=0, b=i a := 0; b := i; a := i-2; b := 2; c := b – a;  d := i – 2b; assert(c+d = 0); assert(c = a+i) c := 2a + b; d := b – 2i; True False False True * * ,[object Object],[object Object]
Example 1: Random Interpretation a := 0; b := i; a := i-2; b := 2; c := b – a;  d := i – 2b; assert(c+d = 0); assert(c = a+i) c := 2a + b; d := b – 2i; True False False True * * ,[object Object],[object Object],[object Object],[object Object]
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
Linear relationships in programs with linear assignments ,[object Object],[object Object],[object Object],[object Object],[object Object]
Basic idea in random interpretation ,[object Object],[object Object],[object Object],[object Object],[object Object]
Idea #1: The Affine Join operation ,[object Object],[object Object],[object Object],[object Object],w = 7 a = 2 b = 3 a = 4 b = 1 a =   7 (2,4) = -10 b =   7 (3,1) = 15
Idea #1: The Affine Join operation ,[object Object],[object Object],[object Object],[object Object],[object Object],w = 5 w = 7 a =   5 (2,4) = -6 b =   5 (3,1) = 11 a = 2 b = 3 a = 4 b = 1 a =   7 (2,4) = -10 b =   7 (3,1) = 15
Geometric Interpretation of Affine Join a b a + b = 5 b = 2 (a = 2, b = 3) (a = 4, b = 1) : State before the join : State after the join satisfies all the affine relationships that are satisfied by both  (e.g. a + b = 5) Given any relationship that is  not  satisfied by any of  (e.g. b=2),  also does not satisfy  it  with high probability
i=3, a=0, b=3 i=3 a := 0; b := i; a := i-2; b := 2; c := b – a;  d := i – 2b; assert (c+d = 0); assert (c = a+i) i=3, a=-4, b=7 i=3, a=-4, b=7 c=23, d=-23   c := 2a + b; d := b – 2i; i=3, a=1, b=2 i=3, a=-4, b=7 c=-1, d=1 i=3, a=-4, b=7  c=11, d=-11 False False w 1  = 5 w 2  = 2 True True * * Example 1 ,[object Object],[object Object],[object Object]
Example 2 ,[object Object],a := x + y b := a b := 2x assert (b = 2x) True False x = y ?
Idea #2: The Adjust Operation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Geometric Interpretation of Adjust ,[object Object],[object Object],[object Object],Algorithm to obtain S’ = Adjust(S, e=0) S 4 S 2 S 3 S 1 S’ 3 S’ 1 S’ 2 Hyperplane e = 0
Correctness of Random Interpreter R ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Proof Methodology ,[object Object],[object Object],[object Object]
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
Problem: Global value numbering a := 5; x := a*b; y := 5*b; z := b*a; a := 5; x := F(a,b); y := F(5,b); z := F(b,a); ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Abstraction
assert(x = y);  assert(z = F(y));  * x =   (a,b) y =   (a,b) z =   (F(a),F(b)) F(y) = F(  (a,b)) ,[object Object],[object Object],[object Object],[object Object],x := a; y := a; z := F(a);   x := b; y := b; z := F(b);  Example True False
How to “execute” uninterpreted functions ? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Random Linear Interpretation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Encodings e =  r 1 ( r 1 a+ r 2 b) +  r 2 ( r 1 c+ r 2 d)  =  r 1 2 (a)+ r 1 r 2 (b)+ r 2 r 1 (c)+ r 2 2 (d) e’ =  r 1 2 (a)+ r 1 r 2   (c)+ r 2 r 1 (b)+ r 2 2 (d) F F F a b c d e   = F F F a c b d e’ =
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example a := 0; b := i; a := i-2; b := 2; c := b – a;  d := i – 2b; assert (c + d = 0); assert (c = a + i) c := 2a + b; d := b  –  2i; True False False ,[object Object],[object Object],True * *
i=2   a=0, b=i a := 0; b := i; a := i-2; b := 2; c := b – a;  d := i – 2b; assert (c+d = 0); assert (c = a+i) a=8-4i, b=5i-8 a=8-4i, b=5i-8 c=21i-40, d=40-21i  c := 2a + b; d := b – 2i; a=i-2, b=2 a=8-4i, b=5i-8 c=8-3i, d=3i-8 a=8-4i, b=5i-8  c=9i-16, d=16-9i False False w 1  = 5 w 2  = 2 Idea #1: Keep input variables symbolic ,[object Object],[object Object],a=0, b=2 c=2, d=-2   True True * *
Experiments
Experiments ,[object Object],[object Object],Randomized  Deterministic
Experimental measure of error ,[object Object],[object Object],[object Object],S N The experimental results are better than what is predicted by theory. 0 0 0 6 0 0 0 5 0 0 0.2 4 0 3.2 64.3 3 95.5 95.5 95.5 2 2 31 2 16 2 10
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
Other applications of random interpretation  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary ,[object Object],[object Object],[object Object],[object Object],Affine Join, Adjust Linear Arithmetic Vectors Uninterpreted Fns. Symbolic i/p variables Interproc. Analysis Key Idea

More Related Content

What's hot

20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers
Computer Science Club
 
02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
Pooja Gupta
 
Data structures question paper anna university
Data structures question paper anna universityData structures question paper anna university
Data structures question paper anna university
sangeethajames07
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
AjayBahoriya
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
Raghu nath
 

What's hot (19)

Sample quizz test
Sample quizz testSample quizz test
Sample quizz test
 
20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers
 
02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
 
Network Security CS3-4
Network Security CS3-4 Network Security CS3-4
Network Security CS3-4
 
Midterm
MidtermMidterm
Midterm
 
Data structures question paper anna university
Data structures question paper anna universityData structures question paper anna university
Data structures question paper anna university
 
Technical questions
Technical questionsTechnical questions
Technical questions
 
Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
 
Core java
Core javaCore java
Core java
 
901131 examples
901131 examples901131 examples
901131 examples
 
Puzles C#
Puzles C#Puzles C#
Puzles C#
 
Variables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detailVariables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detail
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
 
C code examples
C code examplesC code examples
C code examples
 
Programming with matlab session 1
Programming with matlab session 1Programming with matlab session 1
Programming with matlab session 1
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
 

Viewers also liked

Carteles V
Carteles VCarteles V
Carteles V
jorgelp
 

Viewers also liked (13)

Culturnautes - presentació del casal d'estiu 2015
Culturnautes - presentació del casal d'estiu 2015Culturnautes - presentació del casal d'estiu 2015
Culturnautes - presentació del casal d'estiu 2015
 
Search Engine Strategies
Search Engine StrategiesSearch Engine Strategies
Search Engine Strategies
 
Carteles V
Carteles VCarteles V
Carteles V
 
Tutorial sobre NIREBLOG
Tutorial sobre NIREBLOGTutorial sobre NIREBLOG
Tutorial sobre NIREBLOG
 
86 Years of Bulls and Bears
86 Years of Bulls and Bears86 Years of Bulls and Bears
86 Years of Bulls and Bears
 
Panel on Skills for the Future
Panel on Skills for the FuturePanel on Skills for the Future
Panel on Skills for the Future
 
Art science - Nuevas tendencias dentro del arte contemporáneo part 2
Art science - Nuevas tendencias dentro del arte contemporáneo part 2Art science - Nuevas tendencias dentro del arte contemporáneo part 2
Art science - Nuevas tendencias dentro del arte contemporáneo part 2
 
Rosa parks2
Rosa parks2Rosa parks2
Rosa parks2
 
Employment in the Netherlands - 2016
Employment in the Netherlands - 2016Employment in the Netherlands - 2016
Employment in the Netherlands - 2016
 
Employment in the Netherlands - 2015
Employment in the Netherlands - 2015Employment in the Netherlands - 2015
Employment in the Netherlands - 2015
 
Presentación2
Presentación2Presentación2
Presentación2
 
Scatter gather flow control
Scatter gather flow controlScatter gather flow control
Scatter gather flow control
 
Mujeres y tecnología a lo largo de la Historia
Mujeres y tecnología a lo largo de la HistoriaMujeres y tecnología a lo largo de la Historia
Mujeres y tecnología a lo largo de la Historia
 

Similar to random test

Dti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionDti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpression
alish sha
 
(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2
Pamidimukkala Sivani
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 stud
rohassanie
 
Ramco Sample Paper 2003
Ramco  Sample  Paper 2003Ramco  Sample  Paper 2003
Ramco Sample Paper 2003
ncct
 

Similar to random test (20)

Dti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionDti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpression
 
Revision1schema C programming
Revision1schema C programmingRevision1schema C programming
Revision1schema C programming
 
Revision1 C programming
Revision1 C programmingRevision1 C programming
Revision1 C programming
 
Programming Exam Help
 Programming Exam Help Programming Exam Help
Programming Exam Help
 
(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2
 
Lecture 6 operators
Lecture 6   operatorsLecture 6   operators
Lecture 6 operators
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 stud
 
Labsheet2
Labsheet2Labsheet2
Labsheet2
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdf
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in c
 
Introduction to Python Programming.pptx
Introduction to Python Programming.pptxIntroduction to Python Programming.pptx
Introduction to Python Programming.pptx
 
APSEC2020 Keynote
APSEC2020 KeynoteAPSEC2020 Keynote
APSEC2020 Keynote
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh
 
NPTEL QUIZ.docx
NPTEL QUIZ.docxNPTEL QUIZ.docx
NPTEL QUIZ.docx
 
Type and proof structures for concurrency
Type and proof structures for concurrencyType and proof structures for concurrency
Type and proof structures for concurrency
 
Class_IX_Operators.pptx
Class_IX_Operators.pptxClass_IX_Operators.pptx
Class_IX_Operators.pptx
 
Cpl
CplCpl
Cpl
 
Digital electronics k map comparators and their function
Digital electronics k map comparators and their functionDigital electronics k map comparators and their function
Digital electronics k map comparators and their function
 
Ramco Sample Paper 2003
Ramco  Sample  Paper 2003Ramco  Sample  Paper 2003
Ramco Sample Paper 2003
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.ppt
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

random test

  • 1. Program Analysis using Random Interpretation Sumit Gulwani UC-Berkeley March 2005
  • 2.
  • 3.
  • 4.
  • 5. Example 1 a := 0; b := i; a := i-2; b := 2; c := b – a; d := i – 2b; assert(c+d = 0); assert(c = a+i) c := 2a + b; d := b – 2i; True False False True * *
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. Geometric Interpretation of Affine Join a b a + b = 5 b = 2 (a = 2, b = 3) (a = 4, b = 1) : State before the join : State after the join satisfies all the affine relationships that are satisfied by both (e.g. a + b = 5) Given any relationship that is not satisfied by any of (e.g. b=2), also does not satisfy it with high probability
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.