From o.f.sayilir at student.utwente.nl Thu Jan 4 07:47:50 2024 From: o.f.sayilir at student.utwente.nl (Sayilir, O.F. (Omer, Student M-CS)) Date: Thu, 4 Jan 2024 14:47:50 +0000 Subject: [xsmith-dev] Adding "else if" branches to if-statements In-Reply-To: References: <2933BA2A-D087-4C9D-B3FD-560CF97740F3@utah.edu> <2023c9BxfdZYZw5XKVewRdu1Bq@localhost> Message-ID: Hello Everyone, Thank you for the advice! I finally had some time to look at it again and it seems to be functioning as expected after applying your suggestions. Kind regards, ?mer Sayilir -----Original Message----- From: xsmith-dev-bounces at flux.utah.edu On Behalf Of Eric Eide Sent: Sunday, 24 December 2023 18:22 To: Xsmith Dev Mailing List Subject: Re: [xsmith-dev] Adding "else if" branches to if-statements Thank you, Guy and William, for answering this question! -- ------------------------------------------------------------------------------- Eric Eide . University of Utah Kahlert School of Computing https://www.cs.utah.edu/~eeide/ . +1 801-585-5512 . Salt Lake City, Utah, USA From e.a.devree at student.utwente.nl Mon Jan 15 05:39:31 2024 From: e.a.devree at student.utwente.nl (Vree, E.A. de (Everard, Student B-TCS)) Date: Mon, 15 Jan 2024 12:39:31 +0000 Subject: [xsmith-dev] Numeric types not playing nice Message-ID: Hello everyone, I am currently working on a Haskell fuzzer and new to Racket and Xsmith in general, so I apologize in advance if this question is trivial. There is something I don't understand about the types in Xsmith: I emulate Haskell's numerical types like this: (define number-type (base-type 'number #:leaf? #f)) (define real-type (base-type 'real number-type #:leaf? #f)) (define integral-type (base-type 'integral real-type #:leaf? #f)) (define int-type (base-type 'int integral-type)) (define integer-type (base-type 'integer integral-type)) (define fractional-type (base-type 'fractional real-type #:leaf? #f)) (define float-type (base-type 'float fractional-type)) I then define the type info from the Minus Expression like this: (define numeric-bin-op-subtype (? (n t) (hash 'l t 'r t))) [Minus [(fresh-subtype-of number-type) numeric-bin-op-subtype]] My assumption was that both Minus children nodes would be constrained to all the non-leaf nodes in either integral-type, or fractional-type. However, Xsmith still generates Minus nodes with 'l integral and 'r fractional, causing a type constraint violation in Haskell. I have since switched to using (fresh-type-variable integral-type fractional-type). This works, but I am still puzzled about fresh-subtypes. REPL experiments confirm that even fresh-subtypes of my real-types can be unified with both fractional-type and integral-type. What happens when a fresh-subtype is created? Regards, Everard de Vree -------------- next part -------------- An HTML attachment was scrubbed... URL: From william at hatch.uno Mon Jan 15 21:05:43 2024 From: william at hatch.uno (William G Hatch) Date: Mon, 15 Jan 2024 21:05:43 -0700 Subject: [xsmith-dev] Numeric types not playing nice In-Reply-To: References: Message-ID: <2024kzM015ZaYAl58IiylbD5pI@localhost> Hmm, that sounds like a bug. Can you share a link to your code? This may be one of those corners of Xsmith that was built out but never seriously exercised. On Mon, Jan 15, 2024 at 12:39:31PM +0000, Vree, E.A. de (Everard, Student B-TCS) wrote: >Hello everyone, > >I am currently working on a Haskell fuzzer and new to Racket and Xsmith in general, so I apologize in advance if this question is trivial. There is something I don't understand about the types in Xsmith: >I emulate Haskell's numerical types like this: > >(define number-type (base-type 'number #:leaf? #f)) >(define real-type (base-type 'real number-type #:leaf? #f)) >(define integral-type (base-type 'integral real-type #:leaf? #f)) >(define int-type (base-type 'int integral-type)) >(define integer-type (base-type 'integer integral-type)) >(define fractional-type (base-type 'fractional real-type #:leaf? #f)) >(define float-type (base-type 'float fractional-type)) > >I then define the type info from the Minus Expression like this: > >(define numeric-bin-op-subtype (? (n t) (hash 'l t 'r t))) > >[Minus [(fresh-subtype-of number-type) numeric-bin-op-subtype]] > >My assumption was that both Minus children nodes would be constrained to all the non-leaf nodes in either integral-type, or fractional-type. However, Xsmith still generates Minus nodes with 'l integral and 'r fractional, causing a type constraint violation in Haskell. I have since switched to using (fresh-type-variable integral-type fractional-type). This works, but I am still puzzled about fresh-subtypes. REPL experiments confirm that even fresh-subtypes of my real-types can be unified with both fractional-type and integral-type. What happens when a fresh-subtype is created? > >Regards, > >Everard de Vree From e.a.devree at student.utwente.nl Tue Jan 16 03:41:49 2024 From: e.a.devree at student.utwente.nl (Vree, E.A. de (Everard, Student B-TCS)) Date: Tue, 16 Jan 2024 10:41:49 +0000 Subject: [xsmith-dev] Numeric types not playing nice In-Reply-To: <2024kzM015ZaYAl58IiylbD5pI@localhost> References: <2024kzM015ZaYAl58IiylbD5pI@localhost> Message-ID: A version of my project is available at https://gitlab.utwente.nl/s2516268/research-project-2023-1B. It contains a very simple fuzzer with many borrowed elements from the python fuzzer from xsmith-examples. I have replaced all the fresh-subtypes with(fresh-type-variable integral-type fractional-type)instead, which seems to cause no more issues. However, if this is a bug it would of course be interesting to my research. Thanks for the quick response, and I look forward to hearing from you. Everard de Vree ________________________________ Van: William G Hatch Verzonden: dinsdag 16 januari 2024 05:05 Aan: Vree, E.A. de (Everard, Student B-TCS) CC: xsmith-dev at flux.utah.edu Onderwerp: Re: [xsmith-dev] Numeric types not playing nice Hmm, that sounds like a bug. Can you share a link to your code? This may be one of those corners of Xsmith that was built out but never seriously exercised. On Mon, Jan 15, 2024 at 12:39:31PM +0000, Vree, E.A. de (Everard, Student B-TCS) wrote: >Hello everyone, > >I am currently working on a Haskell fuzzer and new to Racket and Xsmith in general, so I apologize in advance if this question is trivial. There is something I don't understand about the types in Xsmith: >I emulate Haskell's numerical types like this: > >(define number-type (base-type 'number #:leaf? #f)) >(define real-type (base-type 'real number-type #:leaf? #f)) >(define integral-type (base-type 'integral real-type #:leaf? #f)) >(define int-type (base-type 'int integral-type)) >(define integer-type (base-type 'integer integral-type)) >(define fractional-type (base-type 'fractional real-type #:leaf? #f)) >(define float-type (base-type 'float fractional-type)) > >I then define the type info from the Minus Expression like this: > >(define numeric-bin-op-subtype (? (n t) (hash 'l t 'r t))) > >[Minus [(fresh-subtype-of number-type) numeric-bin-op-subtype]] > >My assumption was that both Minus children nodes would be constrained to all the non-leaf nodes in either integral-type, or fractional-type. However, Xsmith still generates Minus nodes with 'l integral and 'r fractional, causing a type constraint violation in Haskell. I have since switched to using (fresh-type-variable integral-type fractional-type). This works, but I am still puzzled about fresh-subtypes. REPL experiments confirm that even fresh-subtypes of my real-types can be unified with both fractional-type and integral-type. What happens when a fresh-subtype is created? > >Regards, > >Everard de Vree -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.a.devree at student.utwente.nl Sun Jan 21 04:25:08 2024 From: e.a.devree at student.utwente.nl (Vree, E.A. de (Everard, Student B-TCS)) Date: Sun, 21 Jan 2024 11:25:08 +0000 Subject: [xsmith-dev] Numeric types not playing nice In-Reply-To: References: <2024kzM015ZaYAl58IiylbD5pI@localhost> Message-ID: I've come across another instance of the problem. I use the MutableArray from canned-components, but sometimes my ArrayLiterals get generated with Int and Float literals, probably due to my Mutable Array being a mutable (array-type number-type). Here's the generated s-exps (ProcedureApplicationSingle (procedure (LambdaSingleWithExpression (parameter (FormalParameter (type #) (name "arg_2"))) (body (MutableArrayLiteral (expressions ((FloatLiteral (v -425191240.69550025)) (IntLiteral (v -65005484)))))))) (argument (BoolLiteral (v #t))))))))) Are you sure there is nothing wrong with my type definitions? Am I missing a way to explicitly subtype them? Regards, Everard de Vree ________________________________ Van: Vree, E.A. de (Everard, Student B-TCS) Verzonden: dinsdag 16 januari 2024 11:41 Aan: William G Hatch CC: xsmith-dev at flux.utah.edu Onderwerp: Re: [xsmith-dev] Numeric types not playing nice A version of my project is available at https://gitlab.utwente.nl/s2516268/research-project-2023-1B. It contains a very simple fuzzer with many borrowed elements from the python fuzzer from xsmith-examples. I have replaced all the fresh-subtypes with(fresh-type-variable integral-type fractional-type)instead, which seems to cause no more issues. However, if this is a bug it would of course be interesting to my research. Thanks for the quick response, and I look forward to hearing from you. Everard de Vree ________________________________ Van: William G Hatch Verzonden: dinsdag 16 januari 2024 05:05 Aan: Vree, E.A. de (Everard, Student B-TCS) CC: xsmith-dev at flux.utah.edu Onderwerp: Re: [xsmith-dev] Numeric types not playing nice Hmm, that sounds like a bug. Can you share a link to your code? This may be one of those corners of Xsmith that was built out but never seriously exercised. On Mon, Jan 15, 2024 at 12:39:31PM +0000, Vree, E.A. de (Everard, Student B-TCS) wrote: >Hello everyone, > >I am currently working on a Haskell fuzzer and new to Racket and Xsmith in general, so I apologize in advance if this question is trivial. There is something I don't understand about the types in Xsmith: >I emulate Haskell's numerical types like this: > >(define number-type (base-type 'number #:leaf? #f)) >(define real-type (base-type 'real number-type #:leaf? #f)) >(define integral-type (base-type 'integral real-type #:leaf? #f)) >(define int-type (base-type 'int integral-type)) >(define integer-type (base-type 'integer integral-type)) >(define fractional-type (base-type 'fractional real-type #:leaf? #f)) >(define float-type (base-type 'float fractional-type)) > >I then define the type info from the Minus Expression like this: > >(define numeric-bin-op-subtype (? (n t) (hash 'l t 'r t))) > >[Minus [(fresh-subtype-of number-type) numeric-bin-op-subtype]] > >My assumption was that both Minus children nodes would be constrained to all the non-leaf nodes in either integral-type, or fractional-type. However, Xsmith still generates Minus nodes with 'l integral and 'r fractional, causing a type constraint violation in Haskell. I have since switched to using (fresh-type-variable integral-type fractional-type). This works, but I am still puzzled about fresh-subtypes. REPL experiments confirm that even fresh-subtypes of my real-types can be unified with both fractional-type and integral-type. What happens when a fresh-subtype is created? > >Regards, > >Everard de Vree -------------- next part -------------- An HTML attachment was scrubbed... URL: From william at hatch.uno Sat Jan 27 12:51:20 2024 From: william at hatch.uno (William G Hatch) Date: Sat, 27 Jan 2024 12:51:20 -0700 Subject: [xsmith-dev] Numeric types not playing nice In-Reply-To: References: <2024kzM015ZaYAl58IiylbD5pI@localhost> Message-ID: <2024wEzF03ZbVeuN69OP8W5SzO@localhost> Sorry for the delay, I've been busy lately and haven't been able to look at this. But I finally made some time today. It's been a while since I wrote this stuff, so I had to look in the source. What's happening is that when a node gives types to its children, they are each allowed to give a subtype of that type. So if, say, an add node chooses to type its children as `number`, each child of the add node can choose any subtype of `number` independently. So effectively they each already get a `fresh-subtype` independently. Perhaps it would be good to add a feature to force them to be strictly that type and not a subtype, but I'm not going to do that right now. Feel free to add it yourself if you want! The code that's doing this is at: https://gitlab.flux.utah.edu/xsmith/xsmith/-/blob/2836e5f03502b5dd63a36c7102a1b3d85d88ec30/xsmith/private/core-properties.rkt?page=2#L1577 Best of luck, William Hatch On Sun, Jan 21, 2024 at 11:25:08AM +0000, Vree, E.A. de (Everard, Student B-TCS) wrote: >I've come across another instance of the problem. I use the MutableArray from canned-components, but sometimes my ArrayLiterals get generated with Int and Float literals, probably due to my Mutable Array being a mutable (array-type number-type). Here's the generated s-exps > >(ProcedureApplicationSingle > (procedure > (LambdaSingleWithExpression > (parameter (FormalParameter (type #) (name "arg_2"))) > (body > (MutableArrayLiteral > (expressions > ((FloatLiteral (v -425191240.69550025)) > (IntLiteral (v -65005484)))))))) > (argument (BoolLiteral (v #t))))))))) > >Are you sure there is nothing wrong with my type definitions? Am I missing a way to explicitly subtype them? > >Regards, >Everard de Vree >________________________________ >Van: Vree, E.A. de (Everard, Student B-TCS) >Verzonden: dinsdag 16 januari 2024 11:41 >Aan: William G Hatch >CC: xsmith-dev at flux.utah.edu >Onderwerp: Re: [xsmith-dev] Numeric types not playing nice > >A version of my project is available at https://gitlab.utwente.nl/s2516268/research-project-2023-1B. It contains a very simple fuzzer with many borrowed elements from the python fuzzer from xsmith-examples. I have replaced all the fresh-subtypes with(fresh-type-variable integral-type fractional-type)instead, which seems to cause no more issues. However, if this is a bug it would of course be interesting to my research. >Thanks for the quick response, and I look forward to hearing from you. > >Everard de Vree > >________________________________ >Van: William G Hatch >Verzonden: dinsdag 16 januari 2024 05:05 >Aan: Vree, E.A. de (Everard, Student B-TCS) >CC: xsmith-dev at flux.utah.edu >Onderwerp: Re: [xsmith-dev] Numeric types not playing nice > >Hmm, that sounds like a bug. Can you share a link to your code? > >This may be one of those corners of Xsmith that was built out but >never seriously exercised. > >On Mon, Jan 15, 2024 at 12:39:31PM +0000, Vree, E.A. de (Everard, Student B-TCS) wrote: >>Hello everyone, >> >>I am currently working on a Haskell fuzzer and new to Racket and Xsmith in general, so I apologize in advance if this question is trivial. There is something I don't understand about the types in Xsmith: >>I emulate Haskell's numerical types like this: >> >>(define number-type (base-type 'number #:leaf? #f)) >>(define real-type (base-type 'real number-type #:leaf? #f)) >>(define integral-type (base-type 'integral real-type #:leaf? #f)) >>(define int-type (base-type 'int integral-type)) >>(define integer-type (base-type 'integer integral-type)) >>(define fractional-type (base-type 'fractional real-type #:leaf? #f)) >>(define float-type (base-type 'float fractional-type)) >> >>I then define the type info from the Minus Expression like this: >> >>(define numeric-bin-op-subtype (? (n t) (hash 'l t 'r t))) >> >>[Minus [(fresh-subtype-of number-type) numeric-bin-op-subtype]] >> >>My assumption was that both Minus children nodes would be constrained to all the non-leaf nodes in either integral-type, or fractional-type. However, Xsmith still generates Minus nodes with 'l integral and 'r fractional, causing a type constraint violation in Haskell. I have since switched to using (fresh-type-variable integral-type fractional-type). This works, but I am still puzzled about fresh-subtypes. REPL experiments confirm that even fresh-subtypes of my real-types can be unified with both fractional-type and integral-type. What happens when a fresh-subtype is created? >> >>Regards, >> >>Everard de Vree