Ajout de la β-réduction du λ-terme final.
This commit is contained in:
parent
98a9e6964f
commit
241a44528e
6
main.ml
6
main.ml
@ -157,8 +157,10 @@ while !subgoals <> [] do
|
|||||||
done;
|
done;
|
||||||
|
|
||||||
let finalLam = !fill_holes [] in
|
let finalLam = !fill_holes [] in
|
||||||
if (typecheck [] finalLam ty) then
|
if (typecheck [] finalLam ty) then (
|
||||||
Printf.printf "Final proof :\n%s\n" (string_of_lam finalLam)
|
Printf.printf "Final proof :\n";
|
||||||
|
reduce finalLam
|
||||||
|
)
|
||||||
else (
|
else (
|
||||||
Printf.printf "Invalid proof constructed!\n";
|
Printf.printf "Invalid proof constructed!\n";
|
||||||
Printf.printf "%s can't be typed with %s.\n" (string_of_lam finalLam) (string_of_ty ty);
|
Printf.printf "%s can't be typed with %s.\n" (string_of_lam finalLam) (string_of_ty ty);
|
||||||
|
|||||||
@ -90,7 +90,7 @@ let rec alpha (l1: lam) (l2: lam) : bool =
|
|||||||
|
|
||||||
(* Fait un pas de β-réduction, et renvoie None si on a une forme normale *)
|
(* Fait un pas de β-réduction, et renvoie None si on a une forme normale *)
|
||||||
let rec betastep (l: lam) : lam option = match l with
|
let rec betastep (l: lam) : lam option = match l with
|
||||||
| LFun(v,t,l') -> betastep l'
|
| LFun(v,t,l') -> Option.bind (betastep l') (fun l' -> Some (LFun(v,t,l')))
|
||||||
| LApp(lf,lx) ->
|
| LApp(lf,lx) ->
|
||||||
begin
|
begin
|
||||||
match (betastep lf) with
|
match (betastep lf) with
|
||||||
@ -104,7 +104,7 @@ let rec betastep (l: lam) : lam option = match l with
|
|||||||
| _ -> None (* On ne peut pas β-réduire *)
|
| _ -> None (* On ne peut pas β-réduire *)
|
||||||
end
|
end
|
||||||
| LVar(x) -> None
|
| LVar(x) -> None
|
||||||
| LExf(l',_) -> betastep l'
|
| LExf(l',t) -> Option.bind (betastep l') (fun l' -> Some (LExf(l',t)))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(* Affiche les réductions du λ-terme l jusqu’à atteindre une forme normale, ou part en boucle infinie *)
|
(* Affiche les réductions du λ-terme l jusqu’à atteindre une forme normale, ou part en boucle infinie *)
|
||||||
|
|||||||
10
tests/cut-impl.8pus
Normal file
10
tests/cut-impl.8pus
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
(A -> B -> C) -> (B -> A -> C)
|
||||||
|
intro f.
|
||||||
|
intro b.
|
||||||
|
intro a.
|
||||||
|
cut (B -> C).
|
||||||
|
intro bc.
|
||||||
|
apply bc.
|
||||||
|
assumption.
|
||||||
|
apply f.
|
||||||
|
assumption.
|
||||||
Loading…
x
Reference in New Issue
Block a user