SlideShare a Scribd company logo
1 of 27
TowardProgrammingLanguagesforReasoning:
Humans,SymbolicSystems,andAIAgents
Mark Marron
University of Kentucky
ReasoningChallenges
Don’t need amazing new language construct or fancy analysis
Solving complexity by adding more complexity is not working
We have all the parts we need –
consider our preconceptions & design with reasoning as a
primary concern at each step!
Eliminate foundational sources of
complexity!
• No Loops
• Immutable & referentially
transparent values
• Let and ITE based logic
• Fully determinized semantics
Make implicit information explicit!
• Explicit asserts, data invariants
• Strongly (and explicitly) typed –
including typed primitives
function abs(x: Int): Int {
var sign = 1i;
if(x < 0i) {
sign = -1i;
}
return x * sign;
}
function allPos(...args: List<Int>): Bool {
return args.allOf(pred(x) => x >= 0i);
}
allPos(1i, 2i, 3i); //true
function abs(x: Int): Int
{
var sign = 1;
if(x < 0) {
sign = -1;
}
return x * sign;
}
function abs(x: Int): Int {
sign_0 = 1;
if(x < 0) {
sign_1 = -1;
}
sign_2 = φ(sign_0, sign_1);
return x * sign_2;
}
ref method intern(str: String): Int {
if(this.has(str)) { return this.get(str); } //use the ref this parameter
ref this.add(str, this.size()); //update the ref this parameter
return this.size(); //multi-return updated parameter
}
...
var env = Environment{};
let nameid1 = ref env.internString("hello");
let nameid2 = ref env.internString("goodbye");
_debug(env); //Environment{ "hello”=>0n, "goodbye”=>1n }
typedecl ZipcodeUS = /[0-9]{5}(-[0-9]{4})?/;
typedecl ZipcodeUS = /[0-9]{5}(-[0-9]{4})?/;
function isNYCode(s: StringOf<ZipcodeUS>): Bool {
return s.value().startsWith(/1[0-4]/);
}
isNYCode("10001"ZipcodeUS) //true
isNYCode("40506"ZipcodeUS) //false
typedecl ZipcodeUS = /[0-9]{5}(-[0-9]{4})?/;
function isNYCode(s: StringOf<ZipcodeUS>): Bool {
return s.value().startsWith(/1[0-4]/);
}
isNYCode("10001"ZipcodeUS) //true
isNYCode(“40506"ZipcodeUS) //false
isNYCode("12") //type error not a StringOf<ZipcodeUS>
isNYCode("WC1E"PostcodeUK) //type error not a StringOf<ZipcodeUS>
function gcd(x: Int, y: Int): Int
requires x > 0i && y > 0i; //check is always done
ensures test $return > 0i; //only in debug/test build
{
...
}
entity CalendarEvent {
field name: String;
field location: String;
field start: DateTime;
field duration: Minutes;
invariant $name !== "";
invariant $location !== "";
invariant $duration > 0n_Minutes;
...
}
(define-fun abs((x Int)) Int
(let ((sign 1))
(ite (x < 0)
(let ((@sign_1 -1))
(* x @sign_1)
)
(* x sign)
)
)
)
function abs(x: Int): Int
{
var sign = 1i;
if(x < 0i) {
sign = -1i;
}
return x * sign;
}
/*Find the largest pair of values from the lists.*/
function findMaxPair(x: List<Int>, y: List<Int>): [Int, Int]
{
defer;
}
//=> return [x.max(), y.max()];
ensures x.contains($return.0) && y.contains($return.1);
examples [
[List{3, 2}, List{3, 5} => [2, 5]]
];
//=> return List::zip(x, y).maxArg(fn(v) => v.0);
//=> return List::zip(x, y).maxArg(fn(v) => v.0 + v.1);
Fails on Input: [List{3, 2}, List{3, 5}]
Result - [3, 5]
Expected + [2, 5]
Can you debug this and fix the code?
https://github.com/BosqueLanguage/BosqueCore
typedecl Fahrenheit = Int;
typedecl Mph = Nat;
typedecl Percentage = Nat & {
invariant $value <= 100n;
}
let a = 100n_Percentage;
let b = 101n_Percentage; //Static Error
let p = a – 25n_Percentage;
let q = a + 25n_Percentage; //Runtime Error
let a = 100i_Fahrenheit;
let b = 99i_Fahrenheit;
check a < b;
(define-fun abs((x Int)) Int
(let ((sign 1))
(ite (x < 0)
(let ((@sign_1 -1))
(* x @sign_1)
)
(* x sign)
)
)
)
function abs(x: Int): Int {
var sign = 1i;
if(x < 0i) {
sign = -1i;
}
return x * sign;
}

More Related Content

Similar to Towards Programming Languages for Reasoning.pptx

ITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingIstanbul Tech Talks
 
Yin Yangs of Software Development
Yin Yangs of Software DevelopmentYin Yangs of Software Development
Yin Yangs of Software DevelopmentNaveenkumar Muguda
 
Gentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingGentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingSaurabh Singh
 
Functional Programming You Already Know
Functional Programming You Already KnowFunctional Programming You Already Know
Functional Programming You Already KnowKevlin Henney
 
Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Scott Wlaschin
 
Kotlin for Android Developers
Kotlin for Android DevelopersKotlin for Android Developers
Kotlin for Android DevelopersHassan Abid
 
IntroToCSharpcode.ppt
IntroToCSharpcode.pptIntroToCSharpcode.ppt
IntroToCSharpcode.pptpsundarau
 
Intel JIT Talk
Intel JIT TalkIntel JIT Talk
Intel JIT Talkiamdvander
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecLoïc Descotte
 
Scalapeno18 - Thinking Less with Scala
Scalapeno18 - Thinking Less with ScalaScalapeno18 - Thinking Less with Scala
Scalapeno18 - Thinking Less with ScalaDaniel Sebban
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm ComplexityIntro C# Book
 

Similar to Towards Programming Languages for Reasoning.pptx (20)

Python programming
Python  programmingPython  programming
Python programming
 
ITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function Programming
 
Pointer
PointerPointer
Pointer
 
Yin Yangs of Software Development
Yin Yangs of Software DevelopmentYin Yangs of Software Development
Yin Yangs of Software Development
 
C# 7
C# 7C# 7
C# 7
 
Gentle Introduction to Functional Programming
Gentle Introduction to Functional ProgrammingGentle Introduction to Functional Programming
Gentle Introduction to Functional Programming
 
An introduction to scala
An introduction to scalaAn introduction to scala
An introduction to scala
 
Functional Programming You Already Know
Functional Programming You Already KnowFunctional Programming You Already Know
Functional Programming You Already Know
 
Fp
FpFp
Fp
 
Meet scala
Meet scalaMeet scala
Meet scala
 
Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)Functional Programming Patterns (NDC London 2014)
Functional Programming Patterns (NDC London 2014)
 
Interpreter Case Study - Design Patterns
Interpreter Case Study - Design PatternsInterpreter Case Study - Design Patterns
Interpreter Case Study - Design Patterns
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Kotlin for Android Developers
Kotlin for Android DevelopersKotlin for Android Developers
Kotlin for Android Developers
 
Monads in Swift
Monads in SwiftMonads in Swift
Monads in Swift
 
IntroToCSharpcode.ppt
IntroToCSharpcode.pptIntroToCSharpcode.ppt
IntroToCSharpcode.ppt
 
Intel JIT Talk
Intel JIT TalkIntel JIT Talk
Intel JIT Talk
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Scalapeno18 - Thinking Less with Scala
Scalapeno18 - Thinking Less with ScalaScalapeno18 - Thinking Less with Scala
Scalapeno18 - Thinking Less with Scala
 
19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity19. Data Structures and Algorithm Complexity
19. Data Structures and Algorithm Complexity
 

Recently uploaded

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 

Recently uploaded (20)

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 

Towards Programming Languages for Reasoning.pptx

  • 2.
  • 3.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Don’t need amazing new language construct or fancy analysis Solving complexity by adding more complexity is not working We have all the parts we need – consider our preconceptions & design with reasoning as a primary concern at each step!
  • 11. Eliminate foundational sources of complexity! • No Loops • Immutable & referentially transparent values • Let and ITE based logic • Fully determinized semantics Make implicit information explicit! • Explicit asserts, data invariants • Strongly (and explicitly) typed – including typed primitives
  • 12.
  • 13. function abs(x: Int): Int { var sign = 1i; if(x < 0i) { sign = -1i; } return x * sign; } function allPos(...args: List<Int>): Bool { return args.allOf(pred(x) => x >= 0i); } allPos(1i, 2i, 3i); //true
  • 14. function abs(x: Int): Int { var sign = 1; if(x < 0) { sign = -1; } return x * sign; } function abs(x: Int): Int { sign_0 = 1; if(x < 0) { sign_1 = -1; } sign_2 = φ(sign_0, sign_1); return x * sign_2; }
  • 15. ref method intern(str: String): Int { if(this.has(str)) { return this.get(str); } //use the ref this parameter ref this.add(str, this.size()); //update the ref this parameter return this.size(); //multi-return updated parameter } ... var env = Environment{}; let nameid1 = ref env.internString("hello"); let nameid2 = ref env.internString("goodbye"); _debug(env); //Environment{ "hello”=>0n, "goodbye”=>1n }
  • 16. typedecl ZipcodeUS = /[0-9]{5}(-[0-9]{4})?/; typedecl ZipcodeUS = /[0-9]{5}(-[0-9]{4})?/; function isNYCode(s: StringOf<ZipcodeUS>): Bool { return s.value().startsWith(/1[0-4]/); } isNYCode("10001"ZipcodeUS) //true isNYCode("40506"ZipcodeUS) //false typedecl ZipcodeUS = /[0-9]{5}(-[0-9]{4})?/; function isNYCode(s: StringOf<ZipcodeUS>): Bool { return s.value().startsWith(/1[0-4]/); } isNYCode("10001"ZipcodeUS) //true isNYCode(“40506"ZipcodeUS) //false isNYCode("12") //type error not a StringOf<ZipcodeUS> isNYCode("WC1E"PostcodeUK) //type error not a StringOf<ZipcodeUS>
  • 17. function gcd(x: Int, y: Int): Int requires x > 0i && y > 0i; //check is always done ensures test $return > 0i; //only in debug/test build { ... } entity CalendarEvent { field name: String; field location: String; field start: DateTime; field duration: Minutes; invariant $name !== ""; invariant $location !== ""; invariant $duration > 0n_Minutes; ... }
  • 18.
  • 19. (define-fun abs((x Int)) Int (let ((sign 1)) (ite (x < 0) (let ((@sign_1 -1)) (* x @sign_1) ) (* x sign) ) ) ) function abs(x: Int): Int { var sign = 1i; if(x < 0i) { sign = -1i; } return x * sign; }
  • 20.
  • 21. /*Find the largest pair of values from the lists.*/ function findMaxPair(x: List<Int>, y: List<Int>): [Int, Int] { defer; } //=> return [x.max(), y.max()]; ensures x.contains($return.0) && y.contains($return.1); examples [ [List{3, 2}, List{3, 5} => [2, 5]] ]; //=> return List::zip(x, y).maxArg(fn(v) => v.0); //=> return List::zip(x, y).maxArg(fn(v) => v.0 + v.1); Fails on Input: [List{3, 2}, List{3, 5}] Result - [3, 5] Expected + [2, 5] Can you debug this and fix the code?
  • 22.
  • 23.
  • 25.
  • 26. typedecl Fahrenheit = Int; typedecl Mph = Nat; typedecl Percentage = Nat & { invariant $value <= 100n; } let a = 100n_Percentage; let b = 101n_Percentage; //Static Error let p = a – 25n_Percentage; let q = a + 25n_Percentage; //Runtime Error let a = 100i_Fahrenheit; let b = 99i_Fahrenheit; check a < b;
  • 27. (define-fun abs((x Int)) Int (let ((sign 1)) (ite (x < 0) (let ((@sign_1 -1)) (* x @sign_1) ) (* x sign) ) ) ) function abs(x: Int): Int { var sign = 1i; if(x < 0i) { sign = -1i; } return x * sign; }