generating good generators for inductive relations
play

Generating Good Generators for Inductive Relations POPL 2018 - PowerPoint PPT Presentation

Generating Good Generators for Inductive Relations POPL 2018 Leonidas Lampropoulos 1 Zoe Paraskevopoulou 2 Benjamin Pierce 1 1 University of Pennsylvania 2 Princeton University Generating Good Generators for Inductive Relations in a


  1. Generating Good Generators for Inductive Relations POPL 2018 Leonidas Lampropoulos 1 Zoe Paraskevopoulou 2 Benjamin Pierce 1 1 University of Pennsylvania 2 Princeton University

  2. Generating Good Generators for Inductive Relations in a property-based random testing tool for Coq 1 / 21

  3. ����������� ��� � � � ��� Testing with QuickChick ∀ ( x : A ) . P ( x ) More confidence! ✓ P ( a )? ✗ Counterexample! 2 / 21

  4. ����������� ��� � � � ��� Testing with QuickChick ∀ ( x : A ) .Q ( x ) ⇒ P ( x ) More confidence! ✓ ✓ Q ( a )? P ( a )? ✗ Counterexample! ✗ 3 / 21

  5. ����� � Sparse Preconditions Q 4 / 21

  6. ����� ����������������� � �� �� �� � �� ����� � ����������� ∀ ��� �� � ����� �� � ������ �� �� �� � � → �� ���� �� → • Random data generator for ���� • Type inference function • � ���� �� as a function • Decidability for � �� � � � 5 / 21

  7. ����� ����������������� � �� �� �� � �� ����� � ����������� ��� ���� ��� ������ ���� �� ����� ���������� ����� ∀ ��� �� � ����� �� � ������ �� �� �� � � → �� ���� �� → More confidence? 6 / 21

  8. � � � � � �� � � � � � �� �� � λ � ( N → N ) → N .x 6 � λ � N ��� � �� λ � N ��� �� � λ � N ����� � � λ � ( N → N ) → N ��� � λ � N ��� λ � N �� λ � N �� � λ � ( N → N ) → ( N → N ) �� λ � N �� �� λ � N ��� � λ � N ���� λ � N → N � λ � N �� λ � N → N �� �� �� � λ � N ��� � λ � N �� λ � N �� λ � N → N ���� 7 / 21

  9. � � � � � �� � � � � � �� �� � λ � ( N → N ) → N .x 6 � λ � N ��� � �� λ � N ��� �� � λ � N ����� � � λ � ( N → N ) → N ��� � λ � N ��� λ � N �� λ � N �� � λ � ( N → N ) → ( N → N ) �� λ � N �� �� λ � N ��� � λ � N ���� λ � N → N � λ � N �� λ � N → N �� �� �� � λ � N ��� � λ � N �� λ � N �� λ � N → N ���� 7 / 21

  10. ����������� ��� � � � Testing with Good Generators ∀ ( x : A ) .Q ( x ) ⇒ P ( x ) More confidence! ✓ ��� such that Q ( � ) P ( a )? Counterexample! ✗ 8 / 21

  11. ����� � Counterexample Q 9 / 21

  12. �������� ∀ ( x : A ) .Q ( x ) ⇒ P ( x ) ����� � is good if Soundness x ∈ range ( gen ) ⇒ Q ( x ) and Completeness x ∈ Q ( x ) ⇒ range ( gen ) 10 / 21

  13. Generate only well-typed terms! �������� � ��� → ���� → � ���� such that e ∈ range ( gen _ term Γ t ) ⇒ Γ ⊢ e : t Make sure that all of them can be generated! Γ ⊢ e : t ⇒ e ∈ range ( gen _ term Γ t ) 11 / 21

  14. � ����� � � �� ��������� ���� � �������� �� ����� ����� ���� ���� ��������� ����� ���� ���� ���� ��� ����� ��� ���� ��������� ����� ��� ����� ����� ��������� ����� � � �� ��������� ���� � ����� � � �� ��������� ���� ��������� ����� ���� �� ������ ��� ����� ��� ���� ��������� ����� ��� ����� ���� ��������� � � �� � ����� ���� ���� �� �������� ������� ����� � ���� ���� � ���� ����� ����� ����� � � ������� ����� := ���� ���� � ← ����� ���� � � ��� �� ��� � ��� ����� � � �� ��� � ← ���������� ��������� ����� ���� ��� ���� ���� � ← ����� ���� � � ��� �� ��� � ��� ����� Testing an Optimising Compiler by Generating Random Lambda Terms. Michal H. Palka, Koen Claessen, Alejandro Russo, and John Hughes. AST ’11 � � �� ��� � ← ���������� ��������� ����� ���� ��� ��� ����� ��� ���� ���� �� ← ������� ����� ����� �� ���� ����� ��� ��� ���� ← ���������� ���� �� ← ������� ����� ��� ������ ���� ����� ���� �� ← ������� ����� ��� ����� 12 / 21

  15. � ����� � � �� ��������� ���� � �������� �� ����� ����� ���� ���� ��������� ����� ���� ���� ���� ��� ����� ��� ���� ��������� ����� ��� ����� ����� ��������� ����� � � �� ��������� ���� � ����� � � �� ��������� ���� ��������� ����� ���� �� ������ ��� ����� ��� ���� ��������� ����� ��� ����� ���� ��������� � � �� � ����� ���� ���� �� �������� ������� ����� � ���� ���� � ���� ����� ����� ����� � � ������� ����� := ���� ���� � ← ����� ���� � � ��� �� ��� � ��� ����� � � �� ��� � ← ���������� ��������� ����� ���� ��� ���� ���� � ← ����� ���� � � ��� �� ��� � ��� ����� Testing an Optimising Compiler by Generating Random Lambda Terms. Michal H. Palka, Koen Claessen, Alejandro Russo, and John Hughes. AST ’11 � � �� ��� � ← ���������� ��������� ����� ���� ��� ��� ����� ��� ���� ���� �� ← ������� ����� ����� �� ���� ����� ��� ��� ���� ← ���������� ���� �� ← ������� ����� ��� ������ ���� ����� ���� �� ← ������� ����� ��� ����� 12 / 21

  16. Generating Good Generators ��������� ��� 1 → � 2 → ���� ����� 2 � � 1 → ����� and ∀ a 1 , range ( gen _ A 2 a 1 ) ≡ { a 2 | Q a 1 a 2 } 13 / 21

  17. Generating Good Generators ��������� ��������� ��� → ���� → ���� → ���� ��������� ��� → ���� → ����� 14 / 21

  18. ��������� � ��� � ����� � ���� � � �� ��� ���� � ����� �� �� �� ���� � �������� ��� �� � ��� ��� ����� ���� �� ��� ��� � ��� �� �������� �������� � à � ���� �� � ����� � � ������� ����� := 15 / 21

  19. ��������� � ��� � ����� � ���� � � �� ��� ���� � ����� �� �� �� ���� � �������� ��� �� � ��� ��� ����� ���� �� ��� ��� � ��� �� �������� �������� � Γ � ���� �� � ����� � � ������� ����� := � ���� � ∀ Γ � �� ��� ��� �� Γ � �� � � �� → Γ �� ���� �� �� � ����� �� �� 15 / 21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend