Inductive Program Synthesis for Bidirectional Transformations Tobias G¨ odderz, Helmut Grohne, Janis Voigtl¨ ander University of Bonn Dagstuhl Seminar 15442
Bidirectional Transformation source view get s v v ′ s ′ 1 – 1/4
Bidirectional Transformation source view get s v update v ′ s ′ 1 – 2/4
Bidirectional Transformation source view get s v update v ′ s ′ put 1 – 3/4
Bidirectional Transformation source view get s v update v ′ s ′ put 1 – 4/4
Bidirectional Transformation Examples: tail “abc” “bc” “ade” “de” 2 – 5/13
Bidirectional Transformation Examples: tail “abc” “bc” update “ade” “de” 2 – 6/13
Bidirectional Transformation Examples: tail “abc” “bc” update “ade” “de” put 2 – 7/13
Bidirectional Transformation Examples: flatten “abac” ‘a’ ‘b’ ‘a’ ‘c’ “abxc” ‘a’ ‘b’ ‘x’ ‘c’ 2 – 8/13
Bidirectional Transformation Examples: flatten “abac” ‘a’ ‘b’ ‘a’ ‘c’ update “abxc” ‘a’ ‘b’ ‘x’ ‘c’ 2 – 9/13
Bidirectional Transformation Examples: flatten “abac” ‘a’ ‘b’ ‘a’ ‘c’ update “abxc” put ‘a’ ‘b’ ‘x’ ‘c’ 2 – 10/13
Bidirectional Transformation Examples: nub ◦ flatten “abc” ‘a’ ‘b’ ‘a’ ‘c’ “xbc” ‘x’ ‘b’ ‘x’ ‘c’ 2 – 11/13
Bidirectional Transformation Examples: nub ◦ flatten “abc” ‘a’ ‘b’ ‘a’ ‘c’ update “xbc” ‘x’ ‘b’ ‘x’ ‘c’ 2 – 12/13
Bidirectional Transformation Examples: nub ◦ flatten “abc” ‘a’ ‘b’ ‘a’ ‘c’ update “xbc” put ‘x’ ‘b’ ‘x’ ‘c’ 2 – 13/13
Bidirectional Transformation source view get s v update v ′ s ′ put 3 – 14/15
Bidirectional Transformation – Laws source view get s v update v ′ s ′ put 3 – 15/15
Bidirectional Transformation – Laws source view get s v = s v Acceptability / GetPut 4 – 16/19
Bidirectional Transformation – Laws source view get s v = = s v put Acceptability / GetPut 4 – 17/19
Bidirectional Transformation – Laws source view get s v update v ′ s ′ put Consistency / PutGet 4 – 18/19
Bidirectional Transformation – Laws source view get s v update s ′ v ′ put get Consistency / PutGet 4 – 19/19
Bidirectional Transformation source view get s v update v ′ s ′ put 5 – 20/22
Bidirectional Transformation – PL Approaches source view get s v update s ′ v ′ put Lenses, DSLs [Foster et al., ACM TOPLAS’07, . . . ] 5 – 21/22
Bidirectional Transformation – PL Approaches source view get s v update v ′ s ′ put Bidirectionalization [Matsuda et al., ICFP’07], [V., POPL’09], . . . 5 – 22/22
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" 6 – 23/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" 6 – 24/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" 6 – 25/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" put "abcde" "xyz" = 6 – 26/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" put "abcde" "xyz" = "axcyez" 6 – 27/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" put "abcde" "xyz" = "axcyez" or "axcyez " ? 6 – 28/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" put "abcde" "xyz" = "axcyez" or "axcyez " ? "xyz" = "axcy z" put "abcd" 6 – 29/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" put "abcde" "xyz" = "axcyez" or "axcyez " ? "xyz" = "axcy z" put "abcd" = put "abcd" "x" 6 – 30/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" put "abcde" "xyz" = "axcyez" or "axcyez " ? "xyz" = "axcy z" put "abcd" = "axc" put "abcd" "x" 6 – 31/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" put "abcde" "xyz" = "axcyez" or "axcyez " ? "xyz" = "axcy z" put "abcd" = "axc" or "ax" ? put "abcd" "x" 6 – 32/33
Nondeterminism / Choices to make Let get = sieve with: s "" "a" "ab" "abc" "abcd" "abcde" sieve s "" "" "b" "b" "bd" "bd" Then, for example: "xy" = "axcy" put "abcd" put "abcde" "xy" = "axcye" put "abcde" "xyz" = "axcyez" or "axcyez " ? "xyz" = "axcy z" put "abcd" = "axc" or "ax" ? , or "cx" ? put "abcd" "x" 6 – 33/33
Nondeterminism / Choices to make Let get = head with: head ( x : xs ) = x 7 – 34/38
Nondeterminism / Choices to make Let get = head with: head ( x : xs ) = x Maybe: put ( x : xs ) y = [ y ] 7 – 35/38
Nondeterminism / Choices to make Let get = head with: head ( x : xs ) = x Maybe: put ( x : xs ) y = [ y ] But that violates put s ( get s ) = s ! 7 – 36/38
Nondeterminism / Choices to make Let get = head with: head ( x : xs ) = x Maybe: put ( x : xs ) y = [ y ] But that violates put s ( get s ) = s ! Better: put ( x : xs ) y | y == x = ( x : xs ) | otherwise = [ y ] 7 – 37/38
Nondeterminism / Choices to make Let get = head with: head ( x : xs ) = x Maybe: put ( x : xs ) y = [ y ] But that violates put s ( get s ) = s ! Better: put ( x : xs ) y | y == x = ( x : xs ) | otherwise = [ y ] But “really intended”: put ( x : xs ) y = ( y : xs ) 7 – 38/38
A slightly more complex case, with recursion Let get = init with: init [ x ] = [ ] init ( x : xs ) = ( x : ( init xs )) 8 – 39/42
Recommend
More recommend