src/HOL/TPTP/TPTP_Proof_Reconstruction.thy
changeset 59533 e9ffe89a20a4
parent 59498 50b60f501b05
child 59582 0fbed69ff081
equal deleted inserted replaced
59532:82ab8168d940 59533:e9ffe89a20a4
   221     else
   221     else
   222       let
   222       let
   223         fun instantiates param =
   223         fun instantiates param =
   224            eres_inst_tac ctxt [(("x", 0), param)] thm
   224            eres_inst_tac ctxt [(("x", 0), param)] thm
   225 
   225 
   226         val quantified_var = head_quantified_variable i st
   226         val quantified_var = head_quantified_variable ctxt i st
   227       in
   227       in
   228         if is_none quantified_var then no_tac st
   228         if is_none quantified_var then no_tac st
   229         else
   229         else
   230           if member (op =) parameters (the quantified_var |> fst) then
   230           if member (op =) parameters (the quantified_var |> fst) then
   231             instantiates (the quantified_var |> fst) i st
   231             instantiates (the quantified_var |> fst) i st
  1147       handle NO_GOALS => no_tac st
  1147       handle NO_GOALS => no_tac st
  1148 
  1148 
  1149     fun closure tac =
  1149     fun closure tac =
  1150      (*batter fails if there's no toplevel disjunction in the
  1150      (*batter fails if there's no toplevel disjunction in the
  1151        hypothesis, so we also try atac*)
  1151        hypothesis, so we also try atac*)
  1152       SOLVE o (tac THEN' (batter ORELSE' atac))
  1152       SOLVE o (tac THEN' (batter_tac ctxt ORELSE' assume_tac ctxt))
  1153     val search_tac =
  1153     val search_tac =
  1154       ASAP
  1154       ASAP
  1155         (rtac @{thm disjI1} APPEND' rtac @{thm disjI2})
  1155         (rtac @{thm disjI1} APPEND' rtac @{thm disjI2})
  1156         (FIRST' (map closure
  1156         (FIRST' (map closure
  1157                   [dresolve_tac ctxt @{thms dec_commut_eq},
  1157                   [dresolve_tac ctxt @{thms dec_commut_eq},
  1590         val skolem_consts_used_so_far = which_skolem_concs_used st
  1590         val skolem_consts_used_so_far = which_skolem_concs_used st
  1591         val consts_diff' = subtract (op =) skolem_consts_used_so_far consts_diff
  1591         val consts_diff' = subtract (op =) skolem_consts_used_so_far consts_diff
  1592 
  1592 
  1593         fun feat_to_tac feat =
  1593         fun feat_to_tac feat =
  1594           case feat of
  1594           case feat of
  1595               Close_Branch => trace_tac' "mark: closer" efq_tac
  1595               Close_Branch => trace_tac' ctxt "mark: closer" efq_tac
  1596             | ConjI => trace_tac' "mark: conjI" (rtac @{thm conjI})
  1596             | ConjI => trace_tac' ctxt "mark: conjI" (rtac @{thm conjI})
  1597             | King_Cong => trace_tac' "mark: expander_animal" (expander_animal ctxt)
  1597             | King_Cong => trace_tac' ctxt "mark: expander_animal" (expander_animal ctxt)
  1598             | Break_Hypotheses => trace_tac' "mark: break_hypotheses" break_hypotheses
  1598             | Break_Hypotheses => trace_tac' ctxt "mark: break_hypotheses" (break_hypotheses_tac ctxt)
  1599             | RemoveRedundantQuantifications => K all_tac
  1599             | RemoveRedundantQuantifications => K all_tac
  1600 (*
  1600 (*
  1601 FIXME Building this into the loop instead.. maybe not the ideal choice
  1601 FIXME Building this into the loop instead.. maybe not the ideal choice
  1602             | RemoveRedundantQuantifications =>
  1602             | RemoveRedundantQuantifications =>
  1603                 trace_tac' "mark: strip_unused_variable_hyp"
  1603                 trace_tac' ctxt "mark: strip_unused_variable_hyp"
  1604                  (REPEAT_DETERM o remove_redundant_quantification_in_lit)
  1604                  (REPEAT_DETERM o remove_redundant_quantification_in_lit)
  1605 *)
  1605 *)
  1606 
  1606 
  1607             | Assumption => atac
  1607             | Assumption => atac
  1608 (*FIXME both Existential_Free and Existential_Var run same code*)
  1608 (*FIXME both Existential_Free and Existential_Var run same code*)
  1609             | Existential_Free => trace_tac' "mark: forall_neg" (exists_tac ctxt feats consts_diff')
  1609             | Existential_Free => trace_tac' ctxt "mark: forall_neg" (exists_tac ctxt feats consts_diff')
  1610             | Existential_Var => trace_tac' "mark: forall_neg" (exists_tac ctxt feats consts_diff')
  1610             | Existential_Var => trace_tac' ctxt "mark: forall_neg" (exists_tac ctxt feats consts_diff')
  1611             | Universal => trace_tac' "mark: forall_pos" (forall_tac ctxt feats)
  1611             | Universal => trace_tac' ctxt "mark: forall_pos" (forall_tac ctxt feats)
  1612             | Not_pos => trace_tac' "mark: not_pos" (dtac @{thm leo2_rules(9)})
  1612             | Not_pos => trace_tac' ctxt "mark: not_pos" (dtac @{thm leo2_rules(9)})
  1613             | Not_neg => trace_tac' "mark: not_neg" (dtac @{thm leo2_rules(10)})
  1613             | Not_neg => trace_tac' ctxt "mark: not_neg" (dtac @{thm leo2_rules(10)})
  1614             | Or_pos => trace_tac' "mark: or_pos" (dtac @{thm leo2_rules(5)}) (*could add (6) for negated conjunction*)
  1614             | Or_pos => trace_tac' ctxt "mark: or_pos" (dtac @{thm leo2_rules(5)}) (*could add (6) for negated conjunction*)
  1615             | Or_neg => trace_tac' "mark: or_neg" (dtac @{thm leo2_rules(7)})
  1615             | Or_neg => trace_tac' ctxt "mark: or_neg" (dtac @{thm leo2_rules(7)})
  1616             | Equal_pos => trace_tac' "mark: equal_pos" (dresolve_tac ctxt (@{thms eq_pos_bool} @ [@{thm leo2_rules(3)}, @{thm eq_pos_func}]))
  1616             | Equal_pos => trace_tac' ctxt "mark: equal_pos" (dresolve_tac ctxt (@{thms eq_pos_bool} @ [@{thm leo2_rules(3)}, @{thm eq_pos_func}]))
  1617             | Equal_neg => trace_tac' "mark: equal_neg" (dresolve_tac ctxt [@{thm eq_neg_bool}, @{thm leo2_rules(4)}])
  1617             | Equal_neg => trace_tac' ctxt "mark: equal_neg" (dresolve_tac ctxt [@{thm eq_neg_bool}, @{thm leo2_rules(4)}])
  1618             | Donkey_Cong => trace_tac' "mark: donkey_cong" (simper_animal ctxt THEN' ex_expander_tac ctxt)
  1618             | Donkey_Cong => trace_tac' ctxt "mark: donkey_cong" (simper_animal ctxt THEN' ex_expander_tac ctxt)
  1619 
  1619 
  1620             | Extuni_Bool2 => trace_tac' "mark: extuni_bool2" (dtac @{thm extuni_bool2})
  1620             | Extuni_Bool2 => trace_tac' ctxt "mark: extuni_bool2" (dtac @{thm extuni_bool2})
  1621             | Extuni_Bool1 => trace_tac' "mark: extuni_bool1" (dtac @{thm extuni_bool1})
  1621             | Extuni_Bool1 => trace_tac' ctxt "mark: extuni_bool1" (dtac @{thm extuni_bool1})
  1622             | Extuni_Bind => trace_tac' "mark: extuni_triv" (etac @{thm extuni_triv})
  1622             | Extuni_Bind => trace_tac' ctxt "mark: extuni_triv" (etac @{thm extuni_triv})
  1623             | Extuni_Triv => trace_tac' "mark: extuni_triv" (etac @{thm extuni_triv})
  1623             | Extuni_Triv => trace_tac' ctxt "mark: extuni_triv" (etac @{thm extuni_triv})
  1624             | Extuni_Dec => trace_tac' "mark: extuni_dec_tac" (extuni_dec_tac ctxt)
  1624             | Extuni_Dec => trace_tac' ctxt "mark: extuni_dec_tac" (extuni_dec_tac ctxt)
  1625             | Extuni_FlexRigid => trace_tac' "mark: extuni_flex_rigid" (atac ORELSE' asm_full_simp_tac ctxt)
  1625             | Extuni_FlexRigid => trace_tac' ctxt "mark: extuni_flex_rigid" (atac ORELSE' asm_full_simp_tac ctxt)
  1626             | Extuni_Func => trace_tac' "mark: extuni_func" (dtac @{thm extuni_func})
  1626             | Extuni_Func => trace_tac' ctxt "mark: extuni_func" (dtac @{thm extuni_func})
  1627             | Polarity_switch => trace_tac' "mark: polarity_switch" (eresolve_tac ctxt @{thms polarity_switch})
  1627             | Polarity_switch => trace_tac' ctxt "mark: polarity_switch" (eresolve_tac ctxt @{thms polarity_switch})
  1628             | Forall_special_pos => trace_tac' "mark: dorall_special_pos" extcnf_forall_special_pos_tac
  1628             | Forall_special_pos => trace_tac' ctxt "mark: dorall_special_pos" extcnf_forall_special_pos_tac
  1629 
  1629 
  1630         val core_tac =
  1630         val core_tac =
  1631           get_loop_feats feats
  1631           get_loop_feats feats
  1632           |> map feat_to_tac
  1632           |> map feat_to_tac
  1633           |> FIRST'
  1633           |> FIRST'
  1872 
  1872 
  1873       THEN (REPEAT_DETERM (rtac @{thm allI} 1))
  1873       THEN (REPEAT_DETERM (rtac @{thm allI} 1))
  1874 
  1874 
  1875       THEN (if have_loop_feats then
  1875       THEN (if have_loop_feats then
  1876               REPEAT (CHANGED
  1876               REPEAT (CHANGED
  1877               ((ALLGOALS (TRY o clause_breaker)) (*brush away literals which don't change*)
  1877               ((ALLGOALS (TRY o clause_breaker_tac ctxt)) (*brush away literals which don't change*)
  1878                THEN
  1878                THEN
  1879                 (*FIXME move this to a different level?*)
  1879                 (*FIXME move this to a different level?*)
  1880                 (if loop_can_feature [Polarity_switch] feats then
  1880                 (if loop_can_feature [Polarity_switch] feats then
  1881                    all_tac
  1881                    all_tac
  1882                  else
  1882                  else