Skip to content

Commit 1ba1ee5

Browse files
mtzguidoActions bot
authored andcommitted
UNSURE: SMT: omit prop equations, only encode logical equations
1 parent 4027581 commit 1ba1ee5

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

src/smtencoding/FStarC.SMTEncoding.Encode.fst

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -925,13 +925,12 @@ let encode_top_level_let :
925925
(univ_terms @ List.map mkFreeV vars)
926926
in
927927
let is_logical =
928-
// match (SS.compress t_body).n with
929-
// | Tm_fvar fv when S.fv_eq_lid fv FStarC.Parser.Const.prop_lid -> true
930-
// | _ -> false
931-
928+
match (SS.compress t_body).n with
929+
| Tm_fvar fv when S.fv_eq_lid fv FStarC.Parser.Const.prop_lid -> true
930+
| _ -> false
932931
// GE: this is a cute idea, but the formula axiom shouldn't
933932
// replace the default equation axiom, so disabling this for now
934-
false
933+
// false
935934
in
936935
let is_smt_theory_symbol =
937936
let fv = Inr?.v lbn in
@@ -941,29 +940,32 @@ let encode_top_level_let :
941940
not is_smt_theory_symbol
942941
&& (quals |> List.contains Logic || is_logical)
943942
in
944-
let make_eqn name pat app body =
945-
//NS 05.25: This used to be mkImp(mk_and_l guards, mkEq(app, body))),
946-
//But the guard is unnecessary given the pattern
943+
(* Emit an axiom for the equality between lhs and rhs, guarded
944+
by pattern pat. The free variables in both terms and the pattern (vars),
945+
are all quantified universally. *)
946+
let make_eqn name (pat lhs rhs : term) : ML _ =
947+
// NS 2016.05.25: This used to be mkImp(mk_and_l guards, mkEq(lhs, rhs))),
948+
// But the guard is unnecessary given the pattern
949+
// GM: ^ Is this still true?
947950
Util.mkAssume(mkForall (S.range_of_lbname lbn)
948-
([[pat]], vars, mkEq(app,body)),
951+
([[pat]], vars, mkEq(lhs, rhs)),
949952
Some (Format.fmt1 "Equation for %s" (string_of_lid flid)),
950953
(name ^ "_" ^ fvb.smt_id))
951954
in
952-
let eqns,decls2 =
953-
let basic_eqn_name =
954-
if should_encode_logical
955-
then "defn_equation"
956-
else "equation"
957-
in
955+
let eqns, decls2 =
958956
let basic_eqn, decls =
959957
let body, decls = encode_term body env' in
960-
make_eqn basic_eqn_name app app body, decls
958+
if is_logical then
959+
Caption "omitting eqn for prop", []
960+
else
961+
let pat = app in
962+
make_eqn "definition_equation" pat app body, decls
961963
in
962964
if should_encode_logical
963965
then let pat, app, (body, decls2) =
964966
app, mk_Valid app, encode_formula body env'
965967
in
966-
let logical_eqn = make_eqn "equation" pat app body in
968+
let logical_eqn = make_eqn "logical_equation" pat app body in
967969
[logical_eqn; basic_eqn], decls@decls2
968970
else [basic_eqn], decls
969971
in

0 commit comments

Comments
 (0)