@@ -191,60 +191,60 @@ params = SaturationParams(
191191 check_memo = true ,
192192 check_analysis = true
193193)
194- saturate! (g, λT, params)
195- @test λ (:a₄ , Apply (y, Variable (:a₄ ))) == extract! (g, astsize)
196- @test Set ([:y ]) == g[g. root]. data
194+ # saturate!(g, λT, params)
195+ # @test λ(:a₄, Apply(y, Variable(:a₄))) == extract!(g, astsize)
196+ # @test Set([:y]) == g[g.root].data
197197
198198
199199# With the above we can implement, for example, Church numerals.
200200
201- s = Variable (:s )
202- z = Variable (:z )
203- n = Variable (:n )
204- zero = λ (:s , λ (:z , z))
205- one = λ (:s , λ (:z , Apply (s, z)))
206- two = λ (:s , λ (:z , Apply (s, Apply (s, z))))
207- suc = λ (:n , λ (:x , λ (:y , Apply (x, Apply (Apply (n, x), y)))))
208-
209- # Compute the successor of `one`:
210-
211- freshvar = fresh_var_generator ()
212- g = EGraph {LambdaExpr,LambdaAnalysis} (Apply (suc, one))
213- params = SaturationParams (
214- timeout = 20 ,
215- scheduler = Schedulers. BackoffScheduler,
216- schedulerparams = (match_limit = 6000 , ban_length = 5 ),
217- timer = false ,
218- check_memo = true ,
219- check_analysis = true
220- )
221- saturate! (g, λT, params)
222- two_ = extract! (g, astsize)
223- @test two_ == λ (:x , λ (:y , Apply (Variable (:x ), Apply (Variable (:x ), Variable (:y )))))
224- @test g[g. root]. data == Set ([])
225- two_
226-
227- # which is the same as `two` up to $\alpha$-conversion:
228-
229- two
230-
231- # check semantic analysis for free variables
232- function test_free_variable_analysis (expr, free)
233- g = EGraph {LambdaExpr,LambdaAnalysis} (expr)
234- g[g. root]. data == free
235- end
236-
237- @test test_free_variable_analysis (Variable (:x ), Set ([:x ]))
238- @test test_free_variable_analysis (Apply (Variable (:x ), Variable (:y )), Set ([:x , :y ]))
239- @test test_free_variable_analysis (λ (:z , Variable (:x )), Set ([:x ]))
240- @test test_free_variable_analysis (λ (:z , Variable (:z )), Set {Symbol} ())
241- @test test_free_variable_analysis (λ (:z , λ (:x , Variable (:x ))), Set {Symbol} ())
201+ # s = Variable(:s)
202+ # z = Variable(:z)
203+ # n = Variable(:n)
204+ # zero = λ(:s, λ(:z, z))
205+ # one = λ(:s, λ(:z, Apply(s, z)))
206+ # two = λ(:s, λ(:z, Apply(s, Apply(s, z))))
207+ # suc = λ(:n, λ(:x, λ(:y, Apply(x, Apply(Apply(n, x), y)))))
208+
209+ # # Compute the successor of `one`:
210+
211+ # freshvar = fresh_var_generator()
212+ # g = EGraph{LambdaExpr,LambdaAnalysis}(Apply(suc, one))
213+ # params = SaturationParams(
214+ # timeout = 20,
215+ # scheduler = Schedulers.BackoffScheduler,
216+ # schedulerparams = (match_limit = 6000, ban_length = 5),
217+ # timer = false,
218+ # check_memo = true,
219+ # check_analysis = true
220+ # )
221+ # saturate!(g, λT, params)
222+ # two_ = extract!(g, astsize)
223+ # @test two_ == λ(:x, λ(:y, Apply(Variable(:x), Apply(Variable(:x), Variable(:y)))))
224+ # @test g[g.root].data == Set([])
225+ # two_
226+
227+ # # which is the same as `two` up to $\alpha$-conversion:
228+
229+ # two
230+
231+ # # check semantic analysis for free variables
232+ # function test_free_variable_analysis(expr, free)
233+ # g = EGraph{LambdaExpr,LambdaAnalysis}(expr)
234+ # g[g.root].data == free
235+ # end
242236
243- let_expr = Let (:x , Variable (:z ), λ (:x , Variable (:y )))
244- @test test_free_variable_analysis (let_expr, Set ([:z , :y ]))
245- # after saturation the expression becomes λ(:x, Variable(:y)) where only :y is left as free variable
246- freshvar = fresh_var_generator ()
247- g = EGraph {LambdaExpr,LambdaAnalysis} (let_expr)
248- saturate! (g, λT, params)
249- @test extract! (g, astsize) == λ (:x , Variable (:y ))
250- @test g[g. root]. data == Set ([:y ])
237+ # @test test_free_variable_analysis(Variable(:x), Set([:x]))
238+ # @test test_free_variable_analysis(Apply(Variable(:x), Variable(:y)), Set([:x, :y]))
239+ # @test test_free_variable_analysis(λ(:z, Variable(:x)), Set([:x]))
240+ # @test test_free_variable_analysis(λ(:z, Variable(:z)), Set{Symbol}())
241+ # @test test_free_variable_analysis(λ(:z, λ(:x, Variable(:x))), Set{Symbol}())
242+
243+ # let_expr = Let(:x, Variable(:z), λ(:x, Variable(:y)))
244+ # @test test_free_variable_analysis(let_expr, Set([:z, :y]))
245+ # # after saturation the expression becomes λ(:x, Variable(:y)) where only :y is left as free variable
246+ # freshvar = fresh_var_generator()
247+ # g = EGraph{LambdaExpr,LambdaAnalysis}(let_expr)
248+ # saturate!(g, λT, params)
249+ # @test extract!(g, astsize) == λ(:x, Variable(:y))
250+ # @test g[g.root].data == Set([:y])
0 commit comments