mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-06 11:15:43 -05:00
fix(tycheck): handle n-ary +/-
This commit is contained in:
parent
7c3c88d6f6
commit
dc320bf0c9
1 changed files with 6 additions and 0 deletions
|
|
@ -278,9 +278,14 @@ let rec conv_term (ctx:Ctx.t) (t:PA.term) : T.t =
|
|||
| PA.Geq, [a;b] -> T.lra ctx.tst (LRA_pred (Geq, a, b))
|
||||
| PA.Gt, [a;b] -> T.lra ctx.tst (LRA_pred (Gt, a, b))
|
||||
| PA.Add, [a;b] -> T.lra ctx.tst (LRA_op (Plus, a, b))
|
||||
| PA.Add, (a::l) ->
|
||||
List.fold_left (fun a b -> T.lra ctx.tst (LRA_op (Plus,a,b))) a l
|
||||
| PA.Minus, [a;b] -> T.lra ctx.tst (LRA_op (Minus, a, b))
|
||||
| PA.Minus, (a::l) ->
|
||||
List.fold_left (fun a b -> T.lra ctx.tst (LRA_op (Minus,a,b))) a l
|
||||
| PA.Mult, [a;b] ->
|
||||
begin match t_as_q a, t_as_q b with
|
||||
| Some a, Some b -> T.lra ctx.tst (LRA_const (Q.mul a b))
|
||||
| Some a, _ -> T.lra ctx.tst (LRA_mult (a, b))
|
||||
| _, Some b -> T.lra ctx.tst (LRA_mult (b, a))
|
||||
| None, None ->
|
||||
|
|
@ -288,6 +293,7 @@ let rec conv_term (ctx:Ctx.t) (t:PA.term) : T.t =
|
|||
end
|
||||
| PA.Div, [a;b] ->
|
||||
begin match t_as_q a, t_as_q b with
|
||||
| Some a, Some b -> T.lra ctx.tst (LRA_const (Q.div a b))
|
||||
| Some a, _ -> T.lra ctx.tst (LRA_mult (Q.inv a, b))
|
||||
| _, Some b -> T.lra ctx.tst (LRA_mult (Q.inv b, a))
|
||||
| None, None ->
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue