p r o v i n g p r o p e r t i e s o f s o r t i n g p r o

P r o v i n g P r o p e r t i e s o f S o r t - PowerPoint PPT Presentation

P r o v i n g P r o p e r t i e s o f S o r t i n g P r o g r a ms : A C a s e S t u d y i n H o r n C l a u s e V e r i fj c a t i o n 1 1 E . D e A n g e l i s , F .


  1. P r o v i n g P r o p e r t i e s o f S o r t i n g P r o g r a ms : A C a s e S t u d y i n H o r n C l a u s e V e r i fj c a t i o n 1 1 E . D e A n g e l i s , F . F i o r a v a n t i , 2 3 A . P e t t o r o s s i , a n d M. P r o i e t t i 1 U n i v e r s i t y o f C h i e t i - P e s c a r a ` G . d ' A n n u n z i o ' 2 U n i v e r s i t y o f R o me ` T o r V e r g a t a ' 3 C N R - I s t i t u t o d i A n a l i s i d e i S i s t e mi e d I n f o r ma t i c a

  2. O v e r v i e w P r o b l e m V e r i f y i n g p r o p e r t i e s o f f u n c t i o n a l p r o g r a ms o n r e c u r s i v e d a t a t y p e s O u r a p p r o a c h ● T r a n s l a t i n g p r o g r a m p r o p e r t i e s i n t o C o n s t r a i n e d H o r n C l a u s e s ( C H C s ) o n r e c u r s i v e d a t a t y p e s ● T r a n s f o r mi n g C H C s o n r e c u r s i v e d a t a t y p e s i n t o e q u i s a t i s fj a b l e C H C s o n i n t e g e r s a n d b o o l e a n s C a s e s t u d y : V e r i fj c a t i o n o f ● l i n e a r r e c u r s i v e ● n o n - l i n e a r r e c u r s i v e s o r t i n g p r o g r a ms

  3. F u n c t i o n a l p r o g r a ms o n r e c u r s i v e d a t a t y p e s ● S t a t i c a l l y t y p e d , c a l l - b y - v a l u e , F O f u n c t i o n a l l a n g u a g e ( O C a ml ) ● C o mp u t i n g t h e s u m ( ) a n d t h e ma x i mu m ( ) l i s t s u m l i s t m a x o f t h e a b s o l u t e v a l u e s ( ) o f t h e e l e me n t s o f a l i s t : a b s t y p e l i s t = N i l | C o n s o f i n t * l i s t ; ; l e t r e c l i s t s u m l = m a t c h l w i t h | N i l - > 0 � | C o n s ( x , x s ) ( a b s x ) + l i s t s u m x s ; ; l e t r r e c l i s t m a x l = m a t c h l w i t h | N i l - > 0 � l | C o n s ( x , x s ) e t m = l i s t m a x x s i n m a x ( a b s x ) m ; ; P r o p e r t y : ∀l . l > = l l i s t s u m l i s t m a x

  4. T r a n s l a t i n g P r o g r a m & P r o p e r t y i n t o C H C s Q u e r y f a l s e : - S < M , l i s t s u m ( L , S ) , l i s t m a x ( L , M ) . % l i s t s u m ( [ ] , S ) : - S = 0 . l i s t s u m ( [ X | X s ] , S ) : - S = S 1 + A , a b s ( X , A ) , l i s t s u m ( X s , S 1 ) . l i s t m a x ( [ ] , M ) : - M = 0 . l i s t m a x ( [ X | X s ] , M ) : - a b s ( X , A ) , m a x ( A , M 1 , M ) , l i s t m a x ( X s , M 1 ) . a b s ( X , A ) : - ( X > = 0 , A = X ) ; ( X = < 0 , A = - X ) . m a x ( X , Y , Z ) : - ( X = < Y - 1 , Z = Y ) ; ( X > = Y , Z = X ) . T h e p r o p e r t y h o l d s i fg t h e c l a u s e s a r e s a t i s fj a b l e ; I n d e e d t h e s e c l a u s e s a r e s a t i s fj a b l e b u t mo d e l s a r e i n fj n i t e d i s j u n c t i o n s : l i s t s u m ( L , S ) : - ( L = [ ] , S = 0 ) ; ( L = [ X ] , a b s ( X , S ) ) ; …! ( L = [ X , Y ] , a b s ( X , A ) , a b s ( Y , B ) , S = A + B ) ; l i s t m a x ( L , M ) : - ( L = [ ] , M = 0 ) ; ( L = [ A ] , a b s ( X , M ) ) ; …! ( L = [ X , Y ] , a b s ( X , A ) , a b s ( Y , B ) , m a x ( A , B , M ) ) ; C H C s o l v e r s ( E l d a r i c a , Z 3 ) o v e r t h e q u a n t i fj e r - f r e e T h e o r y o f L i s t s a n d L i n e a r I n t e g e r A r i t h me t i c ( L I A ) c a n n o t s o l v e t h e m ( i . e . , c o n s t r u c t a mo d e l )

  5. S o l v i n g C H C s o n R e c u r s i v e D a t a t y p e s ( t o fj n d a mo d e l f o r t h e d e r i v e d C H C s ) A p p r o a c h 1 : ● E x t e n d C H C s o l v i n g b y i n d u c t i o n p r i n c i p l e s : [ R e y n o l d s - K u n c a k 2 0 1 5 , U n n o - T o r i i - S a k a mo t o 2 0 1 7 ] . A p p r o a c h 2 ( t h h i i s t a l k ) : ● T r a n s f o r m C H C s o n r e c u u r r s i v e d a t a t y p e s i n t o e q u u i i s a t i s fj fj a b l e C H C s w i t h o u u t t r e c u u r r s i v e d a t a t y p e s ( e . g . , o n i n t e g e r s a n d b o o l e a n s o n l y ) . [ Mo r d v i n o v - F e d y u k o v i c h 2 0 1 7 , D e A n g e l i s e t a l . 2 0 1 8 ] T r a n s f o r ma t i o n s i n s p i r e d b y t e c h n i q u e s f o r e l i mi n a t i n g i n d u c t i v e d a t a s t r u c t u r e s : D e f o r e s t a t i o n [ Wa d l e r ‘ 8 8 ] , U n n e c e s s a r y V a r i a b l e E l i mi n a t i o n b y U n f o l d / F o l d [ P P ‘ 9 1 ] , C o n j u n c t i v e P a r t i a l D e d u c t i o n + R e d u n d a n t A r g u me n t F i l t e r i n g [ D e S c h r e y e e t a l . ‘ 9 9 ]

  6. R e c u r s i v e D a t a t y p e E l i mi n a t i o n A l g o r i t h m e x i s t e n t i a l l i s t f a l s e : - S < M , l i s t s u m ( L , S ) , l i s t m a x ( L , M ) . % L D e fj n e a n e w p r e d i c a t e l i s t - s u m - m a x ( S , M ) : - l i s t s u m ( L , S ) , l i s t m a x ( L , M ) . v a r i a n t U n f o l d c o n j u n c t i o n s l i s t - s u m - m a x ( S , M ) : - S = 0 , M = 0 . l i s t - s u m - m a x ( S , M ) : - S = S 1 + A , a b s ( X , A ) , m a x ( A , M 1 , M ) , ’ , ’ , l i s t s u m ( L S 1 ) , l i s t m a x ( L M 1 ) . F o l d ( e l i mi n a t e l i s t s ) f a l s e : - S < M , l i s t - s u m - m a x ( S , M ) . l i s t - s u m - m a x ( S , M ) : - S = 0 , M = 0 . l i s t - s u m - m a x ( S , M ) : - S = S 1 + A , a b s ( X , A ) , m a x ( A , M 1 , M ) , l i s t - s u m - m a x ( S 1 , M 1 ) .

  7. S o l v i n g C H C s o n L I A f a l s e : - S < M , l i s t - s u m - m a x ( S , M ) . l i s t - s u m - m a x ( S , M ) : - S = 0 , M = 0 . l i s t - s u m - m a x ( S , M ) : - S = S 1 + A , a b s ( X , A ) , m a x ( A , M 1 , M ) , l i s t - s u m - m a x ( S 1 , M 1 ) . ● E q u i s a t i s fj a b i l i t y g u a r a n t e e d b y f o l d / u n f o l d r u l e s . ● N o i n fj n i t e mo d e l s a n d a r e n e e d e d t o s h o w s a t i s fj a b i l t y . ● S o l v e d b y E l d a r i c a wi t h o u t i n d u c t i o n r u l e s . L I A - d e fj n a b l e mo d e l ( C L P s y n t a x u s e d b y E l d a r i c a ) : l i s t - s u m - m a x ( S , M ) : - S > = M , M > = 0 .

Recommend


More recommend