Skip to content

Conversation

@filipeom
Copy link
Member

Type check the theory and operator during expression construction to disallow expressions that are forbidden, for example:

let _ = unop Ty_bool Sqrt (value True) (* should not compile *)

@filipeom filipeom marked this pull request as draft May 19, 2025 07:51
@redianthus
Copy link
Contributor

Hi @filipeom, this looks really interesting. I'd be interested in doing a full review but I won't be able to do it before the 22nd of may, could you wait before merging?

@filipeom
Copy link
Member Author

Hi @filipeom, this looks really interesting. I'd be interested in doing a full review but I won't be able to do it before the 22nd of may, could you wait before merging?

Of course! But I should warn you, this PR might actually take a while to merge. I've only done it for unary operators so far, but I think it's working ok (at least it's doing what I wanted 😅).

Also, this breaks the SMT-LIB parser, because I was doing stuff like this:

| "-", [ a; b ] -> Expr.raw_binop Ty_none Sub a b
| "*", [ a; b ] -> Expr.raw_binop Ty_none Mul a b
| "/", [ a; b ] -> Expr.raw_binop Ty_none Div a b

In cases where the theory could be inferred directly from the operator, I was assigning it the Ty_none theory, and then inferring the correct theory in the rewriting module based on the arguments theories. But now this no longer typechecks 😅 So I still need to figure out the best way to build expressions from dolmen terms.

@filipeom filipeom force-pushed the type-safe-ops branch 5 times, most recently from 4dd43c8 to 5411736 Compare June 22, 2025 16:01
@filipeom filipeom marked this pull request as ready for review July 19, 2025 15:44
@filipeom filipeom requested a review from a team as a code owner September 17, 2025 22:11
@filipeom filipeom force-pushed the main branch 8 times, most recently from 7e57f20 to 3c98cc0 Compare September 21, 2025 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants