action_result by_contradiction_action() { state & s = curr_state(); expr target = whnf(s.get_target()); if (!is_prop(target)) return action_result::failed(); if (blast::is_false(target)) return action_result::failed(); expr not_target; if (is_not(target, not_target)) { s.set_target(mk_arrow(not_target, mk_constant(get_false_name()))); return intros_action(1); } blast_tmp_type_context tmp_tctx; optional<expr> target_decidable = tmp_tctx->mk_class_instance(mk_app(mk_constant(get_decidable_name()), target)); if (!target_decidable) return action_result::failed(); expr href = s.mk_hypothesis(get_app_builder().mk_not(target)); auto pcell = new by_contradiction_proof_step_cell(href); s.push_proof_step(pcell); s.set_target(mk_constant(get_false_name())); trace_action("by_contradiction"); return action_result::new_branch(); }
bool is_connective(name const & n) const { return n == get_or_name() || n == get_and_name() || n == get_not_name() || n == get_iff_name() || n == get_not_name() || n == get_ite_name() || n == get_true_name() || n == get_false_name(); }
void initialize_resolve_macro() { g_resolve_macro_name = new name("resolve"); g_resolve_opcode = new std::string("Res"); g_or = new expr(Const(get_or_name())); g_not = new expr(Const(get_not_name())); g_false = new expr(Const(get_false_name())); g_or_elim = new expr(Const(get_or_elim_name())); g_or_intro_left = new expr(Const(get_or_intro_left_name())); g_or_intro_right = new expr(Const(get_or_intro_right_name())); g_absurd_elim = new expr(Const(get_absurd_name())); g_var_0 = new expr(mk_var(0)); g_resolve_macro_definition = new macro_definition(new resolve_macro_definition_cell()); register_macro_deserializer(*g_resolve_opcode, [](deserializer &, unsigned num, expr const * args) { if (num != 3) throw corrupted_stream_exception(); return mk_resolve_macro(args[0], args[1], args[2]); }); }