xmt-lib 0.1.2

A grounder for SMT solvers
Documentation
(set-option :backend none)
(declare-datatype T ( ( a ) ( b ) ))
(declare-fun ku (T T) Bool)
(x-interpret-fun ku
  (x-mapping
   ((a a) true)
   ((a b) false)
   ((b a) false)
  ) ?)
(declare-fun kuf (T) T)
(x-interpret-fun kuf (x-mapping
   ((a) a)
) ? )
(assert (forall ((x T)) (ku (kuf x) (kuf x)) ))
(x-ground :debug :sql)
(x-debug db _xmt_interp_ku_G)
(x-debug solver groundings)
(x-debug db tables)
------- RESULTS ------------------
(declare-datatype T ((a) (b)))
(declare-fun ku (T T) Bool)
(declare-fun kuf (T) T)
; ==== Query =============================
;-- Agg (0)
;SELECT implies_(if_, G) as G
; FROM (-- exclude(7)
;       SELECT *
;        FROM (-- Join(14)
;              SELECT _xmt_interp_kuf_G_1.a_1 AS x,
;                     and_(if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_1), if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_2)) AS if_,
;                     _xmt_interp_ku_UF_2.G AS G
;                FROM _xmt_interp_kuf_G AS _xmt_interp_kuf_G_1
;                JOIN _xmt_interp_ku_UF AS _xmt_interp_ku_UF_2
;                      ON (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_1) 
;                     AND (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_2))
;        WHERE G <> "true")(assert (not (and (= (kuf b) a) (= (kuf b) b))))
(assert (not (and (= (kuf b) b) (= (kuf b) a))))
(assert (=> (and (= (kuf b) b) (= (kuf b) b)) (ku b b)))

 TABLE: _xmt_interp_ku_g
┌─────┬─────┬────────────┐
│ a_1 │ a_2 │ G          │
├─────┼─────┼────────────┤
│ "a" │ "a" │ "true"     │
├─────┼─────┼────────────┤
│ "a" │ "b" │ "false"    │
├─────┼─────┼────────────┤
│ "b" │ "a" │ "false"    │
├─────┼─────┼────────────┤
│ "b" │ "b" │ "(ku b b)" │
└─────┴─────┴────────────┘
Groundings:
===  x ======================================
 -- Join(0)
SELECT _xmt_sort_t.G AS x,
       _xmt_sort_t.G AS G
  FROM _xmt_sort_t
===  (kuf x) ======================================
 -- Join(0)
SELECT _xmt_interp_kuf_G_1.a_1 AS x,
       _xmt_interp_kuf_G_1.G AS G
  FROM _xmt_interp_kuf_G AS _xmt_interp_kuf_G_1
===  (ku (kuf x) (kuf x)) ======================================
----- TU -----------------------------------------------------------
-- Join(0)
SELECT _xmt_interp_kuf_G_1.a_1 AS x,
       and_(if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_TU_2.a_1), if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_TU_2.a_2)) AS if_,
       _xmt_interp_ku_TU_2.G AS G
  FROM _xmt_interp_kuf_G AS _xmt_interp_kuf_G_1
  JOIN _xmt_interp_ku_TU AS _xmt_interp_ku_TU_2
        ON (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_TU_2.a_1) 
       AND (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_TU_2.a_2)
----- UF -----------------------------------------------------------
-- Join(0)
SELECT _xmt_interp_kuf_G_1.a_1 AS x,
       and_(if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_1), if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_2)) AS if_,
       _xmt_interp_ku_UF_2.G AS G
  FROM _xmt_interp_kuf_G AS _xmt_interp_kuf_G_1
  JOIN _xmt_interp_ku_UF AS _xmt_interp_ku_UF_2
        ON (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_1) 
       AND (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_2)
----- G ------------------------------------------------------------
-- Join(0)
SELECT _xmt_interp_kuf_G_1.a_1 AS x,
       and_(if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_G_2.a_1), if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_G_2.a_2)) AS if_,
       _xmt_interp_ku_G_2.G AS G
  FROM _xmt_interp_kuf_G AS _xmt_interp_kuf_G_1
  JOIN _xmt_interp_ku_G AS _xmt_interp_ku_G_2
        ON (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_G_2.a_1) 
       AND (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_G_2.a_2)

=== (top) (forall ((x T)) (ku (kuf x) (kuf x))) ======================================
----- TU -----------------------------------------------------------
-- Agg (0)
SELECT and_aggregate(implies_(if_, G)) as G
 FROM (SELECT NULL AS x, "true" AS if_, "true" AS G 
       UNION ALL
       -- exclude(7)
       SELECT *
        FROM (-- Join(14)
              SELECT _xmt_interp_kuf_G_1.a_1 AS x,
                     and_(if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_1), if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_2)) AS if_,
                     _xmt_interp_ku_UF_2.G AS G
                FROM _xmt_interp_kuf_G AS _xmt_interp_kuf_G_1
                JOIN _xmt_interp_ku_UF AS _xmt_interp_ku_UF_2
                      ON (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_1) 
                     AND (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_2))
        WHERE G <> "true")
----- UF -----------------------------------------------------------
-- Agg (0)
SELECT implies_(if_, G) as G
 FROM (-- exclude(7)
       SELECT *
        FROM (-- Join(14)
              SELECT _xmt_interp_kuf_G_1.a_1 AS x,
                     and_(if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_1), if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_2)) AS if_,
                     _xmt_interp_ku_UF_2.G AS G
                FROM _xmt_interp_kuf_G AS _xmt_interp_kuf_G_1
                JOIN _xmt_interp_ku_UF AS _xmt_interp_ku_UF_2
                      ON (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_1) 
                     AND (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_2))
        WHERE G <> "true")
----- G ------------------------------------------------------------
-- Agg (0)
SELECT and_aggregate(implies_(if_, G)) as G
 FROM (SELECT NULL AS x, "true" AS if_, "true" AS G 
       UNION ALL
       -- exclude(7)
       SELECT *
        FROM (-- Join(14)
              SELECT _xmt_interp_kuf_G_1.a_1 AS x,
                     and_(if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_1), if_(_xmt_interp_kuf_G_1.G, _xmt_interp_ku_UF_2.a_2)) AS if_,
                     _xmt_interp_ku_UF_2.G AS G
                FROM _xmt_interp_kuf_G AS _xmt_interp_kuf_G_1
                JOIN _xmt_interp_ku_UF AS _xmt_interp_ku_UF_2
                      ON (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_1) 
                     AND (NOT is_id(_xmt_interp_kuf_G_1.G) OR _xmt_interp_kuf_G_1.G = _xmt_interp_ku_UF_2.a_2))
        WHERE G <> "true")

===========================================
Tables and Views:
 - Bool (table)
 - _xmt_sort_t (table)
 - _xmt_interp_ku_TU_K (table)
 - _xmt_interp_ku_UF_K (table)
 - _xmt_interp_ku_K (table)
 - _xmt_interp_ku_U (view)
 - _xmt_interp_ku_G (view)
 - _xmt_interp_ku_TU (view)
 - _xmt_interp_ku_UF (view)
 - _xmt_interp_kuf_K (table)
 - _xmt_interp_kuf_U (view)
 - _xmt_interp_kuf_G (view)
 - sqlite_stat1 (table)
 - sqlite_stat4 (table)