GithubHelp home page GithubHelp logo

Comments (3)

alcides avatar alcides commented on May 16, 2024

Can you try this with PR#3?

from aeon.

eduardo-imadeira avatar eduardo-imadeira commented on May 16, 2024

That solved the problem about the import
I was getting another error and I thought that the syntax was wrong, but then I look to aeon_sugar.lark and the piece of code I was testing was syntactically correct

I was trying :

type Unit;
def math : Unit = native_import "math";
def test (b: {b:Float | ((b >= 1)  && (b <= 100))}) -> 
            (e:{e:Float | ((e >= 1) && (e <= 100))}) ->  Int { 
    native "lambda x: lambda y: math.pow(x , y)"
    } 

Raised this error:

(let math : Unit = (native_import "math") in
        (let test : (b:{ b:Float | ((b >= 1) && (b <= 100)) }) -> (e:{ e:Float | ((e >= 1) && (e <= 100)) }) -> Int = (\b -> (native "lambda x: lambda y: math.pow(x , y)")) in
        (print ?main)))

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/__main__.py", line 28, in <module>
    if check_type(ctx, p, top):
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/typeinfer.py", line 267, in check_type
    return entailment(ctx, constraint)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/entailment.py", line 27, in entailment
    return entailment(ctx.prev, c)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/entailment.py", line 27, in entailment
    return entailment(ctx.prev, c)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/entailment.py", line 27, in entailment
    return entailment(ctx.prev, c)
  [Previous line repeated 11 more times]
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/typechecking/entailment.py", line 23, in entailment
    return solve(c)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/horn.py", line 334, in solve
    return smt_valid(c)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 109, in smt_valid
    smt_c = translate(c, extra=forall_vars)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 200, in translate
    e1 = translate_liq(c.pre, variables)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in translate_liq
    args = [translate_liq(a, variables) for a in t.args]
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in <listcomp>
    args = [translate_liq(a, variables) for a in t.args]
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in translate_liq
    args = [translate_liq(a, variables) for a in t.args]
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in <listcomp>
    args = [translate_liq(a, variables) for a in t.args]
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in translate_liq
    args = [translate_liq(a, variables) for a in t.args]
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 186, in <listcomp>
    args = [translate_liq(a, variables) for a in t.args]
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 187, in translate_liq
    return f(*args)
  File "/Users/eduardomadeira/Documents/lasige/aeon/aeon/verification/smt.py", line 47, in <lambda>
    ">=": lambda x, y: x >= y,
TypeError: '>=' not supported between instances of 'ExprRef' and 'int'

But then I tried using Int instead of Float like this:

type Unit;
def math : Unit = native_import "math";
def test (b: {b:Int | ((b >= 1)  && (b <= 100))}) -> 
            (e:{e:Int | ((e >= 1) && (e <= 100))}) ->  Int { 
    native "lambda x: lambda y: math.pow(x , y)"
    } 

And it worked fine. I am now trying to figure out why its working with Int but not with Float

from aeon.

eduardo-imadeira avatar eduardo-imadeira commented on May 16, 2024

smt.py does not import t_float, so smt.py doesn't handle floats yet, I will try to add that now

from aeon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.