Skip to content
Snippets Groups Projects
Commit f8ef4879 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Support for LetTuple in Fairz3

parent 8dee703b
No related branches found
No related tags found
No related merge requests found
...@@ -201,6 +201,23 @@ object FunctionTemplate { ...@@ -201,6 +201,23 @@ object FunctionTemplate {
val rb = rec(pathVar, replace(Map(Variable(i) -> Variable(newExpr)), b)) val rb = rec(pathVar, replace(Map(Variable(i) -> Variable(newExpr)), b))
rb rb
case l @ LetTuple(is, e, b) =>
val tuple : Identifier = FreshIdentifier("t", true).setType(TupleType(is.map(_.getType)))
exprVars += tuple
val re = rec(pathVar, e)
storeGuarded(pathVar, Equals(Variable(tuple), re))
val mapping = for ((id, i) <- is.zipWithIndex) yield {
val newId = FreshIdentifier("ti", true).setType(id.getType)
exprVars += newId
storeGuarded(pathVar, Equals(Variable(newId), TupleSelect(Variable(tuple), i+1)))
(Variable(id) -> Variable(newId))
}
val rb = rec(pathVar, replace(mapping.toMap, b))
rb
case m : MatchExpr => sys.error("MatchExpr's should have been eliminated.") case m : MatchExpr => sys.error("MatchExpr's should have been eliminated.")
case i @ Implies(lhs, rhs) => case i @ Implies(lhs, rhs) =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment