| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
open Formula |
| 12 |
open Sequent |
| 13 |
open Rules |
| 14 |
open Instances |
| 15 |
open Tacticals |
| 16 |
|
| 17 |
let get_flags () = |
| 18 |
let open TransparentState in |
| 19 |
let f accu coe = match coe.Coercionops.coe_value with |
| 20 |
| Names.GlobRef.ConstRef kn -> { accu with tr_cst = Names.Cpred.remove kn accu.tr_cst } |
| 21 |
| _ -> accu |
| 22 |
in |
| 23 |
let flags = List.fold_left f TransparentState.full (Coercionops.coercions ()) in |
| 24 |
{ Formula.reds = RedFlags.red_add_transparent RedFlags.all flags } |
| 25 |
|
| 26 |
let get_id hd = match hd.id with FormulaId id -> id |
| 27 |
|
| 28 |
let ground_tac ~flags solver startseq = |
| 29 |
Proofview.Goal.enter begin fun gl -> |
| 30 |
let rec toptac skipped seq = |
| 31 |
Proofview.Goal.enter begin fun gl -> |
| 32 |
let env = Proofview.Goal.env gl in |
| 33 |
let sigma = Proofview.Goal.sigma gl in |
| 34 |
tclORELSE (axiom_tac ~flags seq) |
| 35 |
begin |
| 36 |
try |
| 37 |
let (hd, seq1) = take_formula env sigma seq |
| 38 |
and re_add s=re_add_formula_list sigma skipped s in |
| 39 |
let continue=toptac [] |
| 40 |
and backtrack =toptac (hd::skipped) seq1 in |
| 41 |
let AnyFormula hd = hd in |
| 42 |
match hd.pat with |
| 43 |
RightPattern rpat-> |
| 44 |
begin |
| 45 |
match rpat with |
| 46 |
Rand-> |
| 47 |
and_tac ~flags backtrack continue (re_add seq1) |
| 48 |
| Rforall-> |
| 49 |
let backtrack1= |
| 50 |
tclFAIL (Pp.str "reversible in 1st order mode") |
| 51 |
in |
| 52 |
forall_tac ~flags backtrack1 continue (re_add seq1) |
| 53 |
| Rarrow-> |
| 54 |
arrow_tac ~flags backtrack continue (re_add seq1) |
| 55 |
| Ror-> |
| 56 |
or_tac ~flags backtrack continue (re_add seq1) |
| 57 |
| Rfalse->backtrack |
| 58 |
| Rexists(i,dom,triv)-> |
| 59 |
let (lfp, seq2) = collect_quantified env sigma seq in |
| 60 |
let backtrack2=toptac (lfp@skipped) seq2 in |
| 61 |
if Sequent.has_fuel seq then |
| 62 |
quantified_tac ~flags lfp backtrack2 |
| 63 |
continue (re_add seq) |
| 64 |
else |
| 65 |
backtrack2 |
| 66 |
end |
| 67 |
| LeftPattern lpat-> |
| 68 |
begin |
| 69 |
match lpat with |
| 70 |
Lfalse-> |
| 71 |
left_false_tac (get_id hd) |
| 72 |
| Land ind-> |
| 73 |
left_and_tac ~flags ind backtrack |
| 74 |
(get_id hd) continue (re_add seq1) |
| 75 |
| Lor ind-> |
| 76 |
left_or_tac ~flags ind backtrack |
| 77 |
(get_id hd) continue (re_add seq1) |
| 78 |
| Lforall (_,_,_)-> |
| 79 |
let (lfp, seq2) = collect_quantified env sigma seq in |
| 80 |
let backtrack2=toptac (lfp@skipped) seq2 in |
| 81 |
if Sequent.has_fuel seq then |
| 82 |
quantified_tac ~flags lfp backtrack2 |
| 83 |
continue (re_add seq) |
| 84 |
else |
| 85 |
backtrack2 |
| 86 |
| Lexists ind -> |
| 87 |
left_exists_tac ~flags ind backtrack (get_id hd) |
| 88 |
continue (re_add seq1) |
| 89 |
| LA lap -> |
| 90 |
let la_tac= |
| 91 |
begin |
| 92 |
match lap with |
| 93 |
LLatom -> backtrack |
| 94 |
| LLand (ind,largs) | LLor(ind,largs) |
| 95 |
| LLfalse (ind,largs)-> |
| 96 |
(ll_ind_tac ~flags ind largs backtrack |
| 97 |
(get_id hd) continue (re_add seq1)) |
| 98 |
| LLforall p -> |
| 99 |
if Sequent.has_fuel seq then |
| 100 |
(ll_forall_tac ~flags p backtrack |
| 101 |
(get_id hd) continue (re_add seq1)) |
| 102 |
else backtrack |
| 103 |
| LLexists (ind,l) -> |
| 104 |
ll_ind_tac ~flags ind l backtrack |
| 105 |
(get_id hd) continue (re_add seq1) |
| 106 |
| LLarrow (a,b,c) -> |
| 107 |
(ll_arrow_tac ~flags a b c backtrack |
| 108 |
(get_id hd) continue (re_add seq1)) |
| 109 |
end in |
| 110 |
ll_atom_tac ~flags la_tac (get_id hd) continue (re_add seq1) |
| 111 |
end |
| 112 |
with Heap.EmptyHeap->solver |
| 113 |
end |
| 114 |
end in |
| 115 |
let n = List.length (Proofview.Goal.hyps gl) in |
| 116 |
startseq (fun seq -> wrap ~flags n true (toptac []) seq) |
| 117 |
end |