on différencie exact pour les preuves et pour les termes
This commit is contained in:
parent
ced6846dbc
commit
20d4ee5531
25
proof.ml
25
proof.ml
@ -16,7 +16,8 @@ type goal = hlam * Types.ty * context
|
|||||||
type proof = goal option * goal list
|
type proof = goal option * goal list
|
||||||
|
|
||||||
type tactic =
|
type tactic =
|
||||||
Exact of lam
|
Exact_term of lam
|
||||||
|
| Exact_proof of id
|
||||||
| Assumption
|
| Assumption
|
||||||
| Intro
|
| Intro
|
||||||
| Cut of ty
|
| Cut of ty
|
||||||
@ -68,6 +69,13 @@ let rec lam_of_hlam : hlam -> lam = function
|
|||||||
| Ref e_ref -> lam_of_hlam !e_ref
|
| Ref e_ref -> lam_of_hlam !e_ref
|
||||||
| Hole -> failwith "can not translate unclosed terms"
|
| Hole -> failwith "can not translate unclosed terms"
|
||||||
|
|
||||||
|
|
||||||
|
let rec get_term_by_id (hyp : id) : context -> hlam option =
|
||||||
|
function
|
||||||
|
[] -> None
|
||||||
|
| (hyp', h, _) :: _ when hyp' = hyp -> Some h
|
||||||
|
| _ :: cs -> get_term_by_id hyp cs
|
||||||
|
|
||||||
let rec get_term_by_type (ty : Types.ty) : context -> hlam option =
|
let rec get_term_by_type (ty : Types.ty) : context -> hlam option =
|
||||||
function
|
function
|
||||||
[] -> None
|
[] -> None
|
||||||
@ -86,7 +94,15 @@ let tact_exact_term ((g, gs) : proof) (e : lam) : proof =
|
|||||||
fill h (hlam_of_lam e);
|
fill h (hlam_of_lam e);
|
||||||
next_goal gs
|
next_goal gs
|
||||||
|
|
||||||
let tact_exact_proof ((g, gs) : proof) (h : id) : proof =
|
let tact_exact_proof ((g, gs) : proof) (hyp : id) : proof =
|
||||||
|
match g with
|
||||||
|
None -> failwith "no current goal"
|
||||||
|
| Some (h, _, cs) ->
|
||||||
|
match get_term_by_id hyp cs with
|
||||||
|
Some h' ->
|
||||||
|
fill h h';
|
||||||
|
next_goal gs
|
||||||
|
| None -> raise TacticFailed
|
||||||
|
|
||||||
let tact_assumption ((g, gs) : proof) : proof =
|
let tact_assumption ((g, gs) : proof) : proof =
|
||||||
match g with
|
match g with
|
||||||
@ -154,9 +170,10 @@ let tact_intros : proof -> proof =
|
|||||||
let tact_try (p : proof) (t : tactic) : proof =
|
let tact_try (p : proof) (t : tactic) : proof =
|
||||||
try
|
try
|
||||||
match t with
|
match t with
|
||||||
Exact e -> tact_exact p e
|
Exact_term e -> tact_exact_term p e
|
||||||
|
| Exact_proof hyp -> tact_exact_proof p hyp
|
||||||
| Intro -> tact_intro p
|
| Intro -> tact_intro p
|
||||||
| Assumption -> tact_assumption p
|
| Assumption -> tact_assumption p
|
||||||
| Cut t -> tact_cut p t
|
| Cut t -> tact_cut p t
|
||||||
| Apply h -> tact_apply p e
|
| Apply h -> tact_apply p h
|
||||||
with TacticFailed -> p
|
with TacticFailed -> p
|
||||||
|
Loading…
Reference in New Issue
Block a user