Construction du lambda-terme
This commit is contained in:
parent
ec7519ce98
commit
17907e1690
33
main.ml
33
main.ml
@ -1,6 +1,9 @@
|
||||
open Structs;;
|
||||
open Pieuvre;;
|
||||
|
||||
let fail () =
|
||||
failwith "Unknown error";;
|
||||
|
||||
(* Parsage des arguments*)
|
||||
let filename = ref "" in
|
||||
|
||||
@ -52,19 +55,30 @@ let ty =
|
||||
)
|
||||
in
|
||||
|
||||
while true do
|
||||
let subgoals: (ty * (var_lambda * ty) list) list ref = ref [(ty, [])] in
|
||||
|
||||
(* On donne en paramètre une liste contenant un lambda-terme par trou (ie subgoal),
|
||||
* et elle renvoie le lambda-terme complet (en remplaçant les trous) *)
|
||||
let fill_holes = ref (fun holes -> List.hd holes) in
|
||||
|
||||
while !subgoals <> [] do
|
||||
let (ty, hyp) = List.hd !subgoals in
|
||||
subgoals := List.tl !subgoals;
|
||||
|
||||
if is_interactive then (
|
||||
(* Nettoyage du terminal *)
|
||||
let _ = Sys.command("clear -x") in
|
||||
|
||||
(* Affichage des hypothèses *)
|
||||
Printf.printf "There are %d hypothesis\n" (List.length hyp);
|
||||
|
||||
(* Affichage des sous-buts *)
|
||||
Printf.printf "================\n";
|
||||
Printf.printf "%s\n" (string_of_ty ty);
|
||||
|
||||
(* Lecture d'une tactique *)
|
||||
Printf.printf "What do you want to do?\n";
|
||||
Printf.printf "What do you want to do?\n"
|
||||
);
|
||||
|
||||
let tactic =
|
||||
let rec read_tactic () =
|
||||
@ -81,8 +95,19 @@ while true do
|
||||
in
|
||||
read_tactic ()
|
||||
in
|
||||
()
|
||||
|
||||
match tactic with
|
||||
| Intro var -> (
|
||||
match ty with
|
||||
| TImpl (ty1, ty2) -> (
|
||||
subgoals := (ty2, (var, ty1) :: hyp) :: !subgoals;
|
||||
let f = !fill_holes in
|
||||
fill_holes := fun holes -> match holes with
|
||||
| h :: hs -> f (LFun (var, ty1, h) :: hs)
|
||||
| _ -> fail ()
|
||||
)
|
||||
| _ -> failwith "Can't intro"
|
||||
)
|
||||
done;
|
||||
|
||||
();;
|
||||
Printf.printf "Final proof :\n%s" (string_of_lam (!fill_holes []));;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user