Program synthesis -- the automatic generation of code given a specification -- is one of the most fundamental tasks in artificial intelligence (AI) and many programmers' dream. Numerous synthesizers have been developed to tackle program synthesis, manifesting different ideas to approach the exponentially growing program space. While numerous smart program synthesis tools exist, reusing and remixing previously developed methods is tedious and time-consuming. We propose Herb.jl, a unifying program synthesis library written in the Julia programming language, to address these issues. Since current methods rely on similar building blocks, we aim to modularize the underlying synthesis algorithm into communicating and fully extendable sub-compartments, allowing for straightforward reapplication of these modules. To demonstrate the benefits of using Herb.jl, we show three common use cases: 1. how to implement a simple problem and grammar, and how to solve it, 2. how to implement a previously developed synthesizer with just a few lines of code, and 3. how to run a synthesizer against a benchmark.
توليف البرامج — توليد الأكواد تلقائياً بناءً على مواصفات معينة — يعتبر من أساسيات مهام الذكاء الاصطناعي وحلم العديد من المبرمجين. على الرغم من تطوير عدد من أدوات توليف البرامج الذكية للتعامل مع فضاء البرامج المتنامي بشكل أسي، فإن إعادة استخدام وإعادة دمج الطرق الموجودة يعتبر مرهقاً وتستغرق وقتاً طويلاً. تقترح هذه الورقة Herb.jl، مكتبة موحدة لتوليف البرامج مكتوبة بلغة البرمجة جوليا لحل هذه المشاكل. نظراً لأن الطرق الموجودة تعتمد على لبنات بناء متشابهة، يهدف المؤلفون إلى تعديل خوارزميات التوليف الأساسية إلى مكونات فرعية قابلة للتواصل وقابلة للتوسع بالكامل، مما يسمح بإعادة تطبيق مباشرة لهذه الوحدات.
# تعريف مواصفات الإدخال والإخراج
problem = Problem([
IOExample(Dict(:x => 0), 1),
IOExample(Dict(:x => 1), 3),
IOExample(Dict(:x => 2), 5),
IOExample(Dict(:x => 3), 7)
])
# تعريف القواعس
grammar = @cfgrammar begin
Int = 1 | 2 | x
Int = Int + Int
Int = Int * Int
end
# تنفيذ البحث
iterator = BFSIterator(grammar, :Int, max_depth=5)
solution, flag = synth(problem, iterator)
using HerbBenchmarks
pairs = get_all_problem_grammar_pairs(PBE_SLIA_Track_2019)
solved_problems = 0
for (problem, grammar) in pairs
solution = probe(grammar, :Start, problem; max_depth=5)
if !isnothing(solution)
solved_problems += 1
end
end
تستشهد الورقة بأعمال مهمة في مجال توليف البرامج، بما في ذلك:
معايير مسابقة SyGuS (Padhi et al., 2019)
خوارزمية Probe (Barke et al., 2020)
مولف FrAngel (Shi et al., 2019)
مولف Neo (Feng et al., 2018)
مراجعة توليف البرامج (Gulwani et al., 2017)
التقييم الشامل: هذه ورقة عالية الجودة في مجال الأنظمة، تقترح إطار عمل موحد يحتاجه مجال توليف البرامج بشدة. على الرغم من وجود مجال للتحسين في جوانب التقييم التجريبي، فإن مساهماتها التقنية وقيمتها العملية بارزة جداً، وقد تصبح بنية أساسية مهمة في هذا المجال.