-
Notifications
You must be signed in to change notification settings - Fork 247
A boolean algebra solver buried in Algebra.Lattice.Properties.BooleanAlgebra.Expression
#2702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We can slightly modify this file to work with more levels insteand of only {b} (B : BooleanAlgebra b b) as follows (only two places are modified, and it's checked) : module Algebra.Lattice.Properties.BooleanAlgebra.Expression ... open import Agda.Primitive using (⊔) ... |
👍 to comment about |
As for Seems as though that would be a good contribution! |
Yes, agreed, moving this file up to the |
I am working on a solver. This is not hard, and I wonder why no one has done it before. I looked up this in Coq and Lean a little bit. In Coq, I didn't even find the definition of a boolean algebra. But Coq does have some tactics that works for Prop. In Lean, the definition of boolean algebra is there, but I didn't find related solvers. Leans does have tactics for Prop too. |
NB, if we move the module up the hierarchy, and deprecate There are separate questions (in my mind at least) about modelling |
Expr is just a datatype for manipulating expressions like "a + b * c" e.g. in a ring. Right now we have to define such a data type for every structure that needs a solver. We also have the reflection method to get the syntax of such expressions, but manipulating the syntax datatype is too complicated. I wonder if it is useful to have for each structure, an associated Expr? adding a fourth to the triple: IsX --- X --- RawX. One use case is: Expr modulo out the laws of the structure is a "free" or "initial" object of the structure. E.g:
infixr 7 • infix 4 ≈ -- The monoid axioms: asociativity and the left and right unit laws. open import Level free-monoid : Set -> Monoid 0ℓ 0ℓ In this case, perhaps, the triple becomes the quadruple: IsX --- X --- RawX --- FreeX (ExprX). A solver uses the fact that if an expression hold in a free structure on X, then it holds in any other instance M of such structure under any given interpretation set function g : X -> M. That is, a solver uses the congruence requirement (well-definedness) of the unique morphism f prescribed by the universal property of free object for function g. The remaining part of a solver is just to compute equalities on Expr the free object. The module Relation.Binary.Reflection then can be better parameterised to take only a semidecidable equality test on Expr, or be replaced by a different module that is less ad hoc, and is basically taking care of the "free boilerplate part" of a solver. Anyone knows any paper about formalizing solvers in this way? If this is a new, is it worth to write a paper clarifying the idea? |
Regarding papers, I guess that @oisdk might be the best person to ask here, but the idea for particular structures is already documented (though never quite in such explicit terms, as I read them) in eg. the papers I cite in #2629 (comment) ... but the architecture of the various existing But it is also worth asking the members of the FREX project (mostly working in Idris, not Agda), including eg @gallais for pointers... that project site does include a link to 'Frex for Agda' but I still haven't had time to study exactly what's going on (despite frequent references and hints on this GitHub to others to look at this material... ;-)). NB. As also mentioned elsewhere, I think the library is also missing a |
Algebra.Lattice.Properties.BooleanAlgebra.Expression
This file gives a boolean algebra solver:
src/Algebra/Lattice/Properties/BooleanAlgebra/Expression.agda
It's probably better to put them in a dedicated file like "BooleanAlgebra.Solver.agda" for general use.
edit2: sorry, it is not a solver per se, but reminiscent of a solver.
The text was updated successfully, but these errors were encountered: