2024-07-25 11:04:56 +02:00
|
|
|
|
From Coq Require Import Strings.String.
|
2024-08-22 01:04:40 +02:00
|
|
|
|
|
2024-07-25 11:04:56 +02:00
|
|
|
|
Require Import terms.
|
|
|
|
|
Require Import subst.
|
|
|
|
|
Require Import smallstep.
|
|
|
|
|
|
2024-08-22 01:04:40 +02:00
|
|
|
|
Open Scope ladder_type_scope.
|
|
|
|
|
Open Scope ladder_expr_scope.
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
Definition bb_zero : expr_term := [{
|
|
|
|
|
(Λ"α" ↦
|
|
|
|
|
λ"s",(%"α"% -> %"α"%) ↦
|
|
|
|
|
λ"z",(%"α"%) ↦
|
|
|
|
|
%"z"%)
|
|
|
|
|
as $"ℕ"$~$"BBNat"$
|
|
|
|
|
}].
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
Definition bb_one : expr_term := [{
|
|
|
|
|
(Λ"α" ↦
|
|
|
|
|
λ"s",(%"α"% -> %"α"%) ↦
|
|
|
|
|
λ"z",(%"α"%) ↦
|
|
|
|
|
(%"s"% %"z"%))
|
|
|
|
|
as $"ℕ"$~$"BBNat"$
|
|
|
|
|
}].
|
|
|
|
|
|
|
|
|
|
Definition bb_two : expr_term := [{
|
|
|
|
|
(Λ"α" ↦
|
|
|
|
|
λ"s",(%"α"% -> %"α"%) ↦
|
|
|
|
|
λ"z",(%"α"%) ↦
|
|
|
|
|
(%"s"% (%"s"% %"z"%)))
|
|
|
|
|
as $"ℕ"$~$"BBNat"$
|
|
|
|
|
}].
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
Definition bb_succ : expr_term := [{
|
|
|
|
|
λ"n",$"ℕ"$
|
|
|
|
|
~$"BBNat"$
|
|
|
|
|
~(∀"β",(%"β'"%->%"β"%)->%"β"%->%"β"%)
|
|
|
|
|
↦
|
|
|
|
|
((Λ"α" ↦
|
|
|
|
|
λ"s",((%"α"%->%"α"%)->%"α"%->%"α"%) ↦
|
|
|
|
|
λ"z",%"α"% ↦
|
|
|
|
|
(%"s"% ((%"n"% # %"α"%) %"s"% %"z"%)))
|
|
|
|
|
as $"ℕ"$~$"BBNat"$)
|
|
|
|
|
}].
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
Example example_reduction :
|
|
|
|
|
(expr_app bb_succ bb_one) -->β* bb_two
|
|
|
|
|
.
|
|
|
|
|
Proof.
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
apply Multi_Step with (y:=[{
|
|
|
|
|
(λ"n",$"ℕ"$
|
|
|
|
|
~$"BBNat"$
|
|
|
|
|
~(∀"β",(%"β'"%->%"β"%)->%"β"%->%"β"%)
|
|
|
|
|
↦
|
|
|
|
|
((Λ"α" ↦
|
|
|
|
|
λ"s",((%"α"%->%"α"%)->%"α"%->%"α"%) ↦
|
|
|
|
|
λ"z",%"α"% ↦
|
|
|
|
|
(%"s"% ((%"n"% # %"α"%) %"s"% %"z"%)))
|
|
|
|
|
as $"ℕ"$~$"BBNat"$))
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
(Λ"β" ↦
|
|
|
|
|
λ"s",(%"β"% -> %"β"%) ↦
|
|
|
|
|
λ"z",(%"β"%) ↦
|
|
|
|
|
(%"s"% %"z"%))
|
|
|
|
|
as $"ℕ"$~$"BBNat"$
|
|
|
|
|
}]).
|
|
|
|
|
Admitted.
|
|
|
|
|
(*
|
|
|
|
|
apply E_Alpha.
|
|
|
|
|
apply E_App2.
|
|
|
|
|
apply EAlpha_Rename.
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
apply Multi_Step with (y:=[{
|
|
|
|
|
(Λ"α" ↦
|
|
|
|
|
λ"s",((%"α"%->%"α"%)->%"α"%->%"α"%) ↦
|
|
|
|
|
λ"z",%"α"% ↦
|
|
|
|
|
(%"s"% (
|
|
|
|
|
(((Λ"β" ↦
|
|
|
|
|
λ"s",(%"β"% -> %"β"%) ↦
|
|
|
|
|
λ"z",(%"β"%) ↦
|
|
|
|
|
(%"s"% %"z"%)) as $"ℕ"$~$"BBNat"$)
|
|
|
|
|
# %"α"%) %"s"% %"z"%)))
|
|
|
|
|
as $"ℕ"$~$"BBNat"$ }]).
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
apply E_AppLam.
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-09-18 11:15:20 +02:00
|
|
|
|
apply Multi_Step with (y:=[{
|
|
|
|
|
(Λ"α" ↦
|
|
|
|
|
λ"s",((%"α"%->%"α"%)->%"α"%->%"α"%) ↦
|
|
|
|
|
λ"z",%"α"% ↦
|
|
|
|
|
(%"s"% (
|
|
|
|
|
(((Λ"α'" ↦
|
|
|
|
|
λ"s",(%"α'"% -> %"α'"%) ↦
|
|
|
|
|
λ"z",(%"α'"%) ↦
|
|
|
|
|
(%"s"% %"z"%)) as $"ℕ"$~$"BBNat"$)
|
|
|
|
|
# %"α"%) %"s"% %"z"%)))
|
|
|
|
|
as $"ℕ"$~$"BBNat"$ }]).
|
|
|
|
|
}].
|
2024-07-24 11:20:43 +02:00
|
|
|
|
Qed.
|
2024-09-18 11:15:20 +02:00
|
|
|
|
*)
|
2024-07-24 11:20:43 +02:00
|
|
|
|
|
2024-08-22 01:04:40 +02:00
|
|
|
|
Compute (expr_app bb_succ bb_zero) -->β bb_one.
|