├── #script# ├── Abstraction_calculus ├── Abstraction_Equal.glob ├── Abstraction_Equal.v ├── Abstraction_Equal.v.d ├── Abstraction_Equal.vo ├── Abstraction_Normal.glob ├── Abstraction_Normal.v ├── Abstraction_Normal.v.d ├── Abstraction_Normal.vo ├── Abstraction_Reduction.glob ├── Abstraction_Reduction.v ├── Abstraction_Reduction.v.d ├── Abstraction_Reduction.vo ├── Abstraction_Tactics.glob ├── Abstraction_Tactics.v ├── Abstraction_Tactics.v.d ├── Abstraction_Tactics.vo ├── Abstraction_Terms.glob ├── Abstraction_Terms.v ├── Abstraction_Terms.v.d ├── Abstraction_Terms.vo ├── Closure_to_Abstraction.glob ├── Closure_to_Abstraction.v ├── Closure_to_Abstraction.v.d ├── Closure_to_Abstraction.vo ├── Normal.glob ├── Normal.vo ├── Reduction.glob ├── Reduction.vo ├── Tactics.glob ├── Tactics.vo ├── Terms.glob ├── Terms.vo ├── makefile └── makefile.conf ├── Closure_calculus ├── Closure_calculus.glob ├── Closure_calculus.pdf ├── Closure_calculus.v ├── Closure_calculus.v.d ├── Closure_calculus.vo ├── README.md ├── makefile ├── makefile.conf ├── not_church_numerals.glob ├── not_church_numerals.v ├── not_church_numerals.vo └── scott_numerals.v ├── Closure_to_Fieska ├── Abstraction_to_Combination.glob ├── Abstraction_to_Combination.v ├── Abstraction_to_Combination.v.d ├── Abstraction_to_Combination.vo ├── Adding.glob ├── Adding.v ├── Adding.v.d ├── Adding.vo ├── Eta.glob ├── Eta.v ├── Eta.v.d ├── Eta.vo ├── Fieska_size.glob ├── Fieska_size.v ├── Fieska_size.v.d ├── Fieska_size.vo ├── Optimization.glob ├── Optimization.v ├── Optimization.v.d ├── Optimization.vo ├── README.md ├── Tagging.glob ├── Tagging.v ├── Tagging.v.d ├── Tagging.vo ├── identity_abs_val.glob ├── identity_abs_val.v ├── identity_abs_val.v.d ├── identity_abs_val.vo ├── makefile ├── makefile.conf └── rpnf.pdf ├── Closure_to_SF ├── Abstraction_to_Combination.glob ├── Abstraction_to_Combination.v ├── Abstraction_to_Combination.vo ├── Adding.glob ├── Adding.v ├── Adding.v.d ├── Adding.vo ├── README.md ├── SF_size.glob ├── SF_size.v ├── SF_size.v.d ├── SF_size.vo ├── Tagging.glob ├── Tagging.v ├── Tagging.v.d ├── Tagging.vo ├── deconstruction.pdf ├── identity_abs_val.glob ├── identity_abs_val.v └── identity_abs_val.vo ├── Fieska_calculus ├── Extensions.glob ├── Extensions.v ├── Extensions.v.d ├── Extensions.vo ├── Extensions_bu.v ├── Fieska_Closed.glob ├── Fieska_Closed.v ├── Fieska_Closed.v.d ├── Fieska_Closed.vo ├── Fieska_Eval.glob ├── Fieska_Eval.v ├── Fieska_Eval.v.d ├── Fieska_Eval.vo ├── Fieska_Normal.glob ├── Fieska_Normal.v ├── Fieska_Normal.v.d ├── Fieska_Normal.vo ├── Fieska_Tactics.glob ├── Fieska_Tactics.v ├── Fieska_Tactics.v.d ├── Fieska_Tactics.vo ├── Fieska_Terms.glob ├── Fieska_Terms.v ├── Fieska_Terms.v.d ├── Fieska_Terms.vo ├── Fieska_reduction.glob ├── Fieska_reduction.v ├── Fieska_reduction.v.d ├── Fieska_reduction.vo ├── Fixpoints.glob ├── Fixpoints.v ├── Fixpoints.v.d ├── Fixpoints.vo ├── General.glob ├── General.v ├── General.v.d ├── General.vo ├── README.md ├── Star.glob ├── Star.v ├── Star.v.d ├── Star.vo ├── Substitution.glob ├── Substitution.v ├── Substitution.v.d ├── Substitution.vo ├── Test.glob ├── Test.v ├── Test.v.d └── Test.vo ├── LICENSE ├── Makefile ├── Makefile.conf ├── README.md ├── SF_calculus ├── #Extensions.v# ├── Equal.glob ├── Equal.v ├── Equal.v.d ├── Equal.vo ├── Extensions.glob ├── Extensions.v ├── Extensions.v.d ├── Extensions.vo ├── Fixpoints.glob ├── Fixpoints.v ├── Fixpoints.v.d ├── Fixpoints.vo ├── General.glob ├── General.v ├── General.v.d ├── General.vo ├── README.md ├── SF_Closed.glob ├── SF_Closed.v ├── SF_Closed.v.d ├── SF_Closed.vo ├── SF_Eval.glob ├── SF_Eval.v ├── SF_Eval.v.d ├── SF_Eval.vo ├── SF_Normal.glob ├── SF_Normal.v ├── SF_Normal.v.d ├── SF_Normal.vo ├── SF_Tactics.glob ├── SF_Tactics.v ├── SF_Tactics.v.d ├── SF_Tactics.vo ├── SF_Terms.glob ├── SF_Terms.log ├── SF_Terms.v ├── SF_Terms.v.d ├── SF_Terms.vo ├── SF_reduction.glob ├── SF_reduction.v ├── SF_reduction.v.d ├── SF_reduction.vo ├── Star.glob ├── Star.v ├── Star.v.d ├── Star.vo ├── Substitution.glob ├── Substitution.v ├── Substitution.v.d ├── Substitution.vo ├── Test.glob ├── Test.v ├── Test.v.d ├── Test.vo ├── makefile ├── makefile.conf └── old_fixpoints.v ├── Tree_calculus ├── Abstraction.v ├── Abstraction2.v ├── Abstraction3.v ├── Abstraction4.v ├── Abstraction5.v ├── Abstraction_Reduction.v ├── Abstraction_Tactics.v ├── Abstraction_Terms.v ├── Abstraction_to_Tree.v ├── Case.v ├── Equal.v ├── Extensions.v ├── Fixpoints.v ├── Fixpoints_old.v ├── General.v ├── SF_Tactics.v ├── SF_Terms.v ├── SF_reduction.v ├── SF_to_tree.v ├── Self_Interpretation.v ├── Star.v ├── Substitution.v ├── Test.v ├── Tree_Closed.v ├── Tree_Eval.v ├── Tree_Interpretation.v ├── Tree_Normal.v ├── Tree_Tactics.v ├── Tree_Terms.v ├── Tree_reduction.v ├── Wait.v ├── Wait2.v ├── Wave_Factor.v ├── Wave_Factor2.v ├── Wave_Pure.v ├── occurs.v └── offcuts.v ├── _CoqProject ├── script ├── script~ ├── simpler_lambda_draft.pdf ├── the other left4.pdf └── type_for_lambda.pdf /#script#: -------------------------------------------------------------------------------- 1 | coqc -R "." "IntensionalLib" Closure_calculus/Closure_calculus.v 2 | coqc -R "." "IntensionalLib" Closure_calculus/not_church_numerals.v 3 | coqc -R "." "IntensionalLib" SF_calculus/Test.v 4 | coqc -R "." "IntensionalLib" SF_calculus/General.v 5 | coqc -R "." "IntensionalLib" SF_calculus/SF_Terms.v 6 | coqc -R "." "IntensionalLib" SF_calculus/SF_Tactics.v 7 | coqc -R "." "IntensionalLib" SF_calculus/SF_reduction.v 8 | coqc -R "." "IntensionalLib" SF_calculus/SF_Normal.v 9 | coqc -R "." "IntensionalLib" SF_calculus/SF_Closed.v 10 | coqc -R "." "IntensionalLib" SF_calculus/Substitution.v 11 | coqc -R "." "IntensionalLib" SF_calculus/SF_Eval.v 12 | coqc -R "." "IntensionalLib" SF_calculus/Star.v 13 | coqc -R "." "IntensionalLib" SF_calculus/Fixpoints.v 14 | coqc -R "." "IntensionalLib" SF_calculus/Equal.v 15 | coqc -R "." "IntensionalLib" SF_calculus/Extensions.v 16 | 17 | coqc -R "." "IntensionalLib" Closure_to_SF/Tagging.v 18 | coqc -R "." "IntensionalLib" Closure_to_SF/Adding.v 19 | coqc -R "." "IntensionalLib" Closure_to_SF/SF_size.v 20 | coqc -R "." "IntensionalLib" Closure_to_SF/Abstraction_to_Combination.v 21 | 22 | coqc -R "." "IntensionalLib" Fieska_calculus/Test.v 23 | coqc -R "." "IntensionalLib" Fieska_calculus/General.v 24 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Terms.v 25 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Tactics.v 26 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_reduction.v 27 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Normal.v 28 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Closed.v 29 | coqc -R "." "IntensionalLib" Fieska_calculus/Substitution.v 30 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Eval.v 31 | coqc -R "." "IntensionalLib" Fieska_calculus/Star.v 32 | coqc -R "." "IntensionalLib" Fieska_calculus/Fixpoints.v 33 | coqc -R "." "IntensionalLib" Fieska_calculus/Extensions.v 34 | 35 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Tagging.v 36 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Adding.v 37 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Fieska_size.v 38 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Abstraction_to_Combination.v 39 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Eta.v 40 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Optimization.v 41 | 42 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Terms.v 43 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Tactics.v 44 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Reduction.v 45 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Normal.v 46 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Equal.v 47 | coqc -R "." "IntensionalLib" Abstraction_calculus/Closure_to_Abstraction.v 48 | 49 | Using the _CoqProject file, run 50 | 51 | coq_makefile -f _CoqProject -o Makefile 52 | make 53 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Equal.glob: -------------------------------------------------------------------------------- 1 | DIGEST dd622d9647bfc9b51f13e9b6beea8f55 2 | FIntensionalLib.Abstraction_calculus.Abstraction_Equal 3 | R1516:1520 Coq.Arith.Arith <> <> lib 4 | R1538:1571 IntensionalLib.SF_calculus.General <> <> lib 5 | R1589:1641 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> <> lib 6 | R1660:1714 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> <> lib 7 | R1732:1788 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> <> lib 8 | R1806:1859 IntensionalLib.Abstraction_calculus.Abstraction_Normal <> <> lib 9 | R1922:1925 Coq.Init.Logic <> :type_scope:x_'/\'_x not 10 | R1922:1925 Coq.Init.Logic <> :type_scope:x_'/\'_x not 11 | R1971:1977 Coq.Init.Logic <> :type_scope:'exists'_x_'..'_x_','_x not 12 | R1979:1980 Coq.Init.Logic <> :type_scope:'exists'_x_'..'_x_','_x not 13 | R1971:1977 Coq.Init.Logic <> :type_scope:'exists'_x_'..'_x_','_x not 14 | R1979:1980 Coq.Init.Logic <> :type_scope:'exists'_x_'..'_x_','_x not 15 | prf 2112:2123 <> equal_normal 16 | R2145:2148 Coq.Init.Logic <> :type_scope:x_'->'_x not 17 | R2149:2153 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> c_red def 18 | R2180:2183 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> k_op def 19 | R2156:2158 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> App constr 20 | R2177:2177 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> M var 21 | R2161:2163 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> App constr 22 | R2174:2174 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> M var 23 | R2166:2167 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> Op constr 24 | R2169:2171 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> Eop constr 25 | R2137:2142 IntensionalLib.Abstraction_calculus.Abstraction_Normal <> normal ind 26 | R2144:2144 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> M var 27 | R2244:2251 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> succ_red constr 28 | R2261:2274 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> transitive_red thm 29 | R2261:2274 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> transitive_red thm 30 | R2284:2302 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 31 | R2284:2302 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 32 | R2312:2330 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 33 | R2312:2330 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 34 | prf 2406:2419 <> unequal_normal 35 | R2441:2444 Coq.Init.Logic <> :type_scope:x_'->'_x not 36 | R2463:2466 Coq.Init.Logic <> :type_scope:x_'->'_x not 37 | R2471:2513 Coq.Init.Logic <> :type_scope:x_'->'_x not 38 | R2514:2518 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> c_red def 39 | R2546:2548 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> App constr 40 | R2555:2558 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> i_op def 41 | R2550:2553 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> k_op def 42 | R2521:2523 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> App constr 43 | R2542:2542 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> N var 44 | R2526:2528 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> App constr 45 | R2539:2539 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> M var 46 | R2531:2532 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> Op constr 47 | R2534:2536 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> Eop constr 48 | R2468:2469 Coq.Init.Logic <> :type_scope:x_'<>'_x not 49 | R2467:2467 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> M var 50 | R2470:2470 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> N var 51 | R2455:2460 IntensionalLib.Abstraction_calculus.Abstraction_Normal <> normal ind 52 | R2462:2462 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> N var 53 | R2433:2438 IntensionalLib.Abstraction_calculus.Abstraction_Normal <> normal ind 54 | R2440:2440 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> M var 55 | R2646:2664 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> e_op_factorable_red constr 56 | R2674:2683 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> factorable def 57 | R2766:2773 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> succ_red constr 58 | R2795:2798 Coq.Init.Logic <> :type_scope:x_'\/'_x not 59 | R2790:2792 Coq.Init.Logic <> :type_scope:x_'='_x not 60 | R2801:2804 Coq.Init.Logic <> :type_scope:x_'<>'_x not 61 | R2795:2798 Coq.Init.Logic <> :type_scope:x_'\/'_x not 62 | R2790:2792 Coq.Init.Logic <> :type_scope:x_'='_x not 63 | R2801:2804 Coq.Init.Logic <> :type_scope:x_'<>'_x not 64 | R2868:2870 Coq.Init.Logic <> :type_scope:x_'<>'_x not 65 | R2868:2870 Coq.Init.Logic <> :type_scope:x_'<>'_x not 66 | R2931:2944 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> transitive_red thm 67 | R2931:2944 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> transitive_red thm 68 | R2954:2972 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 69 | R2954:2972 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 70 | R2982:3000 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 71 | R2982:3000 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 72 | R3013:3024 IntensionalLib.Abstraction_calculus.Abstraction_Equal <> equal_normal thm 73 | R3077:3090 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> transitive_red thm 74 | R3077:3090 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> transitive_red thm 75 | R3100:3118 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 76 | R3100:3118 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 77 | R3128:3146 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 78 | R3128:3146 IntensionalLib.Abstraction_calculus.Abstraction_Reduction <> preserves_app_c_red thm 79 | R3186:3193 IntensionalLib.Abstraction_calculus.Abstraction_Tactics <> succ_red constr 80 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Equal.v: -------------------------------------------------------------------------------- 1 | (* This Program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | 16 | 17 | (**********************************************************************) 18 | (* Abstraction_Equal.v *) 19 | (* *) 20 | (* Barry Jay *) 21 | (* *) 22 | (**********************************************************************) 23 | 24 | (* 25 | Add LoadPath ".." as IntensionalLib. 26 | *) 27 | Require Import Arith. 28 | Require Import IntensionalLib.SF_calculus.General. 29 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Terms. 30 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Tactics. 31 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Reduction. 32 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Normal. 33 | 34 | 35 | Ltac split_all := simpl; intros; 36 | match goal with 37 | | H : _ /\ _ |- _ => inversion_clear H; split_all 38 | | H : exists _, _ |- _ => inversion H; clear H; split_all 39 | | _ => try (split; split_all); try contradiction 40 | end; try congruence; auto. 41 | 42 | 43 | 44 | Theorem equal_normal : forall M, normal M -> c_red (App (App (Op Eop) M) M) k_op. 45 | Proof. 46 | intros M nf; induction nf; split_all. 47 | eapply2 succ_red. eapply transitive_red. eapply preserves_app_c_red. eapply preserves_app_c_red. 48 | eexact IHnf1. eexact IHnf2. auto. unfold_op. one_step. 49 | Qed. 50 | 51 | 52 | Theorem unequal_normal : forall M, normal M -> forall N, normal N -> M<>N -> 53 | c_red (App (App (Op Eop) M) N) (App k_op i_op). 54 | 55 | Proof. 56 | intros M nf; induction nf; split_all. 57 | (* 2 *) 58 | red; one_step. eapply2 e_op_factorable_red. unfold factorable; inversion H; eauto. 59 | (* 1 *) 60 | inversion H0; subst. red; one_step. 61 | eapply2 succ_red. 62 | assert (M1 = M0 \/ M1 <> M0) by repeat decide equality. inversion H5; subst. 63 | assert(M2<> M3) by (intro; eapply2 H1; congruence). 64 | (* 2 *) 65 | eapply transitive_red. eapply preserves_app_c_red. eapply preserves_app_c_red. 66 | eapply2 equal_normal. eapply2 IHnf2. auto. one_step. 67 | (* 1 *) 68 | eapply transitive_red. eapply preserves_app_c_red. eapply preserves_app_c_red. 69 | eapply2 IHnf1. auto. auto. eapply2 succ_red. 70 | Qed. 71 | 72 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Equal.v.d: -------------------------------------------------------------------------------- 1 | Abstraction_Equal.vo Abstraction_Equal.glob Abstraction_Equal.v.beautified: Abstraction_Equal.v 2 | Abstraction_Equal.vio: Abstraction_Equal.v 3 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Equal.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Abstraction_Equal.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Normal.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | 16 | (**********************************************************************) 17 | (* Abstraction_Normal.v *) 18 | (* *) 19 | (* Barry Jay *) 20 | (* *) 21 | (**********************************************************************) 22 | 23 | (* 24 | Add LoadPath ".." as IntensionalLib. 25 | *) 26 | 27 | Require Import Arith. 28 | Require Import IntensionalLib.SF_calculus.General. 29 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Terms. 30 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Tactics. 31 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Reduction. 32 | 33 | 34 | Ltac split_all := simpl; intros; 35 | match goal with 36 | | H : _ /\ _ |- _ => inversion_clear H; split_all 37 | | H : exists _, _ |- _ => inversion H; clear H; split_all 38 | | _ => try (split; split_all); try contradiction 39 | end; try congruence; auto. 40 | 41 | (* normal terms *) 42 | 43 | Inductive normal : Term -> Prop := 44 | | nf_op : forall o, normal (Op o) 45 | | nf_compound : forall M1 M2, normal M1 -> normal M2 -> 46 | compound (App M1 M2) -> normal (App M1 M2) 47 | . 48 | 49 | Hint Constructors normal. 50 | 51 | 52 | Definition irreducible M (red:termred) := forall N, red M N -> False. 53 | 54 | 55 | Lemma normal_is_irreducible: 56 | forall M, normal M -> irreducible M c_red1. 57 | Proof. 58 | intros M nor; induction nor; red; split_all; inv c_red1; inv1 compound; inv1 true_compound; 59 | subst; try (eapply2 IHnor1; fail); try (eapply2 IHnor2; fail). 60 | Qed. 61 | 62 | 63 | (* 64 | The basic progress result, that all irreducible terms are normal. 65 | *) 66 | 67 | Theorem abstraction_progress : forall (M : Term), normal M \/ (exists N,c_red1 M N) . 68 | Proof. 69 | induction M; try (inversion IHM); subst; split_all; eauto. 70 | (* 1 *) 71 | inversion IHM1; split_all. 2: right; exist (App x M2). 72 | inversion IHM2; split_all. 2: right; exist (App M1 x). 73 | gen_case H M1. 74 | case o; split_all. right; eauto. 75 | gen_case H t. inversion H; subst; case o; try (right; eauto; fail); try (left; eapply2 nf_compound; fail). 76 | gen_case H4 t0. 77 | right. inversion H0; subst; eauto. 78 | assert(o0=o1 \/ o0<> o1) by decide equality. 79 | inversion H1; subst; eauto. 80 | exist (App k_op i_op). eapply2 e_op_factorable_red. unfold factorable; eauto. intro; subst. 81 | invsub. 82 | exist (App k_op i_op). eapply2 e_op_factorable_red. unfold factorable; eauto. intro; subst. 83 | invsub. 84 | right. inversion H0; subst; eauto. 85 | exist (App k_op i_op). eapply2 e_compound_op_red. inversion H4; auto. 86 | exist (App (App (App (App (Op Eop) (left_component (App t1 t2))) (left_component (App M0 M3))) 87 | (App (App (Op Eop) (right_component (App t1 t2))) (right_component (App M0 M3)))) 88 | (App k_op i_op)). 89 | eapply2 e_compounds_red. inversion H4; auto. 90 | (* 1 *) 91 | inversion H; subst. inversion H5; subst. 92 | inversion H1; subst; try (left; eapply2 nf_compound; fail);try (right; eauto; fail). 93 | right; eauto. 94 | inversion H3. inversion H8; subst; eauto. 95 | right; eauto. 96 | inversion H0; subst; eauto. 97 | inversion H6; subst; eauto. 98 | inversion H10; eauto. 99 | (* 1 *) 100 | inv1 normal; subst; right; eauto. 101 | Qed. 102 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Normal.v.d: -------------------------------------------------------------------------------- 1 | Abstraction_Normal.vo Abstraction_Normal.glob Abstraction_Normal.v.beautified: Abstraction_Normal.v 2 | Abstraction_Normal.vio: Abstraction_Normal.v 3 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Normal.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Abstraction_Normal.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Reduction.v.d: -------------------------------------------------------------------------------- 1 | Abstraction_Reduction.vo Abstraction_Reduction.glob Abstraction_Reduction.v.beautified: Abstraction_Reduction.v 2 | Abstraction_Reduction.vio: Abstraction_Reduction.v 3 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Reduction.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Abstraction_Reduction.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Tactics.v.d: -------------------------------------------------------------------------------- 1 | Abstraction_Tactics.vo Abstraction_Tactics.glob Abstraction_Tactics.v.beautified: Abstraction_Tactics.v 2 | Abstraction_Tactics.vio: Abstraction_Tactics.v 3 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Tactics.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Abstraction_Tactics.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Terms.glob: -------------------------------------------------------------------------------- 1 | DIGEST 02d37e37c14e147dd46a477281d4017f 2 | FIntensionalLib.Abstraction_calculus.Abstraction_Terms 3 | ind 1620:1627 <> operator 4 | constr 1664:1666 <> Sop 5 | constr 1671:1673 <> Kop 6 | constr 1678:1680 <> Iop 7 | constr 1748:1750 <> Eop 8 | constr 1793:1795 <> Tag 9 | constr 1800:1802 <> Var 10 | constr 1806:1808 <> Add 11 | constr 1813:1815 <> Abs 12 | R1667:1667 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 13 | R1674:1674 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 14 | R1681:1681 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 15 | R1751:1751 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 16 | R1796:1796 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 17 | R1803:1803 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 18 | R1809:1809 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 19 | R1816:1816 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 20 | ind 1830:1833 <> Term 21 | constr 1848:1849 <> Op 22 | constr 1876:1878 <> App 23 | R1862:1865 Coq.Init.Logic <> :type_scope:x_'->'_x not 24 | R1866:1869 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> Term ind 25 | R1854:1861 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> operator ind 26 | R1886:1889 Coq.Init.Logic <> :type_scope:x_'->'_x not 27 | R1894:1897 Coq.Init.Logic <> :type_scope:x_'->'_x not 28 | R1898:1901 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> Term ind 29 | R1890:1893 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> Term ind 30 | R1882:1885 IntensionalLib.Abstraction_calculus.Abstraction_Terms <> Term ind 31 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Terms.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Abstraction_Terms.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | 27 | Inductive operator := 28 | (* extensional operators *) 29 | | Sop 30 | | Kop 31 | | Iop 32 | (* intensional operators, for interpreting closure calculus *) 33 | | Eop (* equality of programs, e.g. vars *) 34 | | Tag 35 | | Var 36 | | Add 37 | | Abs 38 | . 39 | 40 | Inductive Term: Set := 41 | | Op : operator -> Term 42 | | App : Term -> Term -> Term 43 | . 44 | 45 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Terms.v.d: -------------------------------------------------------------------------------- 1 | Abstraction_Terms.vo Abstraction_Terms.glob Abstraction_Terms.v.beautified: Abstraction_Terms.v 2 | Abstraction_Terms.vio: Abstraction_Terms.v 3 | -------------------------------------------------------------------------------- /Abstraction_calculus/Abstraction_Terms.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Abstraction_Terms.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Closure_to_Abstraction.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Closure_to_Abstraction.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | Add LoadPath ".." as IntensionalLib. 27 | 28 | Require Import Arith. 29 | Require Import IntensionalLib.SF_calculus.General. 30 | Require Import IntensionalLib.Closure_calculus.Closure_calculus. 31 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Terms. 32 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Tactics. 33 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Reduction. 34 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Normal. 35 | Require Import IntensionalLib.Abstraction_calculus.Abstraction_Equal. 36 | 37 | Ltac split_all := simpl; intros; 38 | match goal with 39 | | H : _ /\ _ |- _ => inversion_clear H; split_all 40 | | H : exists _, _ |- _ => inversion H; clear H; split_all 41 | | _ => try (split; split_all); try contradiction 42 | end; try congruence; auto. 43 | 44 | 45 | Fixpoint ref i := match i with 46 | | 0 => Op (Sop) 47 | | S i1 => App (Op Sop) (ref i1) 48 | end. 49 | 50 | Lemma ref_normal: forall i, normal (ref i). 51 | Proof. induction i; unfold ref; fold ref; unfold_op; split_all. Qed. 52 | 53 | 54 | Lemma ref_monotonic: forall i j, ref i = ref j -> i = j. 55 | Proof. 56 | induction i; split_all; gen_case H j; split_all; try discriminate. 57 | inversion H; subst. assert (i = n) by eapply2 IHi. auto. 58 | Qed. 59 | 60 | Lemma var_ref_normal: forall i, normal (App (Op Var) (ref i)). 61 | Proof. split_all. eapply2 nf_compound. eapply2 ref_normal. Qed. 62 | 63 | Hint Resolve ref_normal var_ref_normal. 64 | 65 | 66 | 67 | Fixpoint closure_to_abstraction (t: lambda) := 68 | match t with 69 | | Closure_calculus.Ref i => App (Op Var) (ref i) 70 | | Closure_calculus.Tag s t => App (App (Op Tag) (closure_to_abstraction s)) (closure_to_abstraction t) 71 | | Closure_calculus.App t u => App (closure_to_abstraction t) (closure_to_abstraction u) 72 | | Closure_calculus.Iop => Op Iop 73 | | Closure_calculus.Add sigma i u => App (App (App (Op Add) (closure_to_abstraction sigma)) (ref i)) (closure_to_abstraction u) 74 | | Closure_calculus.Abs sigma j t => App (App (App (Op Abs) (closure_to_abstraction sigma)) (ref j)) (closure_to_abstraction t) 75 | end. 76 | 77 | 78 | Lemma closure_to_abstraction_preserves_red1: forall M N, seq_red1 M N -> c_red (closure_to_abstraction M) (closure_to_abstraction N). 79 | Proof. 80 | intros M N r; induction r; split_all. 81 | (* 2 *) 82 | eapply2 succ_red. eapply transitive_red. eapply preserves_app_c_red. eapply preserves_app_c_red. 83 | eapply2 equal_normal. auto. auto. one_step. 84 | (* 1 *) 85 | eapply2 succ_red. eapply transitive_red. eapply preserves_app_c_red. eapply preserves_app_c_red. 86 | eapply2 unequal_normal. intro. eapply2 H. eapply2 ref_monotonic. auto. auto. 87 | eapply2 succ_red. 88 | Qed. 89 | 90 | 91 | Definition implies_red (red1 : lambda -> lambda -> Prop) (red2: termred) := 92 | forall M N, red1 M N -> red2(closure_to_abstraction M) (closure_to_abstraction N). 93 | 94 | Lemma implies_red_multi_step: forall red1 red2, implies_red red1 (multi_step red2) -> 95 | implies_red (Closure_calculus.multi_step red1) (multi_step red2). 96 | Proof. red. 97 | intros red1 red2 IR M N R; induction R; split_all. 98 | apply transitive_red with (closure_to_abstraction N); auto. 99 | Qed. 100 | 101 | Theorem closure_to_abstraction_preserves_reduction: forall M N, Closure_calculus.seq_red M N -> c_red (closure_to_abstraction M) (closure_to_abstraction N). 102 | Proof. intros. eapply2 (implies_red_multi_step). red. apply closure_to_abstraction_preserves_red1. 103 | Qed. 104 | 105 | 106 | Theorem closure_to_abstraction_preserves_normal : forall M, Closure_calculus.normal M -> normal (closure_to_abstraction M). 107 | Proof. intros M nf; induction nf; split_all. Qed. 108 | 109 | -------------------------------------------------------------------------------- /Abstraction_calculus/Closure_to_Abstraction.v.d: -------------------------------------------------------------------------------- 1 | Closure_to_Abstraction.vo Closure_to_Abstraction.glob Closure_to_Abstraction.v.beautified: Closure_to_Abstraction.v 2 | Closure_to_Abstraction.vio: Closure_to_Abstraction.v 3 | -------------------------------------------------------------------------------- /Abstraction_calculus/Closure_to_Abstraction.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Closure_to_Abstraction.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Normal.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Normal.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Reduction.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Reduction.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Tactics.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Tactics.vo -------------------------------------------------------------------------------- /Abstraction_calculus/Terms.glob: -------------------------------------------------------------------------------- 1 | DIGEST ae1c13ccc316b7291a980895d60614d6 2 | FTerms 3 | R2283:2287 Coq.Arith.Arith <> <> lib 4 | R2305:2311 General <> <> lib 5 | R2329:2332 Test <> <> lib 6 | ind 2389:2396 <> operator 7 | constr 2433:2435 <> Sop 8 | constr 2440:2442 <> Kop 9 | constr 2447:2449 <> Iop 10 | constr 2523:2525 <> Eop 11 | constr 2568:2570 <> Fop 12 | constr 2574:2576 <> Tag 13 | constr 2581:2583 <> Var 14 | constr 2587:2589 <> Add 15 | constr 2594:2596 <> Abs 16 | R2436:2436 Terms <> operator ind 17 | R2443:2443 Terms <> operator ind 18 | R2450:2450 Terms <> operator ind 19 | R2526:2526 Terms <> operator ind 20 | R2571:2571 Terms <> operator ind 21 | R2577:2577 Terms <> operator ind 22 | R2584:2584 Terms <> operator ind 23 | R2590:2590 Terms <> operator ind 24 | R2597:2597 Terms <> operator ind 25 | ind 2611:2614 <> Term 26 | constr 2629:2630 <> Op 27 | constr 2657:2659 <> App 28 | R2647:2650 Terms <> Term ind 29 | R2635:2642 Terms <> operator ind 30 | R2679:2682 Terms <> Term ind 31 | R2671:2674 Terms <> Term ind 32 | R2663:2666 Terms <> Term ind 33 | -------------------------------------------------------------------------------- /Abstraction_calculus/Terms.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Abstraction_calculus/Terms.vo -------------------------------------------------------------------------------- /Abstraction_calculus/makefile.conf: -------------------------------------------------------------------------------- 1 | # This configuration file was generated by running: 2 | # coq_makefile -o makefile Abstraction_Equal.v Abstraction_Normal.v Abstraction_Reduction.v Abstraction_Tactics.v Abstraction_Terms.v Closure_to_Abstraction.v 3 | 4 | 5 | ############################################################################### 6 | # # 7 | # Project files. # 8 | # # 9 | ############################################################################### 10 | 11 | COQMF_VFILES = Abstraction_Equal.v Abstraction_Normal.v Abstraction_Reduction.v Abstraction_Tactics.v Abstraction_Terms.v Closure_to_Abstraction.v 12 | COQMF_MLIFILES = 13 | COQMF_MLFILES = 14 | COQMF_ML4FILES = 15 | COQMF_MLPACKFILES = 16 | COQMF_MLLIBFILES = 17 | 18 | ############################################################################### 19 | # # 20 | # Path directives (-I, -R, -Q). # 21 | # # 22 | ############################################################################### 23 | 24 | COQMF_OCAMLLIBS = -I . 25 | COQMF_SRC_SUBDIRS = . 26 | COQMF_COQLIBS = -I . -R . Top 27 | COQMF_COQLIBS_NOML = -R . Top 28 | 29 | ############################################################################### 30 | # # 31 | # Coq configuration. # 32 | # # 33 | ############################################################################### 34 | 35 | COQMF_LOCAL=0 36 | COQMF_COQLIB=/home/barry/.opam/4.05.0/lib/coq/ 37 | COQMF_DOCDIR=/home/barry/.opam/4.05.0/share/doc/coq/ 38 | COQMF_OCAMLFIND=/home/barry/.opam/4.05.0/bin/ocamlfind 39 | COQMF_CAMLP4=camlp5 40 | COQMF_CAMLP4O=/home/barry/.opam/4.05.0/bin/camlp5o 41 | COQMF_CAMLP4BIN=/home/barry/.opam/4.05.0/bin/ 42 | COQMF_CAMLP4LIB=/home/barry/.opam/4.05.0/lib/camlp5 43 | COQMF_CAMLP4OPTIONS=-loc loc 44 | COQMF_CAMLFLAGS=-thread -rectypes -w +a-4-9-27-41-42-44-45-48-50 -safe-string 45 | COQMF_HASNATDYNLINK=true 46 | COQMF_COQ_SRC_SUBDIRS=config dev lib kernel library engine pretyping interp parsing proofs tactics toplevel printing intf grammar ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/fourier plugins/funind plugins/ltac plugins/micromega plugins/nsatz plugins/omega plugins/quote plugins/romega plugins/rtauto plugins/setoid_ring plugins/ssr plugins/ssrmatching plugins/syntax plugins/xml 47 | COQMF_WINDRIVE=/home/barry/.opam/4.05.0/lib/coq 48 | 49 | ############################################################################### 50 | # # 51 | # Extra variables. # 52 | # # 53 | ############################################################################### 54 | 55 | COQMF_OTHERFLAGS = 56 | COQMF_INSTALLCOQDOCROOT = Top 57 | -------------------------------------------------------------------------------- /Closure_calculus/Closure_calculus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_calculus/Closure_calculus.pdf -------------------------------------------------------------------------------- /Closure_calculus/Closure_calculus.v.d: -------------------------------------------------------------------------------- 1 | Closure_calculus.vo Closure_calculus.glob Closure_calculus.v.beautified: Closure_calculus.v 2 | Closure_calculus.vio: Closure_calculus.v 3 | -------------------------------------------------------------------------------- /Closure_calculus/Closure_calculus.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_calculus/Closure_calculus.vo -------------------------------------------------------------------------------- /Closure_calculus/README.md: -------------------------------------------------------------------------------- 1 | # Closure_calculus 2 | 3 | This branch contains a *new* version of Closure calculus, 4 | which is uni-variate, not multi-variate. 5 | 6 | The old calculus is described in Closure_calculus.pdf. The new 7 | calculus generalizes the usual lambda abstractions to become 8 | *closures* of the form 9 | 10 | lambda sigma x t 11 | 12 | where sigma is an explicit substitution, x is the bound variable and t 13 | is the abstraction body. 14 | 15 | 16 | A key feature of this calculus is that reduction does not need to keep 17 | track of scopes in any way; no knowledge of free and bound variables, 18 | scopes or variable re-naming is required. This is a key step towards 19 | converting abstractions into combinations of operators. 20 | 21 | Comment. At present, this has triggered changes in all other 22 | sub-directories. Refactoring will be use to limit the changes to the 23 | translations, and not the directories containing SF-calculus and 24 | Fieska-calculus. Also, the pdf's need updating. 25 | 26 | Closure_calculus.pdf is now a proper paper. 27 | -------------------------------------------------------------------------------- /Closure_calculus/makefile.conf: -------------------------------------------------------------------------------- 1 | # This configuration file was generated by running: 2 | # coq_makefile -o makefile Closure_calculus.v 3 | 4 | 5 | ############################################################################### 6 | # # 7 | # Project files. # 8 | # # 9 | ############################################################################### 10 | 11 | COQMF_VFILES = Closure_calculus.v 12 | COQMF_MLIFILES = 13 | COQMF_MLFILES = 14 | COQMF_ML4FILES = 15 | COQMF_MLPACKFILES = 16 | COQMF_MLLIBFILES = 17 | 18 | ############################################################################### 19 | # # 20 | # Path directives (-I, -R, -Q). # 21 | # # 22 | ############################################################################### 23 | 24 | COQMF_OCAMLLIBS = -I . 25 | COQMF_SRC_SUBDIRS = . 26 | COQMF_COQLIBS = -I . -R . Top 27 | COQMF_COQLIBS_NOML = -R . Top 28 | 29 | ############################################################################### 30 | # # 31 | # Coq configuration. # 32 | # # 33 | ############################################################################### 34 | 35 | COQMF_LOCAL=0 36 | COQMF_COQLIB=/home/barry/.opam/4.05.0/lib/coq/ 37 | COQMF_DOCDIR=/home/barry/.opam/4.05.0/share/doc/coq/ 38 | COQMF_OCAMLFIND=/home/barry/.opam/4.05.0/bin/ocamlfind 39 | COQMF_CAMLP4=camlp5 40 | COQMF_CAMLP4O=/home/barry/.opam/4.05.0/bin/camlp5o 41 | COQMF_CAMLP4BIN=/home/barry/.opam/4.05.0/bin/ 42 | COQMF_CAMLP4LIB=/home/barry/.opam/4.05.0/lib/camlp5 43 | COQMF_CAMLP4OPTIONS=-loc loc 44 | COQMF_CAMLFLAGS=-thread -rectypes -w +a-4-9-27-41-42-44-45-48-50 -safe-string 45 | COQMF_HASNATDYNLINK=true 46 | COQMF_COQ_SRC_SUBDIRS=config dev lib kernel library engine pretyping interp parsing proofs tactics toplevel printing intf grammar ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/fourier plugins/funind plugins/ltac plugins/micromega plugins/nsatz plugins/omega plugins/quote plugins/romega plugins/rtauto plugins/setoid_ring plugins/ssr plugins/ssrmatching plugins/syntax plugins/xml 47 | COQMF_WINDRIVE=/home/barry/.opam/4.05.0/lib/coq 48 | 49 | ############################################################################### 50 | # # 51 | # Extra variables. # 52 | # # 53 | ############################################################################### 54 | 55 | COQMF_OTHERFLAGS = 56 | COQMF_INSTALLCOQDOCROOT = Top 57 | -------------------------------------------------------------------------------- /Closure_calculus/not_church_numerals.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* not_church_numerals *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | Require Import List Omega Closure_calculus. 27 | 28 | 29 | (* primitive recursion 30 | https://en.wikipedia.org/wiki/Lambda_calculus#Arithmetic_in_lambda_calculus 31 | *) 32 | 33 | (* 34 | The Church numeral n is an iterator, that maps f and x to f^n (x). 35 | Church numerals don't work in closure calculus, at least with the traditinal account of 36 | predecessor, since pred zero reduces to a normal form which, unlike zero, 37 | has a non-empty environment. 38 | *) 39 | 40 | Definition zero_c:= ff. (* \fx. x *) 41 | Definition succ_c := 42 | Abs Iop 2 (Abs (Add Iop 2 (Ref 2)) 1 (Abs (Add (Add Iop 2 (Ref 2)) 1 (Ref 1)) 0 43 | (Tag (Ref 1) (Tag (Tag (Ref 2) (Ref 1)) (Ref 0))))). 44 | (* \nfx.f(nfx) *) 45 | 46 | Fixpoint church n := 47 | match n with 48 | | 0 => ff 49 | | S n => Abs (Add Iop 2 (church n)) 1 (Abs (Add (Add Iop 2 (Ref 2)) 1 (Ref 1)) 0 50 | (Tag (Ref 1) (Tag (Tag (Ref 2) (Ref 1)) (Ref 0)))) 51 | end. 52 | 53 | Lemma church_numerals_are_normal: forall n, normal (church n). 54 | Proof. 55 | induction n; unfold church; fold church; unfold zero, value; split_all. unfold ff; auto. 56 | repeat eapply2 nf_abs. 57 | Qed. 58 | 59 | Hint Resolve church_numerals_are_normal. 60 | 61 | Lemma succ_church: forall n, seq_red (App succ_c (church n)) (church (S n)). 62 | Proof. intro; unfold succ_c. repeat eapply2 succ_red. Qed. 63 | 64 | 65 | Definition is_zero_c := Abs Iop 0 (Tag (Tag (Ref 0) (Abs Iop 0 ff)) tt). 66 | 67 | Lemma is_zero_c_zero_c: seq_red (App is_zero_c zero_c) tt . 68 | Proof. unfold is_zero_c, zero_c, ff, tt; split_all. repeat eapply2 succ_red. Qed. 69 | 70 | Lemma is_zero_c_succ_c: forall n, seq_red (App is_zero_c (church (S n))) ff . 71 | Proof. intros. unfold church, is_zero_c, tt, ff, church. repeat eapply2 succ_red. Qed. 72 | 73 | 74 | Definition my_pred_c := 75 | Abs Iop 2 (Abs (Add Iop 2 (Ref 2)) 1 (Abs (Add (Add Iop 2 (Ref 2)) 1 (Ref 1)) 0 76 | (Tag (Tag (Tag (Ref 2) (Abs (Add (Add Iop 1 (Ref 1)) 0 (Ref 0)) 4 77 | (Abs (Add (Add (Add Iop 1 (Ref 1)) 0 (Ref 0)) 4 (Ref 4)) 3 78 | (Tag (Ref 3) (Tag (Ref 4) (Ref 1)))))) 79 | (Abs Iop 5 (Ref 0))) 80 | Iop))) 81 | (* λnfx. n (\gh. h(gf))(\u.x)(\u.u) *) 82 | . 83 | 84 | Definition pred_0_nf := 85 | Abs (Add Iop 2 (Abs Iop 1 (Abs Iop 0 (Ref 0)))) 1 86 | (Abs (Add (Add Iop 2 (Ref 2)) 1 (Ref 1)) 0 87 | (Tag 88 | (Tag 89 | (Tag (Ref 2) 90 | (Abs (Add (Add Iop 1 (Ref 1)) 0 (Ref 0)) 4 91 | (Abs (Add (Add (Add Iop 1 (Ref 1)) 0 (Ref 0)) 4 (Ref 4)) 3 (Tag (Ref 3) (Tag (Ref 4) (Ref 1)))))) 92 | (Abs Iop 5 (Ref 0))) Iop)). 93 | 94 | 95 | Lemma pred_0_val : seq_red (App my_pred_c zero_c) pred_0_nf. 96 | Proof. unfold my_pred_c, zero_c, ff, tt. repeat eapply2 succ_red. Qed. 97 | 98 | 99 | Lemma pred_zero_fails: ~(seq_red (App my_pred_c zero_c) zero_c). 100 | Proof. 101 | intro. 102 | assert (exists n, seq_red zero_c n /\ seq_red pred_0_nf n). 103 | eapply2 closure_confluence. eapply2 pred_0_val. split_all. 104 | assert(irreducible zero_c seq_red1). 105 | eapply2 irreducible_iff_normal. 106 | replace zero_c with (church 0) by auto. eapply2 church_numerals_are_normal. 107 | assert(x = zero_c). 108 | inversion H0; auto. 109 | assert False by eapply2 H1. contradiction. subst. 110 | assert(irreducible pred_0_nf seq_red1). 111 | eapply2 irreducible_iff_normal. 112 | unfold pred_0_nf; auto 20. 113 | assert(zero_c = pred_0_nf). 114 | inversion H2; auto. 115 | assert False by eapply2 H3. contradiction. discriminate. 116 | Qed. 117 | 118 | -------------------------------------------------------------------------------- /Closure_calculus/not_church_numerals.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_calculus/not_church_numerals.vo -------------------------------------------------------------------------------- /Closure_to_Fieska/Abstraction_to_Combination.v.d: -------------------------------------------------------------------------------- 1 | Closure_to_Fieska/Abstraction_to_Combination.vo Closure_to_Fieska/Abstraction_to_Combination.glob Closure_to_Fieska/Abstraction_to_Combination.v.beautified: Closure_to_Fieska/Abstraction_to_Combination.v Closure_calculus/Closure_calculus.vo Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Star.vo Fieska_calculus/Fixpoints.vo Fieska_calculus/Extensions.vo Fieska_calculus/Tagging.vo Fieska_calculus/Adding.vo 2 | Closure_to_Fieska/Abstraction_to_Combination.vio: Closure_to_Fieska/Abstraction_to_Combination.v Closure_calculus/Closure_calculus.vio Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio Fieska_calculus/Star.vio Fieska_calculus/Fixpoints.vio Fieska_calculus/Extensions.vio Fieska_calculus/Tagging.vio Fieska_calculus/Adding.vio 3 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Abstraction_to_Combination.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_Fieska/Abstraction_to_Combination.vo -------------------------------------------------------------------------------- /Closure_to_Fieska/Adding.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Adding.vo Fieska_calculus/Adding.glob Fieska_calculus/Adding.v.beautified: Fieska_calculus/Adding.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Star.vo Fieska_calculus/Fixpoints.vo Fieska_calculus/Extensions.vo Fieska_calculus/Tagging.vo 2 | Fieska_calculus/Adding.vio: Fieska_calculus/Adding.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio Fieska_calculus/Star.vio Fieska_calculus/Fixpoints.vio Fieska_calculus/Extensions.vio Fieska_calculus/Tagging.vio 3 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Adding.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_Fieska/Adding.vo -------------------------------------------------------------------------------- /Closure_to_Fieska/Eta.v.d: -------------------------------------------------------------------------------- 1 | Closure_to_Fieska/Eta.vo Closure_to_Fieska/Eta.glob Closure_to_Fieska/Eta.v.beautified: Closure_to_Fieska/Eta.v Closure_calculus/Closure_calculus.vo Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Star.vo Fieska_calculus/Fixpoints.vo Fieska_calculus/Extensions.vo Fieska_calculus/Tagging.vo Fieska_calculus/Adding.vo Closure_to_Fieska/Abstraction_to_Combination.vo 2 | Closure_to_Fieska/Eta.vio: Closure_to_Fieska/Eta.v Closure_calculus/Closure_calculus.vio Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio Fieska_calculus/Star.vio Fieska_calculus/Fixpoints.vio Fieska_calculus/Extensions.vio Fieska_calculus/Tagging.vio Fieska_calculus/Adding.vio Closure_to_Fieska/Abstraction_to_Combination.vio 3 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Eta.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_Fieska/Eta.vo -------------------------------------------------------------------------------- /Closure_to_Fieska/Fieska_size.glob: -------------------------------------------------------------------------------- 1 | DIGEST ea22d4eb62aa661cc188656610c36525 2 | FIntensionalLib.Closure_to_Fieska.Fieska_size 3 | R1667:1671 Coq.Arith.Arith <> <> lib 4 | R1673:1677 Coq.omega.Omega <> <> lib 5 | R1679:1681 Coq.Arith.Max <> <> lib 6 | R1683:1686 Coq.Bool.Bool <> <> lib 7 | R1688:1691 Coq.Lists.List <> <> lib 8 | R1709:1743 IntensionalLib.Fieska_calculus.Test <> <> lib 9 | R1761:1798 IntensionalLib.Fieska_calculus.General <> <> lib 10 | R1816:1858 IntensionalLib.Fieska_calculus.Fieska_Terms <> <> lib 11 | R1876:1920 IntensionalLib.Fieska_calculus.Fieska_Tactics <> <> lib 12 | R1938:1984 IntensionalLib.Fieska_calculus.Fieska_reduction <> <> lib 13 | R2002:2045 IntensionalLib.Fieska_calculus.Fieska_Normal <> <> lib 14 | R2063:2106 IntensionalLib.Fieska_calculus.Fieska_Closed <> <> lib 15 | R2124:2166 IntensionalLib.Fieska_calculus.Substitution <> <> lib 16 | R2184:2225 IntensionalLib.Fieska_calculus.Fieska_Eval <> <> lib 17 | R2243:2277 IntensionalLib.Fieska_calculus.Star <> <> lib 18 | R2295:2334 IntensionalLib.Fieska_calculus.Fixpoints <> <> lib 19 | R2352:2392 IntensionalLib.Fieska_calculus.Extensions <> <> lib 20 | R2410:2449 IntensionalLib.Closure_to_Fieska.Tagging <> <> lib 21 | R2467:2505 IntensionalLib.Closure_to_Fieska.Adding <> <> lib 22 | R2523:2581 IntensionalLib.Closure_to_Fieska.Abstraction_to_Combination <> <> lib 23 | def 2704:2707 <> size 24 | R2721:2721 IntensionalLib.Closure_to_Fieska.Fieska_size <> M var 25 | R2731:2733 IntensionalLib.Fieska_calculus.Fieska_Terms <> Ref constr 26 | R2744:2745 IntensionalLib.Fieska_calculus.Fieska_Terms <> Op constr 27 | R2756:2758 IntensionalLib.Fieska_calculus.Fieska_Terms <> App constr 28 | R2776:2778 Coq.Init.Peano <> :nat_scope:x_'+'_x not 29 | R2769:2772 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 30 | R2779:2782 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 31 | prf 2803:2809 <> size_Y2 32 | R2824:2826 Coq.Init.Logic <> :type_scope:x_'='_x not 33 | R2812:2815 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 34 | R2818:2820 IntensionalLib.Fieska_calculus.Fixpoints <> Y_k def 35 | prf 2863:2869 <> size_Y3 36 | R2884:2886 Coq.Init.Logic <> :type_scope:x_'='_x not 37 | R2872:2875 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 38 | R2878:2880 IntensionalLib.Fieska_calculus.Fixpoints <> Y_k def 39 | prf 2923:2929 <> size_Y4 40 | R2944:2946 Coq.Init.Logic <> :type_scope:x_'='_x not 41 | R2932:2935 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 42 | R2938:2940 IntensionalLib.Fieska_calculus.Fixpoints <> Y_k def 43 | prf 2983:2990 <> size_var 44 | R3013:3015 Coq.Init.Logic <> :type_scope:x_'='_x not 45 | R2994:2997 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 46 | R3000:3002 IntensionalLib.Closure_to_Fieska.Tagging <> var def 47 | R3005:3006 IntensionalLib.Fieska_calculus.Fieska_Terms <> Op constr 48 | R3008:3010 IntensionalLib.Fieska_calculus.Fieska_Terms <> Sop constr 49 | prf 3053:3060 <> size_add 50 | R3078:3080 Coq.Init.Logic <> :type_scope:x_'='_x not 51 | R3063:3066 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 52 | R3069:3071 IntensionalLib.Closure_to_Fieska.Adding <> add def 53 | R3073:3076 IntensionalLib.Fieska_calculus.Fieska_reduction <> i_op def 54 | R3129:3176 IntensionalLib.Closure_calculus.Closure_calculus <> <> lib 55 | prf 3187:3203 <> size_identity_abs 56 | R3250:3252 Coq.Init.Logic <> :type_scope:x_'='_x not 57 | R3206:3209 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 58 | R3212:3228 IntensionalLib.Closure_to_Fieska.Abstraction_to_Combination <> closure_to_fieska def 59 | R3231:3233 IntensionalLib.Closure_calculus.Closure_calculus <> Abs constr 60 | R3242:3244 IntensionalLib.Closure_calculus.Closure_calculus <> Ref constr 61 | R3235:3237 IntensionalLib.Closure_calculus.Closure_calculus <> Iop constr 62 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Fieska_size.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Size *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | (* 26 | Add LoadPath ".." as IntensionalLib. 27 | *) 28 | 29 | Require Import Arith Omega Max Bool List. 30 | Require Import IntensionalLib.Fieska_calculus.Test. 31 | Require Import IntensionalLib.Fieska_calculus.General. 32 | Require Import IntensionalLib.Fieska_calculus.Fieska_Terms. 33 | Require Import IntensionalLib.Fieska_calculus.Fieska_Tactics. 34 | Require Import IntensionalLib.Fieska_calculus.Fieska_reduction. 35 | Require Import IntensionalLib.Fieska_calculus.Fieska_Normal. 36 | Require Import IntensionalLib.Fieska_calculus.Fieska_Closed. 37 | Require Import IntensionalLib.Fieska_calculus.Substitution. 38 | Require Import IntensionalLib.Fieska_calculus.Fieska_Eval. 39 | Require Import IntensionalLib.Fieska_calculus.Star. 40 | Require Import IntensionalLib.Fieska_calculus.Fixpoints. 41 | Require Import IntensionalLib.Fieska_calculus.Extensions. 42 | Require Import IntensionalLib.Closure_to_Fieska.Tagging. 43 | Require Import IntensionalLib.Closure_to_Fieska.Adding. 44 | Require Import IntensionalLib.Closure_to_Fieska.Abstraction_to_Combination. 45 | 46 | (* 47 | From Bignums Require Import BigN. 48 | 49 | Delimit Scope bigN_scope with bigN. 50 | Local Open Scope bigN_scope. 51 | *) 52 | 53 | 54 | Set Printing Depth 10000. 55 | 56 | Fixpoint size M := 57 | match M with 58 | | Ref _ => 1 59 | | Op _ => 1 60 | | App M1 M2 => size M2 + size M1 61 | end . 62 | 63 | 64 | 65 | Lemma size_Y2: size (Y_k 2) = 28. 66 | Proof. cbv. auto. Qed. 67 | 68 | Lemma size_Y3: size (Y_k 3) = 46. 69 | Proof. cbv. auto. Qed. 70 | 71 | Lemma size_Y4: size (Y_k 4) = 64. 72 | Proof. cbv. auto. Qed. 73 | 74 | Lemma size_var : size (var (Op Sop)) = 48. 75 | Proof. cbv; auto. Qed. 76 | 77 | 78 | Lemma size_add: size (add i_op) = 3144. 79 | Proof. cbv. auto. Qed. 80 | 81 | 82 | Require Import IntensionalLib.Closure_calculus.Closure_calculus. 83 | 84 | 85 | Lemma size_identity_abs: size (closure_to_fieska (Abs Iop 0 (Ref 0))) = 3199. 86 | Proof. cbv. auto. Qed. 87 | 88 | 89 | 90 | Notation "A ~ B" := (Fieska_Terms.App A B) (at level 79, left associativity). 91 | Notation S := (Op Sop). 92 | Notation F := (Op Fop). 93 | Notation K := (Op Kop). 94 | Notation I := (Fieska_Terms.Op Fieska_Terms.Iop). 95 | Notation A := (Op Aop). 96 | 97 | Lemma identity_abs_combinator: 98 | (closure_to_fieska (Abs Closure_calculus.Iop 0%nat (Closure_calculus.Ref 0%nat))) = s_op. 99 | Proof. 100 | cbv. 101 | 102 | 103 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Fieska_size.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Fieska_size.vo Fieska_calculus/Fieska_size.glob Fieska_calculus/Fieska_size.v.beautified: Fieska_calculus/Fieska_size.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Star.vo Fieska_calculus/Fixpoints.vo Fieska_calculus/Extensions.vo Fieska_calculus/Tagging.vo Fieska_calculus/Adding.vo 2 | Fieska_calculus/Fieska_size.vio: Fieska_calculus/Fieska_size.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio Fieska_calculus/Star.vio Fieska_calculus/Fixpoints.vio Fieska_calculus/Extensions.vio Fieska_calculus/Tagging.vio Fieska_calculus/Adding.vio 3 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Fieska_size.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_Fieska/Fieska_size.vo -------------------------------------------------------------------------------- /Closure_to_Fieska/Optimization.v.d: -------------------------------------------------------------------------------- 1 | Optimization.vo Optimization.glob Optimization.v.beautified: Optimization.v 2 | Optimization.vio: Optimization.v 3 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Optimization.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_Fieska/Optimization.vo -------------------------------------------------------------------------------- /Closure_to_Fieska/README.md: -------------------------------------------------------------------------------- 1 | # Closure_to_Fieska 2 | 3 | Translating closure calculus to Fieska-calculus. See ../SF-calculus/deconstruction.pdf for details. The translation of the identity abstraction uses 4 | 5 | 8030 6 | 7 | operators, which is better than 98140 operators in SF-calculus. In 8 | turn, this can be optimized to 1 operator, I, in Optimization.v by 9 | using a variant of the eta-rule of lambda-calculus. Details can be 10 | found in Section 4 of the paper "Recursive Programs in Normal Form" 11 | (./rpnf.pdf). 12 | 13 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Tagging.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This Program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Tagging.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | Require Import Arith Omega Max Bool List. 27 | Require Import IntensionalLib.Fieska_calculus.Test. 28 | Require Import IntensionalLib.Fieska_calculus.General. 29 | Require Import IntensionalLib.Fieska_calculus.Fieska_Terms. 30 | Require Import IntensionalLib.Fieska_calculus.Fieska_Tactics. 31 | Require Import IntensionalLib.Fieska_calculus.Fieska_reduction. 32 | Require Import IntensionalLib.Fieska_calculus.Fieska_Normal. 33 | Require Import IntensionalLib.Fieska_calculus.Fieska_Closed. 34 | Require Import IntensionalLib.Fieska_calculus.Substitution. 35 | Require Import IntensionalLib.Fieska_calculus.Fieska_Eval. 36 | Require Import IntensionalLib.Fieska_calculus.Star. 37 | Require Import IntensionalLib.Fieska_calculus.Fixpoints. 38 | Require Import IntensionalLib.Fieska_calculus.Extensions. 39 | 40 | 41 | (* tagging and variables *) 42 | 43 | 44 | Ltac pattern_size_out := 45 | unfold a_op; unfold_op; 46 | (* rewrite ? pattern_size_star_opt; *) 47 | repeat try (rewrite pattern_size_closed; [| rewrite Y_k_closed; omega]); 48 | unfold pattern_size; fold pattern_size; 49 | repeat try (rewrite pattern_size_closed; [| rewrite Y_k_closed; omega]); 50 | unfold plus; fold plus. 51 | 52 | Definition pair M N := App (App (Op Fop) M) N. 53 | 54 | Lemma subst_rec_preserves_pair: 55 | forall M N P k, subst_rec (pair M N) P k = pair (subst_rec M P k) (subst_rec N P k). 56 | Proof. unfold pair; split_all. Qed. 57 | 58 | Definition var_fn := 59 | star_opt (star_opt (star_opt (App (Ref 2) (app_comb (App (Ref 2) (Ref 1)) (Ref 0))))). 60 | Definition var M := app_comb (app_comb (app_comb omega3 omega3) var_fn) M. 61 | Definition tag M N := var (app_comb M N). 62 | 63 | 64 | 65 | Lemma var_red: forall M N, sf_red (App (var M) N) (tag (var M) N). 66 | Proof. 67 | intros; unfold var, var_fn, app_comb. eval_tac. eval_tac. eval_tac. 68 | eapply transitive_red. eapply preserves_app_sf_red. eapply2 omega3_omega3. auto. 69 | eval_tac. eval_tac. eval_tac. eval_tac. eval_tac. eval_tac. eval_tac. eval_tac. 70 | unfold Y3, app_comb. eapply transitive_red. eapply2 star_opt_beta. 71 | unfold subst, subst_rec; fold subst_rec. 72 | rewrite ! (subst_rec_closed omega3). 2: unfold omega3; cbv; auto. 73 | unfold lift; rewrite ! subst_rec_lift_rec; try omega. 74 | rewrite ! lift_rec_null. insert_Ref_out. 75 | unfold lift, lift_rec; fold lift_rec. 76 | unfold lift; rewrite ! lift_rec_null. 77 | unfold tag, var, var_fn, app_comb. 78 | eapply2 preserves_app_sf_red. eval_tac. eval_tac. 79 | Qed. 80 | 81 | 82 | Lemma tag_red: forall M N P, sf_red (App (tag M N) P) (tag (tag M N) P). 83 | Proof. intros; unfold tag. eapply transitive_red. eapply2 var_red. unfold tag; auto. Qed. 84 | 85 | 86 | Lemma pattern_size_var : forall M, pattern_size (var M) = pattern_size M. 87 | Proof. intros; unfold var, var_fn, app_comb; unfold_op. pattern_size_out. 88 | rewrite pattern_size_closed. simpl. omega. cbv. auto. 89 | Qed. 90 | 91 | Lemma subst_rec_preserves_Y3: forall f N k, subst_rec (Y3 f) N k = Y3 (subst_rec f N k). 92 | Proof. 93 | unfold Y3, app_comb; intros. rewrite subst_rec_preserves_star_opt. 94 | unfold subst_rec; fold subst_rec. rewrite ! (subst_rec_closed omega3). 95 | 2: unfold omega3; cbv; omega. insert_Ref_out. 96 | unfold lift. rewrite subst_rec_lift_rec1; try omega. auto. 97 | Qed. 98 | 99 | Lemma var_fn_program: program var_fn. 100 | Proof. 101 | unfold var_fn, pair, program, app_comb; intros; split. repeat eapply2 star_opt_normal. 102 | repeat rewrite maxvar_star_opt. cbv. auto. 103 | Qed. 104 | 105 | Lemma var_normal: forall M, normal M -> normal (var M). 106 | Proof. 107 | intros. unfold var, app_comb. nf_out; try eapply2 omega3_program; auto. 108 | eapply2 var_fn_program. 109 | Qed. 110 | 111 | 112 | Lemma var_maxvar: forall M, maxvar (var M) = maxvar M. 113 | Proof. 114 | intros. unfold var, app_comb. simpl. auto. 115 | Qed. 116 | 117 | Hint Resolve var_fn_program. 118 | 119 | 120 | (* delete ? 121 | Lemma var_fn_pattern_normal: pattern_normal 0 var_fn. 122 | Proof. 123 | unfold var_fn. replace 0 with (pred (pred (pred 3))) by omega. 124 | repeat eapply2 pattern_normal_star_opt. simpl. 125 | repeat eapply2 pattern_normal_app_comb; eapply2 pnf_normal. 126 | eapply2 nf_active. nf_out; auto. 127 | Qed. 128 | 129 | *) -------------------------------------------------------------------------------- /Closure_to_Fieska/Tagging.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Tagging.vo Fieska_calculus/Tagging.glob Fieska_calculus/Tagging.v.beautified: Fieska_calculus/Tagging.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Star.vo Fieska_calculus/Fixpoints.vo Fieska_calculus/Extensions.vo 2 | Fieska_calculus/Tagging.vio: Fieska_calculus/Tagging.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio Fieska_calculus/Star.vio Fieska_calculus/Fixpoints.vio Fieska_calculus/Extensions.vio 3 | -------------------------------------------------------------------------------- /Closure_to_Fieska/Tagging.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_Fieska/Tagging.vo -------------------------------------------------------------------------------- /Closure_to_Fieska/identity_abs_val.glob: -------------------------------------------------------------------------------- 1 | DIGEST 75a6673ade43b60e350305baf2b3c042 2 | FIntensionalLib.Closure_to_Fieska.identity_abs_val 3 | R1663:1667 Coq.Arith.Arith <> <> lib 4 | R1669:1673 Coq.omega.Omega <> <> lib 5 | R1675:1677 Coq.Arith.Max <> <> lib 6 | R1679:1682 Coq.Bool.Bool <> <> lib 7 | R1684:1687 Coq.Lists.List <> <> lib 8 | R1719:1722 Bignums.BigN.BigN <> <> lib 9 | R1742:1789 IntensionalLib.Closure_calculus.Closure_calculus <> <> lib 10 | R1808:1842 IntensionalLib.Fieska_calculus.Test <> <> lib 11 | R1860:1897 IntensionalLib.Fieska_calculus.General <> <> lib 12 | R1915:1957 IntensionalLib.Fieska_calculus.Fieska_Terms <> <> lib 13 | R1975:2019 IntensionalLib.Fieska_calculus.Fieska_Tactics <> <> lib 14 | R2037:2083 IntensionalLib.Fieska_calculus.Fieska_reduction <> <> lib 15 | R2101:2144 IntensionalLib.Fieska_calculus.Fieska_Normal <> <> lib 16 | R2162:2205 IntensionalLib.Fieska_calculus.Fieska_Closed <> <> lib 17 | R2223:2265 IntensionalLib.Fieska_calculus.Substitution <> <> lib 18 | R2283:2324 IntensionalLib.Fieska_calculus.Fieska_Eval <> <> lib 19 | R2342:2376 IntensionalLib.Fieska_calculus.Star <> <> lib 20 | R2394:2433 IntensionalLib.Fieska_calculus.Fixpoints <> <> lib 21 | R2451:2491 IntensionalLib.Fieska_calculus.Extensions <> <> lib 22 | R2509:2548 IntensionalLib.Closure_to_Fieska.Tagging <> <> lib 23 | R2566:2604 IntensionalLib.Closure_to_Fieska.Adding <> <> lib 24 | R2622:2665 IntensionalLib.Closure_to_Fieska.Fieska_size <> <> lib 25 | R2684:2742 IntensionalLib.Closure_to_Fieska.Abstraction_to_Combination <> <> lib 26 | prf 2753:2769 <> size_identity_abs 27 | R2858:2860 Coq.Init.Logic <> :type_scope:x_'='_x not 28 | R2773:2776 IntensionalLib.Closure_to_Fieska.Fieska_size <> size def 29 | R2779:2794 IntensionalLib.Closure_to_Fieska.Abstraction_to_Combination <> lambda_to_fieska def 30 | R2797:2799 IntensionalLib.Closure_calculus.Closure_calculus <> Abs constr 31 | R2829:2848 IntensionalLib.Closure_calculus.Closure_calculus <> Ref constr 32 | R2801:2820 IntensionalLib.Closure_calculus.Closure_calculus <> Iop constr 33 | -------------------------------------------------------------------------------- /Closure_to_Fieska/identity_abs_val.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* identity_abs_val *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | 27 | Add LoadPath ".." as IntensionalLib. 28 | 29 | Require Import Arith Omega Max Bool List. 30 | 31 | From Bignums Require Import BigN. 32 | 33 | Require Import IntensionalLib.Closure_calculus.Closure_calculus. 34 | 35 | Require Import IntensionalLib.Fieska_calculus.Test. 36 | Require Import IntensionalLib.Fieska_calculus.General. 37 | Require Import IntensionalLib.Fieska_calculus.Fieska_Terms. 38 | Require Import IntensionalLib.Fieska_calculus.Fieska_Tactics. 39 | Require Import IntensionalLib.Fieska_calculus.Fieska_reduction. 40 | Require Import IntensionalLib.Fieska_calculus.Fieska_Normal. 41 | Require Import IntensionalLib.Fieska_calculus.Fieska_Closed. 42 | Require Import IntensionalLib.Fieska_calculus.Substitution. 43 | Require Import IntensionalLib.Fieska_calculus.Fieska_Eval. 44 | Require Import IntensionalLib.Fieska_calculus.Star. 45 | Require Import IntensionalLib.Fieska_calculus.Fixpoints. 46 | Require Import IntensionalLib.Fieska_calculus.Extensions. 47 | Require Import IntensionalLib.Closure_to_Fieska.Tagging. 48 | Require Import IntensionalLib.Closure_to_Fieska.Adding. 49 | Require Import IntensionalLib.Closure_to_Fieska.Fieska_size. 50 | 51 | Require Import IntensionalLib.Closure_to_Fieska.Abstraction_to_Combination. 52 | 53 | 54 | Lemma size_identity_abs: 55 | size (lambda_to_fieska (Abs Closure_calculus.Iop 0%nat (Closure_calculus.Ref 0%nat))) = 4436%bigN. 56 | Proof. cbv. auto. Qed. 57 | -------------------------------------------------------------------------------- /Closure_to_Fieska/identity_abs_val.v.d: -------------------------------------------------------------------------------- 1 | Closure_to_Fieska/identity_abs_val.vo Closure_to_Fieska/identity_abs_val.glob Closure_to_Fieska/identity_abs_val.v.beautified: Closure_to_Fieska/identity_abs_val.v Closure_calculus/Closure_calculus.vo Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Star.vo Fieska_calculus/Fixpoints.vo Fieska_calculus/Extensions.vo Fieska_calculus/Tagging.vo Fieska_calculus/Adding.vo Fieska_calculus/Fieska_size.vo Closure_to_Fieska/Abstraction_to_Combination.vo 2 | Closure_to_Fieska/identity_abs_val.vio: Closure_to_Fieska/identity_abs_val.v Closure_calculus/Closure_calculus.vio Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio Fieska_calculus/Star.vio Fieska_calculus/Fixpoints.vio Fieska_calculus/Extensions.vio Fieska_calculus/Tagging.vio Fieska_calculus/Adding.vio Fieska_calculus/Fieska_size.vio Closure_to_Fieska/Abstraction_to_Combination.vio 3 | -------------------------------------------------------------------------------- /Closure_to_Fieska/identity_abs_val.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_Fieska/identity_abs_val.vo -------------------------------------------------------------------------------- /Closure_to_Fieska/makefile.conf: -------------------------------------------------------------------------------- 1 | # This configuration file was generated by running: 2 | # coq_makefile -o makefile Abstraction_to_Combination.v Eta.v Optimization.v identity_abs_val.v 3 | 4 | 5 | ############################################################################### 6 | # # 7 | # Project files. # 8 | # # 9 | ############################################################################### 10 | 11 | COQMF_VFILES = Abstraction_to_Combination.v Eta.v Optimization.v identity_abs_val.v 12 | COQMF_MLIFILES = 13 | COQMF_MLFILES = 14 | COQMF_ML4FILES = 15 | COQMF_MLPACKFILES = 16 | COQMF_MLLIBFILES = 17 | 18 | ############################################################################### 19 | # # 20 | # Path directives (-I, -R, -Q). # 21 | # # 22 | ############################################################################### 23 | 24 | COQMF_OCAMLLIBS = -I . 25 | COQMF_SRC_SUBDIRS = . 26 | COQMF_COQLIBS = -I . -R . Top 27 | COQMF_COQLIBS_NOML = -R . Top 28 | 29 | ############################################################################### 30 | # # 31 | # Coq configuration. # 32 | # # 33 | ############################################################################### 34 | 35 | COQMF_LOCAL=0 36 | COQMF_COQLIB=/home/barry/.opam/4.05.0/lib/coq/ 37 | COQMF_DOCDIR=/home/barry/.opam/4.05.0/share/doc/coq/ 38 | COQMF_OCAMLFIND=/home/barry/.opam/4.05.0/bin/ocamlfind 39 | COQMF_CAMLP4=camlp5 40 | COQMF_CAMLP4O=/home/barry/.opam/4.05.0/bin/camlp5o 41 | COQMF_CAMLP4BIN=/home/barry/.opam/4.05.0/bin/ 42 | COQMF_CAMLP4LIB=/home/barry/.opam/4.05.0/lib/camlp5 43 | COQMF_CAMLP4OPTIONS=-loc loc 44 | COQMF_CAMLFLAGS=-thread -rectypes -w +a-4-9-27-41-42-44-45-48-50 -safe-string 45 | COQMF_HASNATDYNLINK=true 46 | COQMF_COQ_SRC_SUBDIRS=config dev lib kernel library engine pretyping interp parsing proofs tactics toplevel printing intf grammar ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/fourier plugins/funind plugins/ltac plugins/micromega plugins/nsatz plugins/omega plugins/quote plugins/romega plugins/rtauto plugins/setoid_ring plugins/ssr plugins/ssrmatching plugins/syntax plugins/xml 47 | COQMF_WINDRIVE=/home/barry/.opam/4.05.0/lib/coq 48 | 49 | ############################################################################### 50 | # # 51 | # Extra variables. # 52 | # # 53 | ############################################################################### 54 | 55 | COQMF_OTHERFLAGS = 56 | COQMF_INSTALLCOQDOCROOT = Top 57 | -------------------------------------------------------------------------------- /Closure_to_Fieska/rpnf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_Fieska/rpnf.pdf -------------------------------------------------------------------------------- /Closure_to_SF/Abstraction_to_Combination.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_SF/Abstraction_to_Combination.vo -------------------------------------------------------------------------------- /Closure_to_SF/Adding.v.d: -------------------------------------------------------------------------------- 1 | Adding.vo Adding.glob Adding.v.beautified: Adding.v 2 | Adding.vio: Adding.v 3 | -------------------------------------------------------------------------------- /Closure_to_SF/Adding.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_SF/Adding.vo -------------------------------------------------------------------------------- /Closure_to_SF/README.md: -------------------------------------------------------------------------------- 1 | # Closure_to_SF 2 | 3 | Translating closure calculus to SF-calculus. See ../SF-calculus/deconstruction.pdf for details. The translation of the identity abstraction uses 4 | 5 | 98140 6 | 7 | operators! 8 | 9 | -------------------------------------------------------------------------------- /Closure_to_SF/SF_size.glob: -------------------------------------------------------------------------------- 1 | DIGEST 524b3947432cf2b3f27a0641979fc4d4 2 | FIntensionalLib.Closure_to_SF.SF_size 3 | R1669:1673 Coq.Arith.Arith <> <> lib 4 | R1675:1679 Coq.omega.Omega <> <> lib 5 | R1681:1683 Coq.Arith.Max <> <> lib 6 | R1685:1688 Coq.Bool.Bool <> <> lib 7 | R1690:1693 Coq.Lists.List <> <> lib 8 | R1711:1744 IntensionalLib.SF_calculus.General <> <> lib 9 | R1764:1798 IntensionalLib.SF_calculus.SF_Terms <> <> lib 10 | R1818:1854 IntensionalLib.SF_calculus.SF_Tactics <> <> lib 11 | R1874:1912 IntensionalLib.SF_calculus.SF_reduction <> <> lib 12 | R1932:1967 IntensionalLib.SF_calculus.SF_Normal <> <> lib 13 | R1987:2022 IntensionalLib.SF_calculus.SF_Closed <> <> lib 14 | R2042:2080 IntensionalLib.SF_calculus.Substitution <> <> lib 15 | R2100:2133 IntensionalLib.SF_calculus.SF_Eval <> <> lib 16 | R2153:2183 IntensionalLib.SF_calculus.Star <> <> lib 17 | R2203:2238 IntensionalLib.SF_calculus.Fixpoints <> <> lib 18 | R2258:2289 IntensionalLib.SF_calculus.Equal <> <> lib 19 | R2309:2345 IntensionalLib.SF_calculus.Extensions <> <> lib 20 | R2366:2401 IntensionalLib.Closure_to_SF.Tagging <> <> lib 21 | R2421:2455 IntensionalLib.Closure_to_SF.Adding <> <> lib 22 | R2475:2529 IntensionalLib.Closure_to_SF.Abstraction_to_Combination <> <> lib 23 | def 2655:2658 <> size 24 | R2672:2672 IntensionalLib.Closure_to_SF.SF_size <> M var 25 | R2682:2684 IntensionalLib.SF_calculus.SF_Terms <> Ref constr 26 | R2696:2697 IntensionalLib.SF_calculus.SF_Terms <> Op constr 27 | R2708:2710 IntensionalLib.SF_calculus.SF_Terms <> App constr 28 | R2721:2721 Coq.Init.Peano <> :nat_scope:x_'+'_x not 29 | R2729:2733 Coq.Init.Peano <> :nat_scope:x_'+'_x not 30 | R2741:2741 Coq.Init.Peano <> :nat_scope:x_'+'_x not 31 | R2722:2725 IntensionalLib.Closure_to_SF.SF_size <> size def 32 | R2734:2737 IntensionalLib.Closure_to_SF.SF_size <> size def 33 | prf 2757:2764 <> var_size 34 | R2782:2784 Coq.Init.Logic <> :type_scope:x_'='_x not 35 | R2767:2770 IntensionalLib.Closure_to_SF.SF_size <> size def 36 | R2773:2775 IntensionalLib.Closure_to_SF.Tagging <> var def 37 | R2777:2780 IntensionalLib.SF_calculus.SF_reduction <> s_op def 38 | prf 2824:2831 <> size_add 39 | R2849:2851 Coq.Init.Logic <> :type_scope:x_'='_x not 40 | R2834:2837 IntensionalLib.Closure_to_SF.SF_size <> size def 41 | R2840:2842 IntensionalLib.Closure_to_SF.Adding <> add def 42 | R2844:2847 IntensionalLib.SF_calculus.SF_reduction <> i_op def 43 | R2900:2947 IntensionalLib.Closure_calculus.Closure_calculus <> <> lib 44 | prf 2957:2973 <> size_identity_abs 45 | R3051:3053 Coq.Init.Logic <> :type_scope:x_'='_x not 46 | R2977:2980 IntensionalLib.Closure_to_SF.SF_size <> size def 47 | R2983:2995 IntensionalLib.Closure_to_SF.Abstraction_to_Combination <> closure_to_SF def 48 | R2998:3000 IntensionalLib.Closure_calculus.Closure_calculus <> Abs constr 49 | R3026:3045 IntensionalLib.Closure_calculus.Closure_calculus <> Ref constr 50 | R3002:3021 IntensionalLib.Closure_calculus.Closure_calculus <> Iop constr 51 | -------------------------------------------------------------------------------- /Closure_to_SF/SF_size.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This Program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* SF_size.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | (* 26 | Add LoadPath ".." as IntensionalLib. 27 | *) 28 | 29 | Require Import Arith Omega Max Bool List. 30 | Require Import IntensionalLib.SF_calculus.General. 31 | Require Import IntensionalLib.SF_calculus.SF_Terms. 32 | Require Import IntensionalLib.SF_calculus.SF_Tactics. 33 | Require Import IntensionalLib.SF_calculus.SF_reduction. 34 | Require Import IntensionalLib.SF_calculus.SF_Normal. 35 | Require Import IntensionalLib.SF_calculus.SF_Closed. 36 | Require Import IntensionalLib.SF_calculus.Substitution. 37 | Require Import IntensionalLib.SF_calculus.SF_Eval. 38 | Require Import IntensionalLib.SF_calculus.Star. 39 | Require Import IntensionalLib.SF_calculus.Fixpoints. 40 | Require Import IntensionalLib.SF_calculus.Equal. 41 | Require Import IntensionalLib.SF_calculus.Extensions. 42 | 43 | Require Import IntensionalLib.Closure_to_SF.Tagging. 44 | Require Import IntensionalLib.Closure_to_SF.Adding. 45 | Require Import IntensionalLib.Closure_to_SF.Abstraction_to_Combination. 46 | 47 | (* 48 | From Bignums Require Import BigN. 49 | 50 | 51 | Delimit Scope bigN_scope with bigN. 52 | Local Open Scope bigN_scope. 53 | *) 54 | 55 | Fixpoint size M := 56 | match M with 57 | | Ref _ => 2 58 | | Op _ => 1 59 | | App M1 M2 => (size M2) + (size M1) 60 | end . 61 | 62 | 63 | Lemma var_size: size (var s_op) = 417 . 64 | Proof. cbv. auto. Qed. 65 | 66 | 67 | Lemma size_add: size (add i_op) = 17855. 68 | Proof. cbv. auto. Qed. 69 | 70 | 71 | Require Import IntensionalLib.Closure_calculus.Closure_calculus. 72 | 73 | Lemma size_identity_abs: 74 | size (closure_to_SF (Abs Closure_calculus.Iop 0 (Closure_calculus.Ref 0))) = 18290. 75 | Proof. cbv. auto. Qed. 76 | 77 | -------------------------------------------------------------------------------- /Closure_to_SF/SF_size.v.d: -------------------------------------------------------------------------------- 1 | SF_size.vo SF_size.glob SF_size.v.beautified: SF_size.v 2 | SF_size.vio: SF_size.v 3 | -------------------------------------------------------------------------------- /Closure_to_SF/SF_size.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_SF/SF_size.vo -------------------------------------------------------------------------------- /Closure_to_SF/Tagging.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/Tagging.vo SF_calculus/Tagging.glob SF_calculus/Tagging.v.beautified: SF_calculus/Tagging.v SF_calculus/General.vo SF_calculus/SF_Terms.vo SF_calculus/SF_Tactics.vo SF_calculus/SF_reduction.vo SF_calculus/SF_Normal.vo SF_calculus/SF_Closed.vo SF_calculus/Substitution.vo SF_calculus/SF_Eval.vo SF_calculus/Star.vo SF_calculus/Fixpoints.vo SF_calculus/Extensions.vo 2 | SF_calculus/Tagging.vio: SF_calculus/Tagging.v SF_calculus/General.vio SF_calculus/SF_Terms.vio SF_calculus/SF_Tactics.vio SF_calculus/SF_reduction.vio SF_calculus/SF_Normal.vio SF_calculus/SF_Closed.vio SF_calculus/Substitution.vio SF_calculus/SF_Eval.vio SF_calculus/Star.vio SF_calculus/Fixpoints.vio SF_calculus/Extensions.vio 3 | -------------------------------------------------------------------------------- /Closure_to_SF/Tagging.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_SF/Tagging.vo -------------------------------------------------------------------------------- /Closure_to_SF/deconstruction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_SF/deconstruction.pdf -------------------------------------------------------------------------------- /Closure_to_SF/identity_abs_val.glob: -------------------------------------------------------------------------------- 1 | DIGEST cec47527f4cd8dbd39e4588a53cf427f 2 | FIntensionalLib.Closure_to_SF.identity_abs_val 3 | R1668:1672 Coq.Arith.Arith <> <> lib 4 | R1674:1678 Coq.omega.Omega <> <> lib 5 | R1680:1682 Coq.Arith.Max <> <> lib 6 | R1684:1687 Coq.Bool.Bool <> <> lib 7 | R1689:1692 Coq.Lists.List <> <> lib 8 | R1724:1727 Bignums.BigN.BigN <> <> lib 9 | R1747:1794 IntensionalLib.Closure_calculus.Closure_calculus <> <> lib 10 | R1813:1843 IntensionalLib.SF_calculus.Test <> <> lib 11 | R1861:1894 IntensionalLib.SF_calculus.General <> <> lib 12 | R1912:1946 IntensionalLib.SF_calculus.SF_Terms <> <> lib 13 | R1964:2000 IntensionalLib.SF_calculus.SF_Tactics <> <> lib 14 | R2018:2056 IntensionalLib.SF_calculus.SF_reduction <> <> lib 15 | R2074:2109 IntensionalLib.SF_calculus.SF_Normal <> <> lib 16 | R2127:2162 IntensionalLib.SF_calculus.SF_Closed <> <> lib 17 | R2180:2218 IntensionalLib.SF_calculus.Substitution <> <> lib 18 | R2236:2269 IntensionalLib.SF_calculus.SF_Eval <> <> lib 19 | R2287:2317 IntensionalLib.SF_calculus.Star <> <> lib 20 | R2335:2370 IntensionalLib.SF_calculus.Fixpoints <> <> lib 21 | R2388:2424 IntensionalLib.SF_calculus.Extensions <> <> lib 22 | R2442:2477 IntensionalLib.Closure_to_SF.Tagging <> <> lib 23 | R2495:2529 IntensionalLib.Closure_to_SF.Adding <> <> lib 24 | R2547:2582 IntensionalLib.Closure_to_SF.SF_size <> <> lib 25 | R2601:2655 IntensionalLib.Closure_to_SF.Abstraction_to_Combination <> <> lib 26 | prf 2666:2682 <> size_identity_abs 27 | R2764:2766 Coq.Init.Logic <> :type_scope:x_'='_x not 28 | R2686:2689 IntensionalLib.Closure_to_SF.SF_size <> size def 29 | R2692:2704 IntensionalLib.Closure_to_SF.Abstraction_to_Combination <> closure_to_SF def 30 | R2707:2709 IntensionalLib.Closure_calculus.Closure_calculus <> Abs constr 31 | R2739:2758 IntensionalLib.Closure_calculus.Closure_calculus <> Ref constr 32 | R2711:2730 IntensionalLib.Closure_calculus.Closure_calculus <> Iop constr 33 | -------------------------------------------------------------------------------- /Closure_to_SF/identity_abs_val.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* identity_abs_val *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | (* 27 | Add LoadPath ".." as IntensionalLib. 28 | *) 29 | 30 | Require Import Arith Omega Max Bool List. 31 | 32 | From Bignums Require Import BigN. 33 | 34 | Require Import IntensionalLib.Closure_calculus.Closure_calculus. 35 | 36 | Require Import IntensionalLib.SF_calculus.Test. 37 | Require Import IntensionalLib.SF_calculus.General. 38 | Require Import IntensionalLib.SF_calculus.SF_Terms. 39 | Require Import IntensionalLib.SF_calculus.SF_Tactics. 40 | Require Import IntensionalLib.SF_calculus.SF_reduction. 41 | Require Import IntensionalLib.SF_calculus.SF_Normal. 42 | Require Import IntensionalLib.SF_calculus.SF_Closed. 43 | Require Import IntensionalLib.SF_calculus.Substitution. 44 | Require Import IntensionalLib.SF_calculus.SF_Eval. 45 | Require Import IntensionalLib.SF_calculus.Star. 46 | Require Import IntensionalLib.SF_calculus.Fixpoints. 47 | Require Import IntensionalLib.SF_calculus.Extensions. 48 | Require Import IntensionalLib.Closure_to_SF.Tagging. 49 | Require Import IntensionalLib.Closure_to_SF.Adding. 50 | Require Import IntensionalLib.Closure_to_SF.SF_size. 51 | 52 | Require Import IntensionalLib.Closure_to_SF.Abstraction_to_Combination. 53 | 54 | 55 | Lemma size_identity_abs: 56 | size (closure_to_SF (Abs Closure_calculus.Iop 0%nat (Closure_calculus.Ref 0))) = 58444%bigN. 57 | Proof. cbv. auto. Qed. 58 | -------------------------------------------------------------------------------- /Closure_to_SF/identity_abs_val.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Closure_to_SF/identity_abs_val.vo -------------------------------------------------------------------------------- /Fieska_calculus/Extensions.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Extensions.vo Fieska_calculus/Extensions.glob Fieska_calculus/Extensions.v.beautified: Fieska_calculus/Extensions.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Star.vo Fieska_calculus/Fixpoints.vo 2 | Fieska_calculus/Extensions.vio: Fieska_calculus/Extensions.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio Fieska_calculus/Star.vio Fieska_calculus/Fixpoints.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Extensions.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Extensions.vo -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Closed.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Fieska_Closed.glob Fieska_calculus/Fieska_Closed.v.beautified: Fieska_calculus/Fieska_Closed.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo 2 | Fieska_calculus/Fieska_Closed.vio: Fieska_calculus/Fieska_Closed.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Closed.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Fieska_Closed.vo -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Eval.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | (**********************************************************************) 16 | 17 | (**********************************************************************) 18 | (* Fieska_Eval.v *) 19 | (* *) 20 | (* Barry Jay *) 21 | (* *) 22 | (**********************************************************************) 23 | 24 | Require Import Arith Omega Max Bool List. 25 | Require Import IntensionalLib.Fieska_calculus.Test. 26 | Require Import IntensionalLib.Fieska_calculus.General. 27 | Require Import IntensionalLib.Fieska_calculus.Fieska_Terms. 28 | Require Import IntensionalLib.Fieska_calculus.Fieska_Tactics. 29 | Require Import IntensionalLib.Fieska_calculus.Fieska_reduction. 30 | Require Import IntensionalLib.Fieska_calculus.Fieska_Normal. 31 | Require Import IntensionalLib.Fieska_calculus.Fieska_Closed. 32 | Require Import IntensionalLib.Fieska_calculus.Substitution. 33 | 34 | Definition eval_app M N := 35 | match M with 36 | | App (App (Op Sop) M1) M2 => App (App M1 N) (App M2 N) 37 | | App (App (Op Aop) M1) M2 => App (App M1 M2) N 38 | | App (App (Op Fop) (Op _)) M2 => M2 39 | | App (Op Kop) M2 => M2 40 | | Op Iop => N 41 | | x => App x N 42 | end. 43 | 44 | 45 | Lemma eval_app_from_Fieska : forall M N, sf_red (App M N) (eval_app M N). 46 | Proof. 47 | induction M; split_all. 48 | case o; split_all. red; one_step. 49 | gen_case IHM1 M1. gen_case IHM1 o. red; one_step. 50 | gen_case IHM1 f. gen_case IHM1 o. red; one_step. 51 | gen_case IHM1 f0. red; one_step. 52 | red; one_step. 53 | Qed. 54 | 55 | 56 | Fixpoint eval0 (M: Fieska) := 57 | match M with 58 | | Ref i => Ref i 59 | | Op o => Op o 60 | | App (Op Fop) M11 => App (Op Fop) (eval0 M11) 61 | | App M1 M11 => eval_app (eval0 M1) M11 62 | end. 63 | 64 | Lemma eval0_from_Fieska : forall M, sf_red M (eval0 M). 65 | Proof. 66 | induction M; split_all. 67 | eapply transitive_red. 68 | eapply preserves_app_sf_red. eapply2 IHM1. auto. 69 | eapply transitive_red. 70 | eapply2 eval_app_from_Fieska. 71 | case M1; split_all. 72 | case o; split_all. 73 | eapply preserves_app_sf_red. auto. eapply2 IHM2. 74 | Qed. 75 | 76 | 77 | Ltac eval_tac := unfold_op; 78 | match goal with 79 | | |- sf_red ?M _ => red; eval_tac 80 | | |- multi_step sf_red1 ?M _ => 81 | (apply transitive_red with (eval0 M); 82 | [eapply2 eval0_from_Fieska | 83 | unfold eval0, eval_app; unfold subst; split_all]) 84 | | _ => auto 85 | end. 86 | 87 | 88 | (* Boolean operations *) 89 | 90 | Definition not M := App (App M (App k_op i_op)) k_op. 91 | 92 | Lemma not_true : sf_red (not k_op) (App k_op i_op). 93 | Proof. unfold not; eval_tac. Qed. 94 | 95 | Lemma not_false : sf_red (not (App k_op i_op)) k_op. 96 | Proof. eval_tac. Qed. 97 | 98 | Definition iff M N := App (App M N) (not N). 99 | 100 | Lemma true_true : sf_red (iff k_op k_op) k_op. 101 | Proof. unfold iff; unfold not; eval_tac; split_all. Qed. 102 | Lemma true_false : sf_red (iff k_op (App k_op i_op)) (App k_op i_op). 103 | Proof. unfold iff; unfold not; eval_tac; split_all. Qed. 104 | Lemma false_true : sf_red (iff (App k_op i_op) k_op) (App k_op i_op). 105 | Proof. unfold iff; unfold not; eval_tac; eval_tac; eval_tac; eval_tac; split_all. Qed. 106 | Lemma false_false : sf_red (iff (App k_op i_op) (App k_op i_op)) k_op. 107 | Proof. 108 | unfold iff, not. unfold_op. repeat eval_tac. Qed. 109 | 110 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Eval.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Fieska_Eval.glob Fieska_calculus/Fieska_Eval.v.beautified: Fieska_calculus/Fieska_Eval.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo 2 | Fieska_calculus/Fieska_Eval.vio: Fieska_calculus/Fieska_Eval.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Eval.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Fieska_Eval.vo -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Normal.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | 16 | (**********************************************************************) 17 | (* Fieska_Normal.v *) 18 | (* *) 19 | (* Barry Jay *) 20 | (* *) 21 | (**********************************************************************) 22 | 23 | Require Import Arith Omega Max Bool List. 24 | Require Import IntensionalLib.Fieska_calculus.Test. 25 | Require Import IntensionalLib.Fieska_calculus.General. 26 | Require Import IntensionalLib.Fieska_calculus.Fieska_Terms. 27 | Require Import IntensionalLib.Fieska_calculus.Fieska_Tactics. 28 | Require Import IntensionalLib.Fieska_calculus.Fieska_reduction. 29 | 30 | Inductive status_val := 31 | | Active : status_val 32 | | Passive : status_val 33 | . 34 | 35 | Fixpoint status M := 36 | match M with 37 | | Ref _ => Active 38 | | Op _ => Passive 39 | | App (App (App (Op Fop) M1) _ ) _ => status M1 40 | | App (App (Op Eop) M1) M2 => match status M1 with Active => Active | _ => status M2 end 41 | | App M1 _ => status M1 42 | end. 43 | 44 | (* normal terms *) 45 | 46 | Inductive normal : Fieska -> Prop := 47 | | nf_ref : forall n, normal (Ref n) 48 | | nf_op : forall o, normal (Op o) 49 | | nf_active : forall M1 M2, normal M1 -> normal M2 -> 50 | status (App M1 M2) = Active -> 51 | normal (App M1 M2) 52 | | nf_compound : forall M1 M2, normal M1 -> normal M2 -> 53 | compound (App M1 M2) -> normal (App M1 M2) 54 | . 55 | 56 | Hint Constructors normal. 57 | 58 | 59 | 60 | 61 | Definition irreducible M (red:termred) := forall N, red M N -> False. 62 | 63 | Lemma ref_irreducible : forall n, irreducible (Ref n) sf_seqred1. 64 | Proof. intro n. red. split_all. inversion H; auto. Qed. 65 | 66 | Lemma normal_is_irreducible: 67 | forall M, normal M -> irreducible M sf_seqred1. 68 | Proof. 69 | intros M nor; induction nor; split_all. 70 | eapply2 ref_irreducible. 71 | red; split_all. inversion H. 72 | intro. intro. inversion H0; subst; simpl in *; try discriminate. 73 | (* 7 *) 74 | eapply2 IHnor1. 75 | (* 6 *) 76 | eapply2 IHnor2. 77 | (* 5 *) 78 | gen2_case H4 H P; subst; inv1 compound; subst; split_all; discriminate. 79 | (* 4 *) 80 | gen2_case H4 H M2; subst; inv1 compound; subst; split_all; discriminate. 81 | (* 3 *) 82 | gen2_case H4 H M; subst; inv1 compound; subst; split_all; discriminate. 83 | (* 2 *) 84 | gen2_case H3 H M; subst; inv1 compound; subst; split_all; discriminate. 85 | (* 1 *) 86 | intro. intro. inversion H0; subst; simpl in *; try (inversion H; fail). 87 | eapply2 IHnor1. 88 | eapply2 IHnor2. 89 | Qed. 90 | 91 | 92 | Theorem Fieska_progress : forall (M : Fieska), normal M \/ (exists N, sf_seqred1 M N) . 93 | Proof. 94 | induction M; try (inversion IHM); subst; split_all; eauto. 95 | (* 1 *) 96 | inversion IHM1; split_all. 2: right; inversion H; exist (App x M2). 97 | inversion IHM2; split_all. 2: right; inversion H0; exist (App M1 x). 98 | gen_case H M1. case o; try (right; eauto; fail); left; auto. 99 | inversion H; subst. 100 | (* 2 *) 101 | left; auto. 102 | eapply2 nf_active. gen_case H5 f. discriminate. gen_case H5 f1. gen_case H5 o. 103 | discriminate. 104 | (* 1 *) 105 | gen2_case H3 H5 f. 106 | gen2_case H3 H5 o; try (right; eauto; fail); try (left; auto; fail). 107 | inversion H4; subst; try (right; eauto; fail); try (left; auto; fail). 108 | inversion H0; subst; try (right; eauto; fail); try (left; auto; fail). 109 | right. assert(o0 = o1 \/ o0 <> o1) by decide equality. 110 | inversion H1; subst; eauto. 111 | left. eapply2 nf_active. simpl in *. rewrite H6. auto. 112 | inversion H0; subst; try (left; auto; fail); try (right; eauto; fail). 113 | left; eapply2 nf_active. inversion H6; simpl; auto. 114 | left; eapply2 nf_active. inversion H6; simpl; auto. 115 | inversion H5; subst; try (right; eauto; fail). 116 | inversion H3; subst; inversion H7; subst; try (right; eauto; fail); try (left; auto; fail). 117 | Qed. 118 | 119 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Normal.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Normal.glob Fieska_calculus/Fieska_Normal.v.beautified: Fieska_calculus/Fieska_Normal.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo 2 | Fieska_calculus/Fieska_Normal.vio: Fieska_calculus/Fieska_Normal.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Normal.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Fieska_Normal.vo -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Tactics.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_Tactics.glob Fieska_calculus/Fieska_Tactics.v.beautified: Fieska_calculus/Fieska_Tactics.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo 2 | Fieska_calculus/Fieska_Tactics.vio: Fieska_calculus/Fieska_Tactics.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Tactics.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Fieska_Tactics.vo -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Terms.glob: -------------------------------------------------------------------------------- 1 | DIGEST 157bb71bf4e04b2c373dcbc2b5d9d221 2 | FIntensionalLib.Fieska_calculus.Fieska_Terms 3 | R1624:1628 Coq.Arith.Arith <> <> lib 4 | R1630:1634 Coq.omega.Omega <> <> lib 5 | R1636:1638 Coq.Arith.Max <> <> lib 6 | R1640:1643 Coq.Bool.Bool <> <> lib 7 | R1645:1648 Coq.Lists.List <> <> lib 8 | R1666:1700 IntensionalLib.Fieska_calculus.Test <> <> lib 9 | R1718:1755 IntensionalLib.Fieska_calculus.General <> <> lib 10 | ind 1817:1824 <> operator 11 | constr 1831:1833 <> Sop 12 | constr 1837:1839 <> Fop 13 | constr 1843:1845 <> Aop 14 | constr 1849:1851 <> Kop 15 | constr 1855:1857 <> Iop 16 | constr 1861:1863 <> Eop 17 | R1834:1834 IntensionalLib.Fieska_calculus.Fieska_Terms <> operator ind 18 | R1840:1840 IntensionalLib.Fieska_calculus.Fieska_Terms <> operator ind 19 | R1846:1846 IntensionalLib.Fieska_calculus.Fieska_Terms <> operator ind 20 | R1852:1852 IntensionalLib.Fieska_calculus.Fieska_Terms <> operator ind 21 | R1858:1858 IntensionalLib.Fieska_calculus.Fieska_Terms <> operator ind 22 | R1864:1864 IntensionalLib.Fieska_calculus.Fieska_Terms <> operator ind 23 | ind 1878:1883 <> Fieska 24 | constr 1898:1900 <> Ref 25 | constr 1923:1924 <> Op 26 | constr 1953:1955 <> App 27 | R1907:1910 Coq.Init.Logic <> :type_scope:x_'->'_x not 28 | R1911:1916 IntensionalLib.Fieska_calculus.Fieska_Terms <> Fieska ind 29 | R1904:1906 Coq.Init.Datatypes <> nat ind 30 | R1937:1940 Coq.Init.Logic <> :type_scope:x_'->'_x not 31 | R1941:1946 IntensionalLib.Fieska_calculus.Fieska_Terms <> Fieska ind 32 | R1929:1936 IntensionalLib.Fieska_calculus.Fieska_Terms <> operator ind 33 | R1965:1968 Coq.Init.Logic <> :type_scope:x_'->'_x not 34 | R1975:1978 Coq.Init.Logic <> :type_scope:x_'->'_x not 35 | R1979:1984 IntensionalLib.Fieska_calculus.Fieska_Terms <> Fieska ind 36 | R1969:1974 IntensionalLib.Fieska_calculus.Fieska_Terms <> Fieska ind 37 | R1959:1964 IntensionalLib.Fieska_calculus.Fieska_Terms <> Fieska ind 38 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Terms.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Fieska_Terms *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | Require Import Arith Omega Max Bool List. 27 | Require Import IntensionalLib.Fieska_calculus.Test. 28 | Require Import IntensionalLib.Fieska_calculus.General. 29 | 30 | 31 | (* Fieska-terms using de Bruijn's indices *) 32 | 33 | 34 | Inductive operator := | Sop | Fop | Aop | Kop | Iop | Eop . 35 | 36 | Inductive Fieska: Set := 37 | | Ref : nat -> Fieska 38 | | Op : operator -> Fieska 39 | | App : Fieska -> Fieska -> Fieska 40 | . 41 | 42 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Terms.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Terms.glob Fieska_calculus/Fieska_Terms.v.beautified: Fieska_calculus/Fieska_Terms.v Fieska_calculus/Test.vo Fieska_calculus/General.vo 2 | Fieska_calculus/Fieska_Terms.vio: Fieska_calculus/Fieska_Terms.v Fieska_calculus/Test.vio Fieska_calculus/General.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_Terms.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Fieska_Terms.vo -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_reduction.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_reduction.glob Fieska_calculus/Fieska_reduction.v.beautified: Fieska_calculus/Fieska_reduction.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo 2 | Fieska_calculus/Fieska_reduction.vio: Fieska_calculus/Fieska_reduction.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Fieska_reduction.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Fieska_reduction.vo -------------------------------------------------------------------------------- /Fieska_calculus/Fixpoints.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Fixpoints.vo Fieska_calculus/Fixpoints.glob Fieska_calculus/Fixpoints.v.beautified: Fieska_calculus/Fixpoints.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo Fieska_calculus/Star.vo 2 | Fieska_calculus/Fixpoints.vio: Fieska_calculus/Fixpoints.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio Fieska_calculus/Star.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Fixpoints.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Fixpoints.vo -------------------------------------------------------------------------------- /Fieska_calculus/General.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/General.vo Fieska_calculus/General.glob Fieska_calculus/General.v.beautified: Fieska_calculus/General.v Fieska_calculus/Test.vo 2 | Fieska_calculus/General.vio: Fieska_calculus/General.v Fieska_calculus/Test.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/General.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/General.vo -------------------------------------------------------------------------------- /Fieska_calculus/README.md: -------------------------------------------------------------------------------- 1 | # Fieska_calculus 2 | 3 | Fieska-calculus augments SF-calculus with operators 4 | 5 | 6 | K, I, A and E. 7 | 8 | K and I are from combinatory logic. The operator A is used to delay 9 | application of M to N, according to the rule 10 | 11 | AMNP = MNP 12 | 13 | E decides equality of combinations. 14 | 15 | See ../SF-calculus/deconstruction.pdf for details. -------------------------------------------------------------------------------- /Fieska_calculus/Star.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Star.vo Fieska_calculus/Star.glob Fieska_calculus/Star.v.beautified: Fieska_calculus/Star.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo Fieska_calculus/Substitution.vo Fieska_calculus/Fieska_Eval.vo 2 | Fieska_calculus/Star.vio: Fieska_calculus/Star.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio Fieska_calculus/Substitution.vio Fieska_calculus/Fieska_Eval.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Star.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Star.vo -------------------------------------------------------------------------------- /Fieska_calculus/Substitution.v.d: -------------------------------------------------------------------------------- 1 | Fieska_calculus/Substitution.vo Fieska_calculus/Substitution.glob Fieska_calculus/Substitution.v.beautified: Fieska_calculus/Substitution.v Fieska_calculus/Test.vo Fieska_calculus/General.vo Fieska_calculus/Fieska_Terms.vo Fieska_calculus/Fieska_Tactics.vo Fieska_calculus/Fieska_reduction.vo Fieska_calculus/Fieska_Normal.vo Fieska_calculus/Fieska_Closed.vo 2 | Fieska_calculus/Substitution.vio: Fieska_calculus/Substitution.v Fieska_calculus/Test.vio Fieska_calculus/General.vio Fieska_calculus/Fieska_Terms.vio Fieska_calculus/Fieska_Tactics.vio Fieska_calculus/Fieska_reduction.vio Fieska_calculus/Fieska_Normal.vio Fieska_calculus/Fieska_Closed.vio 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Substitution.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Substitution.vo -------------------------------------------------------------------------------- /Fieska_calculus/Test.glob: -------------------------------------------------------------------------------- 1 | DIGEST ecedd699fd7291cdb031329652c46afd 2 | FIntensionalLib.Fieska_calculus.Test 3 | R2247:2251 Coq.Arith.Arith <> <> lib 4 | def 2360:2363 <> test 5 | R2380:2382 Coq.Init.Datatypes <> nat ind 6 | R2385:2385 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 7 | R2392:2396 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 8 | R2402:2402 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 9 | R2387:2390 Coq.Init.Peano <> :nat_scope:x_'<='_x not 10 | R2386:2386 IntensionalLib.Fieska_calculus.Test <> n var 11 | R2391:2391 IntensionalLib.Fieska_calculus.Test <> m var 12 | R2398:2400 Coq.Init.Peano <> :nat_scope:x_'>'_x not 13 | R2397:2397 IntensionalLib.Fieska_calculus.Test <> n var 14 | R2401:2401 IntensionalLib.Fieska_calculus.Test <> m var 15 | def 2573:2577 <> le_lt 16 | R2594:2596 Coq.Init.Datatypes <> nat ind 17 | R2605:2608 Coq.Init.Logic <> :type_scope:x_'->'_x not 18 | R2609:2609 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 19 | R2615:2619 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 20 | R2625:2625 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 21 | R2611:2613 Coq.Init.Peano <> :nat_scope:x_'<'_x not 22 | R2610:2610 IntensionalLib.Fieska_calculus.Test <> n var 23 | R2614:2614 IntensionalLib.Fieska_calculus.Test <> m var 24 | R2621:2623 Coq.Init.Logic <> :type_scope:x_'='_x not 25 | R2620:2620 IntensionalLib.Fieska_calculus.Test <> n var 26 | R2624:2624 IntensionalLib.Fieska_calculus.Test <> m var 27 | R2600:2603 Coq.Init.Peano <> :nat_scope:x_'<='_x not 28 | R2599:2599 IntensionalLib.Fieska_calculus.Test <> n var 29 | R2604:2604 IntensionalLib.Fieska_calculus.Test <> m var 30 | def 2800:2806 <> compare 31 | R2823:2825 Coq.Init.Datatypes <> nat ind 32 | R2845:2848 Coq.Init.Specif <> :type_scope:x_'+'_'{'_x_'}' not 33 | R2854:2854 Coq.Init.Specif <> :type_scope:x_'+'_'{'_x_'}' not 34 | R2828:2828 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 35 | R2834:2838 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 36 | R2844:2844 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 37 | R2830:2832 Coq.Init.Peano <> :nat_scope:x_'<'_x not 38 | R2829:2829 IntensionalLib.Fieska_calculus.Test <> n var 39 | R2833:2833 IntensionalLib.Fieska_calculus.Test <> m var 40 | R2840:2842 Coq.Init.Logic <> :type_scope:x_'='_x not 41 | R2839:2839 IntensionalLib.Fieska_calculus.Test <> n var 42 | R2843:2843 IntensionalLib.Fieska_calculus.Test <> m var 43 | R2850:2852 Coq.Init.Peano <> :nat_scope:x_'>'_x not 44 | R2849:2849 IntensionalLib.Fieska_calculus.Test <> n var 45 | R2853:2853 IntensionalLib.Fieska_calculus.Test <> m var 46 | R2882:2885 IntensionalLib.Fieska_calculus.Test <> test def 47 | R2882:2885 IntensionalLib.Fieska_calculus.Test <> test def 48 | R2922:2926 IntensionalLib.Fieska_calculus.Test <> le_lt def 49 | R2922:2926 IntensionalLib.Fieska_calculus.Test <> le_lt def 50 | -------------------------------------------------------------------------------- /Fieska_calculus/Test.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | 16 | 17 | (* Contribution to the Coq Library V6.3 (July 1999) *) 18 | 19 | (****************************************************************************) 20 | (* The Calculus of Inductive Constructions *) 21 | (* *) 22 | (* Projet Coq *) 23 | (* *) 24 | (* INRIA ENS-CNRS *) 25 | (* Rocquencourt Lyon *) 26 | (* *) 27 | (* Coq V5.10 *) 28 | (* Nov 25th 1994 *) 29 | (* *) 30 | (****************************************************************************) 31 | (* Test.v *) 32 | (****************************************************************************) 33 | 34 | (* Arithmetic tests *) 35 | 36 | Require Import Arith . 37 | 38 | (* Pattern-matching lemmas for comparing 2 naturals 39 | Similar to lemmas in Compare_dec *) 40 | 41 | Definition test : forall n m : nat, {n <= m} + {n > m}. 42 | Proof. 43 | simple induction n; simple induction m; simpl in |- *; auto with arith. 44 | intros m' H'; elim (H m'); auto with arith. 45 | Defined. 46 | (* Transparent test. *) 47 | 48 | Definition le_lt : forall n m : nat, n <= m -> {n < m} + {n = m}. 49 | Proof. 50 | simple induction n; simple induction m; simpl in |- *; auto with arith. 51 | intros m' H1 H2; elim (H m'); auto with arith. 52 | Defined. 53 | (* Transparent le_lt. *) 54 | 55 | Definition compare : forall n m : nat, {n < m} + {n = m} + {n > m}. 56 | Proof. 57 | intros n m; elim (test n m); auto with arith. 58 | left; apply le_lt; trivial with arith. 59 | Defined. 60 | 61 | (* Transparent compare. *) 62 | 63 | 64 | -------------------------------------------------------------------------------- /Fieska_calculus/Test.v.d: -------------------------------------------------------------------------------- 1 | Test.vo Test.glob Test.v.beautified: Test.v 2 | Test.vio: Test.v 3 | -------------------------------------------------------------------------------- /Fieska_calculus/Test.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/Fieska_calculus/Test.vo -------------------------------------------------------------------------------- /Makefile.conf: -------------------------------------------------------------------------------- 1 | # This configuration file was generated by running: 2 | # coq_makefile -f _CoqProject -o Makefile 3 | 4 | 5 | ############################################################################### 6 | # # 7 | # Project files. # 8 | # # 9 | ############################################################################### 10 | 11 | COQMF_VFILES = Closure_calculus/Closure_calculus.v SF_calculus/Test.v SF_calculus/General.v SF_calculus/SF_Terms.v SF_calculus/SF_Tactics.v SF_calculus/SF_reduction.v SF_calculus/SF_Normal.v SF_calculus/SF_Closed.v SF_calculus/Substitution.v SF_calculus/SF_Eval.v SF_calculus/Star.v SF_calculus/Fixpoints.v SF_calculus/Extensions.v SF_calculus/Tagging.v SF_calculus/Adding.v SF_calculus/SF_size.v Closure_to_SF/Abstraction_to_Combination.v Closure_to_SF/Eta.v Closure_to_SF/identity_abs_val.v Fieska_calculus/Test.v Fieska_calculus/General.v Fieska_calculus/Fieska_Terms.v Fieska_calculus/Fieska_Tactics.v Fieska_calculus/Fieska_reduction.v Fieska_calculus/Fieska_Normal.v Fieska_calculus/Fieska_Closed.v Fieska_calculus/Substitution.v Fieska_calculus/Fieska_Eval.v Fieska_calculus/Star.v Fieska_calculus/Fixpoints.v Fieska_calculus/Extensions.v Fieska_calculus/Tagging.v Fieska_calculus/Adding.v Fieska_calculus/Fieska_size.v Closure_to_Fieska/Abstraction_to_Combination.v Closure_to_Fieska/Eta.v Closure_to_Fieska/identity_abs_val.v Closure_to_Fieska/Optimization.v 12 | COQMF_MLIFILES = 13 | COQMF_MLFILES = 14 | COQMF_ML4FILES = 15 | COQMF_MLPACKFILES = 16 | COQMF_MLLIBFILES = 17 | 18 | ############################################################################### 19 | # # 20 | # Path directives (-I, -R, -Q). # 21 | # # 22 | ############################################################################### 23 | 24 | COQMF_OCAMLLIBS = 25 | COQMF_SRC_SUBDIRS = 26 | COQMF_COQLIBS = -R . IntensionalLib 27 | COQMF_COQLIBS_NOML = -R . IntensionalLib 28 | 29 | ############################################################################### 30 | # # 31 | # Coq configuration. # 32 | # # 33 | ############################################################################### 34 | 35 | COQMF_LOCAL=0 36 | COQMF_COQLIB=/home/barry/.opam/4.05.0/lib/coq/ 37 | COQMF_DOCDIR=/home/barry/.opam/4.05.0/share/doc/coq/ 38 | COQMF_OCAMLFIND=/home/barry/.opam/4.05.0/bin/ocamlfind 39 | COQMF_CAMLP4=camlp5 40 | COQMF_CAMLP4O=/home/barry/.opam/4.05.0/bin/camlp5o 41 | COQMF_CAMLP4BIN=/home/barry/.opam/4.05.0/bin/ 42 | COQMF_CAMLP4LIB=/home/barry/.opam/4.05.0/lib/camlp5 43 | COQMF_CAMLP4OPTIONS=-loc loc 44 | COQMF_CAMLFLAGS=-thread -rectypes -w +a-4-9-27-41-42-44-45-48-50 -safe-string 45 | COQMF_HASNATDYNLINK=true 46 | COQMF_COQ_SRC_SUBDIRS=config dev lib kernel library engine pretyping interp parsing proofs tactics toplevel printing intf grammar ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/fourier plugins/funind plugins/ltac plugins/micromega plugins/nsatz plugins/omega plugins/quote plugins/romega plugins/rtauto plugins/setoid_ring plugins/ssr plugins/ssrmatching plugins/syntax plugins/xml 47 | COQMF_WINDRIVE=/home/barry/.opam/4.05.0/lib/coq 48 | 49 | ############################################################################### 50 | # # 51 | # Extra variables. # 52 | # # 53 | ############################################################################### 54 | 55 | COQMF_OTHERFLAGS = 56 | COQMF_INSTALLCOQDOCROOT = IntensionalLib 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Intensional-computation 2 | Translations of a lambda abstraction to combinations of operators, with proofs written in Coq. 3 | 4 | 5 | Closure_calculus contains the variant of lambda-calculus. 6 | SF-calculus contains SF calculus (see also the repository SF). 7 | Fieska-calculus augments SF-calculus with more operators. 8 | Closure_to_Fieska translates closure calculus to Fieska-calculus. 9 | Closure_to_SF translates closure calculus to SF-calculus. 10 | 11 | Tree_calculus introduces tree calculus. The main theorems are: 12 | 13 | - translation_preserves_sf_reduction 14 | - translation_preserves_abs_reduction 15 | - eager_is_definable 16 | 17 | 18 | _CoqProject and the make files and script are all out of date. 19 | -------------------------------------------------------------------------------- /SF_calculus/Equal.v.d: -------------------------------------------------------------------------------- 1 | Equal.vo Equal.glob Equal.v.beautified: Equal.v 2 | Equal.vio: Equal.v 3 | -------------------------------------------------------------------------------- /SF_calculus/Equal.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/Equal.vo -------------------------------------------------------------------------------- /SF_calculus/Extensions.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/Extensions.vo SF_calculus/Extensions.glob SF_calculus/Extensions.v.beautified: SF_calculus/Extensions.v SF_calculus/Test.vo SF_calculus/General.vo SF_calculus/SF_Terms.vo SF_calculus/SF_Tactics.vo SF_calculus/SF_reduction.vo SF_calculus/SF_Normal.vo SF_calculus/SF_Closed.vo SF_calculus/Substitution.vo SF_calculus/SF_Eval.vo SF_calculus/Star.vo SF_calculus/Fixpoints.vo SF_calculus/Equal.vo 2 | SF_calculus/Extensions.vio: SF_calculus/Extensions.v SF_calculus/Test.vio SF_calculus/General.vio SF_calculus/SF_Terms.vio SF_calculus/SF_Tactics.vio SF_calculus/SF_reduction.vio SF_calculus/SF_Normal.vio SF_calculus/SF_Closed.vio SF_calculus/Substitution.vio SF_calculus/SF_Eval.vio SF_calculus/Star.vio SF_calculus/Fixpoints.vio SF_calculus/Equal.vio 3 | -------------------------------------------------------------------------------- /SF_calculus/Extensions.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/Extensions.vo -------------------------------------------------------------------------------- /SF_calculus/Fixpoints.v.d: -------------------------------------------------------------------------------- 1 | Fixpoints.vo Fixpoints.glob Fixpoints.v.beautified: Fixpoints.v 2 | Fixpoints.vio: Fixpoints.v 3 | -------------------------------------------------------------------------------- /SF_calculus/Fixpoints.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/Fixpoints.vo -------------------------------------------------------------------------------- /SF_calculus/General.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* General.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | Require Import Omega ArithRing. 26 | 27 | (* some general-purpose tactics *) 28 | 29 | Ltac eapply2 H := eapply H; eauto. 30 | 31 | 32 | Ltac split_all := simpl; intros; auto. 33 | 34 | Ltac noway := intros; assert False by omega; contradiction. 35 | 36 | Ltac exist x := exists x; split_all. 37 | 38 | Ltac gen_case H W := 39 | generalize H; clear H; case W; split_all. 40 | 41 | Ltac gen2_case H0 H1 W := 42 | generalize H0 H1; clear H0 H1; case W; split_all. 43 | 44 | Ltac gen3_case H0 H1 H2 W := 45 | generalize H0 H1 H2; clear H0 H1 H2; case W; split_all. 46 | 47 | Ltac gen4_case H0 H1 H2 H3 W := 48 | generalize H0 H1 H2 H3; clear H0 H1 H2 H3; case W; split_all. 49 | 50 | Ltac gen_inv H W := 51 | generalize H; clear H; inversion W; split_all. 52 | 53 | Ltac gen2_inv H0 H1 W := 54 | generalize H0 H1; clear H0 H1; inversion W; split_all. 55 | 56 | Ltac gen3_inv H0 H1 H2 W := 57 | generalize H0 H1 H2; clear H0 H1 H2; inversion W; split_all. 58 | 59 | Ltac gen4_inv H0 H1 H2 H3 W := 60 | generalize H0 H1 H2 H3; clear H0 H1 H2 H3; inversion W; split_all. 61 | 62 | 63 | Ltac gen_case_inv H M := gen_case H M; inversion H; auto. 64 | 65 | Ltac invsub := match goal with | H : _ = _ |- _ => inversion H; subst; clear H; invsub | _ => split_all end. 66 | 67 | 68 | (* some arithmetic *) 69 | 70 | 71 | 72 | 73 | Lemma max_is_max : forall m n, max m n >= m /\ max m n >= n. 74 | Proof. 75 | double induction m n; split; auto; try omega. 76 | elim (H0 n); intros; auto; simpl; omega. 77 | elim (H0 n); intros; auto; simpl; omega. 78 | Qed. 79 | 80 | 81 | Lemma max_succ: forall m n, S (max m n) = max (S m) (S n). 82 | Proof. double induction m n; split_all. Qed. 83 | 84 | Lemma max_pred: forall m n, pred (max m n) = max (pred m) (pred n). 85 | Proof. double induction m n; intros; auto. case n; intros; auto. Qed. 86 | 87 | Lemma max_max : forall m n p, m >= max n p -> m>= n /\ m>= p. 88 | Proof. 89 | induction m; intros n p. 90 | case n; case p; simpl; intros; split; auto; subst; try noway; try omega. 91 | intros. 92 | assert(m >= pred (max n p)) by omega. 93 | rewrite max_pred in H0. 94 | elim (IHm (pred n) (pred p)); split_all; omega. 95 | Qed. 96 | 97 | Lemma max_max2 : forall m n k, k>= m -> k>= n -> k>= max m n. 98 | Proof. 99 | double induction m n; simpl; intros; auto. 100 | assert(pred k >= max n1 n) . eapply2 H0; omega. omega. 101 | Qed. 102 | 103 | Lemma max_zero : forall m, max m 0 = m. 104 | Proof. induction m; split_all. Qed. 105 | 106 | Lemma max_plus: forall m n k, max m n +k = max (m+k) (n+k). 107 | Proof. 108 | double induction m n; simpl; intros; auto. 109 | induction k; simpl; auto. 110 | assert(max k (S (n0+k)) >= S(n0+k)) by eapply2 max_is_max. 111 | assert(S(n0+k) >= max k (S(n0+k))) . eapply2 max_max2. 112 | omega. 113 | omega. 114 | case k; simpl; intros; auto. 115 | assert(max (n+S n1) n1 >= n+ S n1) by eapply2 max_is_max. 116 | assert(n+ S n1 >= max (n+S n1) n1) . eapply2 max_max2. 117 | omega. 118 | omega. 119 | Qed. 120 | 121 | Lemma max_minus: forall m n k, max m n -k = max (m-k) (n-k). 122 | Proof. 123 | double induction m n; split_all. 124 | case k; split_all. 125 | rewrite max_zero. omega. 126 | case k; split_all. 127 | Qed. 128 | 129 | Lemma max_monotonic : forall m1 m2 n1 n2, m1 >= n1 -> m2 >= n2 -> max m1 m2 >= max n1 n2. 130 | Proof. 131 | double induction m1 m2; split_all. 132 | assert (n1 = 0) by omega; subst. 133 | assert (n2 = 0) by omega; subst. 134 | split_all. 135 | assert (n1 = 0) by omega; subst. split_all. 136 | assert (n2 = 0) by omega; subst. 137 | assert(max n1 0 = n1) . case n1; split_all. 138 | rewrite H2; auto. 139 | assert(n0 >= pred n1) by omega. 140 | cut(max n0 n >= pred (max n1 n2)). 141 | intro. 142 | omega. 143 | rewrite max_pred. 144 | eapply2 H0. 145 | omega. 146 | Qed. 147 | 148 | Lemma max_succ_zero : forall k n, max k (S n) = 0 -> False . 149 | Proof. split_all. assert(max k (S n) >= S n) by eapply2 max_is_max. noway. Qed. 150 | Ltac max_out := 151 | match goal with 152 | | H : max _ (S _) = 0 |- _ => assert False by (eapply2 max_succ_zero); noway 153 | | H : max ?m ?n = 0 |- _ => 154 | assert (m = 0) by (assert (max m n >= m) by eapply2 max_is_max; omega); 155 | assert (n = 0) by (assert (max m n >= n) by eapply2 max_is_max; omega); 156 | clear H; try omega; try noway 157 | | H : max ?m ?n <= 0 |- _ => 158 | assert (m = 0) by (assert (max m n >= m) by eapply2 max_is_max; omega); 159 | assert (n = 0) by (assert (max m n >= n) by eapply2 max_is_max; omega); 160 | clear H; try omega; try noway 161 | end. 162 | 163 | Lemma max_choice: forall m n, max m n = m \/ max m n = n. 164 | Proof. 165 | induction m; split_all. case n; split_all. 166 | assert(max m n0 = m \/ max m n0 = n0) by eapply2 IHm. 167 | inversion H; rewrite H0; auto. 168 | Qed. 169 | 170 | -------------------------------------------------------------------------------- /SF_calculus/General.v.d: -------------------------------------------------------------------------------- 1 | General.vo General.glob General.v.beautified: General.v 2 | General.vio: General.v 3 | -------------------------------------------------------------------------------- /SF_calculus/General.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/General.vo -------------------------------------------------------------------------------- /SF_calculus/README.md: -------------------------------------------------------------------------------- 1 | # SF_calculus 2 | 3 | SF-calculus is here used to build some combinations to represent the various 4 | term forms of closure calculus. These will be used in the repository ../Closure_to_SF to perform a translation. A gentler approach uses ../Fieska-calculus to do the same thing. 5 | 6 | See deconstruction.pdf for details. -------------------------------------------------------------------------------- /SF_calculus/SF_Closed.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/SF_Closed.vo SF_calculus/SF_Closed.glob SF_calculus/SF_Closed.v.beautified: SF_calculus/SF_Closed.v SF_calculus/General.vo SF_calculus/SF_Terms.vo SF_calculus/SF_Tactics.vo SF_calculus/SF_reduction.vo SF_calculus/SF_Normal.vo 2 | SF_calculus/SF_Closed.vio: SF_calculus/SF_Closed.v SF_calculus/General.vio SF_calculus/SF_Terms.vio SF_calculus/SF_Tactics.vio SF_calculus/SF_reduction.vio SF_calculus/SF_Normal.vio 3 | -------------------------------------------------------------------------------- /SF_calculus/SF_Closed.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/SF_Closed.vo -------------------------------------------------------------------------------- /SF_calculus/SF_Eval.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | (**********************************************************************) 16 | 17 | (**********************************************************************) 18 | (* SF_Eval.v *) 19 | (* *) 20 | (* Barry Jay *) 21 | (* *) 22 | (**********************************************************************) 23 | 24 | Require Import Arith Max. 25 | Require Import IntensionalLib.SF_calculus.General. 26 | Require Import IntensionalLib.SF_calculus.SF_Terms. 27 | Require Import IntensionalLib.SF_calculus.SF_Tactics. 28 | Require Import IntensionalLib.SF_calculus.SF_reduction. 29 | Require Import IntensionalLib.SF_calculus.SF_Normal. 30 | Require Import IntensionalLib.SF_calculus.SF_Closed. 31 | Require Import IntensionalLib.SF_calculus.Substitution. 32 | 33 | 34 | Definition eval_app M N := 35 | match M with 36 | | App (App (Op Sop) M1) M2 => App (App M1 N) (App M2 N) 37 | | App (App (Op Fop) (Op _)) M2 => M2 38 | | x => App x N 39 | end. 40 | 41 | 42 | Lemma eval_app_from_SF : forall M N, sf_red (App M N) (eval_app M N). 43 | Proof. 44 | induction M; split_all. 45 | gen_case IHM1 M1. gen_case IHM1 s. gen_case IHM1 o. red; one_step. 46 | gen_case IHM1 s0. red; one_step. 47 | Qed. 48 | 49 | 50 | Fixpoint eval0 (M: SF) := 51 | match M with 52 | | Ref i => Ref i 53 | | Op o => Op o 54 | | App (Op Fop) M11 => App (Op Fop) (eval0 M11) 55 | | App M1 M11 => eval_app (eval0 M1) M11 56 | end. 57 | 58 | Lemma eval0_from_SF : forall M, sf_red M (eval0 M). 59 | Proof. 60 | induction M; split_all. 61 | eapply transitive_red. 62 | eapply preserves_app_sf_red. eapply2 IHM1. auto. 63 | eapply transitive_red. 64 | eapply2 eval_app_from_SF. 65 | case M1; split_all. 66 | case o; split_all. 67 | eapply preserves_app_sf_red. auto. eapply2 IHM2. 68 | Qed. 69 | 70 | 71 | Ltac eval_tac := unfold_op; 72 | match goal with 73 | | |- sf_red ?M _ => red; eval_tac 74 | | |- multi_step sf_red1 (App (App (Op Sop) _) _) (App (App (Op Sop) _) _) => 75 | apply preserves_app_sf_red; [ eapply2 preserves_app_sf_red |]; eval_tac 76 | | |- multi_step sf_red1 (App (Op Sop) _) (App (Op Sop) _) => 77 | eapply2 preserves_app_sf_red; eval_tac 78 | | |- multi_step sf_red1 (App (App (Op Fop) _) _) (App (App (Op Fop) _) _) => 79 | apply preserves_app_sf_red; [ eapply2 preserves_app_sf_red |]; eval_tac 80 | | |- multi_step sf_red1 (App (Op Fop) _) (App (Op Fop) _) => 81 | eapply2 preserves_app_sf_red; eval_tac 82 | | |- multi_step sf_red1 (App (App (App (Op Fop) (Op _)) _) _) _ => 83 | eapply succ_red ; [ eapply2 f_op_red | auto] 84 | | |- multi_step sf_red1 (App (App (App (App _ _) _) _) _) _ => 85 | eapply transitive_red; [eapply preserves_app_sf_red; [eval_tac|auto] |auto] 86 | | |- multi_step sf_red1 ?M _ => 87 | (apply transitive_red with (eval0 M); 88 | [eapply2 eval0_from_SF | 89 | unfold eval0, eval_app; unfold subst; split_all]) 90 | | _ => auto 91 | end. 92 | 93 | 94 | (* Boolean operations *) 95 | 96 | Definition not M := App (App M (App k_op i_op)) k_op. 97 | 98 | Lemma not_true : sf_red (not k_op) (App k_op i_op). 99 | Proof. unfold not; eval_tac. Qed. 100 | 101 | Lemma not_false : sf_red (not (App k_op i_op)) k_op. 102 | Proof. eval_tac. eval_tac. Qed. 103 | 104 | Definition iff M N := App (App M N) (not N). 105 | 106 | Lemma true_true : sf_red (iff k_op k_op) k_op. 107 | Proof. unfold iff; unfold not; eval_tac; split_all. Qed. 108 | Lemma true_false : sf_red (iff k_op (App k_op i_op)) (App k_op i_op). 109 | Proof. unfold iff; unfold not; eval_tac; split_all. Qed. 110 | Lemma false_true : sf_red (iff (App k_op i_op) k_op) (App k_op i_op). 111 | Proof. unfold iff; unfold not; eval_tac; eval_tac; eval_tac; eval_tac; split_all. Qed. 112 | Lemma false_false : sf_red (iff (App k_op i_op) (App k_op i_op)) k_op. 113 | Proof. 114 | unfold iff, not. unfold_op. repeat eval_tac. Qed. 115 | 116 | -------------------------------------------------------------------------------- /SF_calculus/SF_Eval.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/SF_Eval.vo SF_calculus/SF_Eval.glob SF_calculus/SF_Eval.v.beautified: SF_calculus/SF_Eval.v SF_calculus/General.vo SF_calculus/SF_Terms.vo SF_calculus/SF_Tactics.vo SF_calculus/SF_reduction.vo SF_calculus/SF_Normal.vo SF_calculus/SF_Closed.vo SF_calculus/Substitution.vo 2 | SF_calculus/SF_Eval.vio: SF_calculus/SF_Eval.v SF_calculus/General.vio SF_calculus/SF_Terms.vio SF_calculus/SF_Tactics.vio SF_calculus/SF_reduction.vio SF_calculus/SF_Normal.vio SF_calculus/SF_Closed.vio SF_calculus/Substitution.vio 3 | -------------------------------------------------------------------------------- /SF_calculus/SF_Eval.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/SF_Eval.vo -------------------------------------------------------------------------------- /SF_calculus/SF_Normal.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | 16 | (**********************************************************************) 17 | (* SF_Normal.v *) 18 | (* *) 19 | (* Barry Jay *) 20 | (* *) 21 | (**********************************************************************) 22 | 23 | Require Import Arith Omega Max. 24 | Require Import IntensionalLib.SF_calculus.SF_Terms. 25 | Require Import IntensionalLib.SF_calculus.General. 26 | Require Import IntensionalLib.SF_calculus.SF_Tactics. 27 | Require Import IntensionalLib.SF_calculus.SF_reduction. 28 | 29 | 30 | Inductive status_val := 31 | | Active : status_val 32 | | Passive : status_val 33 | . 34 | 35 | Fixpoint status M := 36 | match M with 37 | | Ref _ => Active 38 | | Op _ => Passive 39 | | App (App (App (Op Fop) M1) _ ) _ => status M1 40 | | App M1 _ => status M1 41 | end. 42 | 43 | (* normal terms *) 44 | 45 | Inductive normal : SF -> Prop := 46 | | nf_ref : forall n, normal (Ref n) 47 | | nf_op : forall o, normal (Op o) 48 | | nf_active : forall M1 M2, normal M1 -> normal M2 -> 49 | status (App M1 M2) = Active -> 50 | normal (App M1 M2) 51 | | nf_compound : forall M1 M2, normal M1 -> normal M2 -> 52 | compound (App M1 M2) -> normal (App M1 M2) 53 | . 54 | 55 | Hint Constructors normal. 56 | 57 | 58 | 59 | 60 | Definition irreducible M (red:termred) := forall N, red M N -> False. 61 | 62 | Lemma ref_irreducible : forall n, irreducible (Ref n) sf_seqred1. 63 | Proof. intro n. red. split_all. inversion H; auto. Qed. 64 | 65 | Lemma normal_is_irreducible: 66 | forall M, normal M -> irreducible M sf_seqred1. 67 | Proof. 68 | intros M nor; induction nor; split_all. 69 | (* 4 *) 70 | eapply2 ref_irreducible. 71 | (* 3 *) 72 | red; split_all. inversion H. 73 | (* 2 *) 74 | intro. intro. inversion H0; subst; simpl in *; try discriminate. 75 | (* 4 *) 76 | eapply2 IHnor1. 77 | (* 3 *) 78 | eapply2 IHnor2. 79 | (* 2 *) 80 | inv1 compound; subst; split_all; discriminate. 81 | (* 1 *) 82 | intro. intro. inversion H0; subst; simpl in *; try (inversion H; fail). 83 | eapply2 IHnor1. 84 | eapply2 IHnor2. 85 | Qed. 86 | 87 | 88 | Theorem SF_progress : forall (M : SF), normal M \/ (exists N, sf_seqred1 M N) . 89 | Proof. 90 | induction M; try (inversion IHM); subst; split_all; eauto. 91 | (* 1 *) 92 | inversion IHM1; split_all. 2: right; inversion H; exist (App x M2). 93 | inversion IHM2; split_all. 2:right; inversion H0; exist (App M1 x). 94 | gen_case H M1. case o; try (right; eauto; fail); left; auto. 95 | inversion H; subst. 96 | (* 2 *) 97 | left; auto. 98 | eapply2 nf_active. gen_case H5 s. gen_case H5 s1. discriminate. 99 | (* 1 *) 100 | gen2_case H3 H5 s. 101 | left; case o; auto. 102 | gen2_case H3 H5 s1. 103 | gen2_case H3 H5 o; try (right; eauto; fail). 104 | inversion H3; subst. inversion H8. 105 | inversion H7; subst. left; eapply2 nf_active. 106 | right; eauto. left; eapply2 nf_active. 107 | right; eauto. inversion H5. 108 | Qed. 109 | 110 | -------------------------------------------------------------------------------- /SF_calculus/SF_Normal.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/SF_Normal.vo SF_calculus/SF_Normal.glob SF_calculus/SF_Normal.v.beautified: SF_calculus/SF_Normal.v SF_calculus/SF_Terms.vo SF_calculus/General.vo SF_calculus/SF_Tactics.vo SF_calculus/SF_reduction.vo 2 | SF_calculus/SF_Normal.vio: SF_calculus/SF_Normal.v SF_calculus/SF_Terms.vio SF_calculus/General.vio SF_calculus/SF_Tactics.vio SF_calculus/SF_reduction.vio 3 | -------------------------------------------------------------------------------- /SF_calculus/SF_Normal.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/SF_Normal.vo -------------------------------------------------------------------------------- /SF_calculus/SF_Tactics.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/SF_Tactics.vo SF_calculus/SF_Tactics.glob SF_calculus/SF_Tactics.v.beautified: SF_calculus/SF_Tactics.v SF_calculus/Test.vo SF_calculus/General.vo SF_calculus/SF_Terms.vo 2 | SF_calculus/SF_Tactics.vio: SF_calculus/SF_Tactics.v SF_calculus/Test.vio SF_calculus/General.vio SF_calculus/SF_Terms.vio 3 | -------------------------------------------------------------------------------- /SF_calculus/SF_Tactics.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/SF_Tactics.vo -------------------------------------------------------------------------------- /SF_calculus/SF_Terms.glob: -------------------------------------------------------------------------------- 1 | DIGEST 3346926fce6e2e963f395d96fcd63257 2 | FIntensionalLib.SF_calculus.SF_Terms 3 | ind 1695:1702 <> operator 4 | constr 1709:1711 <> Sop 5 | constr 1715:1717 <> Fop 6 | R1712:1712 IntensionalLib.SF_calculus.SF_Terms <> operator ind 7 | R1718:1718 IntensionalLib.SF_calculus.SF_Terms <> operator ind 8 | ind 1910:1911 <> SF 9 | constr 1926:1928 <> Ref 10 | constr 1954:1955 <> Op 11 | constr 1982:1984 <> App 12 | R1935:1938 Coq.Init.Logic <> :type_scope:x_'->'_x not 13 | R1939:1940 IntensionalLib.SF_calculus.SF_Terms <> SF ind 14 | R1932:1934 Coq.Init.Datatypes <> nat ind 15 | R1968:1971 Coq.Init.Logic <> :type_scope:x_'->'_x not 16 | R1972:1973 IntensionalLib.SF_calculus.SF_Terms <> SF ind 17 | R1960:1967 IntensionalLib.SF_calculus.SF_Terms <> operator ind 18 | R1990:1993 Coq.Init.Logic <> :type_scope:x_'->'_x not 19 | R1996:1999 Coq.Init.Logic <> :type_scope:x_'->'_x not 20 | R2000:2001 IntensionalLib.SF_calculus.SF_Terms <> SF ind 21 | R1994:1995 IntensionalLib.SF_calculus.SF_Terms <> SF ind 22 | R1988:1989 IntensionalLib.SF_calculus.SF_Terms <> SF ind 23 | -------------------------------------------------------------------------------- /SF_calculus/SF_Terms.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* SF-Calculus *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | (** The operators S and F are enough, but more may be added in future. *) 27 | 28 | Inductive operator := | Sop | Fop . 29 | 30 | (** The terms of SF-calculus are either variables (given as de Bruijn indices), operators or applications. 31 | Terms are called combinations if they do not use any variables. *) 32 | 33 | Inductive SF: Set := 34 | | Ref : nat -> SF 35 | | Op : operator -> SF 36 | | App : SF -> SF -> SF 37 | . 38 | 39 | -------------------------------------------------------------------------------- /SF_calculus/SF_Terms.v.d: -------------------------------------------------------------------------------- 1 | SF_Terms.vo SF_Terms.glob SF_Terms.v.beautified: SF_Terms.v 2 | SF_Terms.vio: SF_Terms.v 3 | -------------------------------------------------------------------------------- /SF_calculus/SF_Terms.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/SF_Terms.vo -------------------------------------------------------------------------------- /SF_calculus/SF_reduction.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/SF_reduction.vo SF_calculus/SF_reduction.glob SF_calculus/SF_reduction.v.beautified: SF_calculus/SF_reduction.v SF_calculus/Test.vo SF_calculus/General.vo SF_calculus/SF_Terms.vo SF_calculus/SF_Tactics.vo 2 | SF_calculus/SF_reduction.vio: SF_calculus/SF_reduction.v SF_calculus/Test.vio SF_calculus/General.vio SF_calculus/SF_Terms.vio SF_calculus/SF_Tactics.vio 3 | -------------------------------------------------------------------------------- /SF_calculus/SF_reduction.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/SF_reduction.vo -------------------------------------------------------------------------------- /SF_calculus/Star.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/Star.vo SF_calculus/Star.glob SF_calculus/Star.v.beautified: SF_calculus/Star.v SF_calculus/Test.vo SF_calculus/General.vo SF_calculus/SF_Terms.vo SF_calculus/SF_Tactics.vo SF_calculus/SF_reduction.vo SF_calculus/SF_Normal.vo SF_calculus/SF_Closed.vo SF_calculus/Substitution.vo SF_calculus/SF_Eval.vo 2 | SF_calculus/Star.vio: SF_calculus/Star.v SF_calculus/Test.vio SF_calculus/General.vio SF_calculus/SF_Terms.vio SF_calculus/SF_Tactics.vio SF_calculus/SF_reduction.vio SF_calculus/SF_Normal.vio SF_calculus/SF_Closed.vio SF_calculus/Substitution.vio SF_calculus/SF_Eval.vio 3 | -------------------------------------------------------------------------------- /SF_calculus/Star.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/Star.vo -------------------------------------------------------------------------------- /SF_calculus/Substitution.v.d: -------------------------------------------------------------------------------- 1 | SF_calculus/Substitution.vo SF_calculus/Substitution.glob SF_calculus/Substitution.v.beautified: SF_calculus/Substitution.v SF_calculus/Test.vo SF_calculus/General.vo SF_calculus/SF_Terms.vo SF_calculus/SF_Tactics.vo SF_calculus/SF_reduction.vo SF_calculus/SF_Normal.vo SF_calculus/SF_Closed.vo 2 | SF_calculus/Substitution.vio: SF_calculus/Substitution.v SF_calculus/Test.vio SF_calculus/General.vio SF_calculus/SF_Terms.vio SF_calculus/SF_Tactics.vio SF_calculus/SF_reduction.vio SF_calculus/SF_Normal.vio SF_calculus/SF_Closed.vio 3 | -------------------------------------------------------------------------------- /SF_calculus/Substitution.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/Substitution.vo -------------------------------------------------------------------------------- /SF_calculus/Test.glob: -------------------------------------------------------------------------------- 1 | DIGEST ecedd699fd7291cdb031329652c46afd 2 | FIntensionalLib.SF_calculus.Test 3 | R2247:2251 Coq.Arith.Arith <> <> lib 4 | def 2360:2363 <> test 5 | R2380:2382 Coq.Init.Datatypes <> nat ind 6 | R2385:2385 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 7 | R2392:2396 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 8 | R2402:2402 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 9 | R2387:2390 Coq.Init.Peano <> :nat_scope:x_'<='_x not 10 | R2386:2386 IntensionalLib.SF_calculus.Test <> n var 11 | R2391:2391 IntensionalLib.SF_calculus.Test <> m var 12 | R2398:2400 Coq.Init.Peano <> :nat_scope:x_'>'_x not 13 | R2397:2397 IntensionalLib.SF_calculus.Test <> n var 14 | R2401:2401 IntensionalLib.SF_calculus.Test <> m var 15 | def 2573:2577 <> le_lt 16 | R2594:2596 Coq.Init.Datatypes <> nat ind 17 | R2605:2608 Coq.Init.Logic <> :type_scope:x_'->'_x not 18 | R2609:2609 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 19 | R2615:2619 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 20 | R2625:2625 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 21 | R2611:2613 Coq.Init.Peano <> :nat_scope:x_'<'_x not 22 | R2610:2610 IntensionalLib.SF_calculus.Test <> n var 23 | R2614:2614 IntensionalLib.SF_calculus.Test <> m var 24 | R2621:2623 Coq.Init.Logic <> :type_scope:x_'='_x not 25 | R2620:2620 IntensionalLib.SF_calculus.Test <> n var 26 | R2624:2624 IntensionalLib.SF_calculus.Test <> m var 27 | R2600:2603 Coq.Init.Peano <> :nat_scope:x_'<='_x not 28 | R2599:2599 IntensionalLib.SF_calculus.Test <> n var 29 | R2604:2604 IntensionalLib.SF_calculus.Test <> m var 30 | def 2800:2806 <> compare 31 | R2823:2825 Coq.Init.Datatypes <> nat ind 32 | R2845:2848 Coq.Init.Specif <> :type_scope:x_'+'_'{'_x_'}' not 33 | R2854:2854 Coq.Init.Specif <> :type_scope:x_'+'_'{'_x_'}' not 34 | R2828:2828 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 35 | R2834:2838 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 36 | R2844:2844 Coq.Init.Specif <> :type_scope:'{'_x_'}'_'+'_'{'_x_'}' not 37 | R2830:2832 Coq.Init.Peano <> :nat_scope:x_'<'_x not 38 | R2829:2829 IntensionalLib.SF_calculus.Test <> n var 39 | R2833:2833 IntensionalLib.SF_calculus.Test <> m var 40 | R2840:2842 Coq.Init.Logic <> :type_scope:x_'='_x not 41 | R2839:2839 IntensionalLib.SF_calculus.Test <> n var 42 | R2843:2843 IntensionalLib.SF_calculus.Test <> m var 43 | R2850:2852 Coq.Init.Peano <> :nat_scope:x_'>'_x not 44 | R2849:2849 IntensionalLib.SF_calculus.Test <> n var 45 | R2853:2853 IntensionalLib.SF_calculus.Test <> m var 46 | R2882:2885 IntensionalLib.SF_calculus.Test <> test def 47 | R2882:2885 IntensionalLib.SF_calculus.Test <> test def 48 | R2922:2926 IntensionalLib.SF_calculus.Test <> le_lt def 49 | R2922:2926 IntensionalLib.SF_calculus.Test <> le_lt def 50 | -------------------------------------------------------------------------------- /SF_calculus/Test.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | 16 | 17 | (* Contribution to the Coq Library V6.3 (July 1999) *) 18 | 19 | (****************************************************************************) 20 | (* The Calculus of Inductive Constructions *) 21 | (* *) 22 | (* Projet Coq *) 23 | (* *) 24 | (* INRIA ENS-CNRS *) 25 | (* Rocquencourt Lyon *) 26 | (* *) 27 | (* Coq V5.10 *) 28 | (* Nov 25th 1994 *) 29 | (* *) 30 | (****************************************************************************) 31 | (* Test.v *) 32 | (****************************************************************************) 33 | 34 | (* Arithmetic tests *) 35 | 36 | Require Import Arith . 37 | 38 | (* Pattern-matching lemmas for comparing 2 naturals 39 | Similar to lemmas in Compare_dec *) 40 | 41 | Definition test : forall n m : nat, {n <= m} + {n > m}. 42 | Proof. 43 | simple induction n; simple induction m; simpl in |- *; auto with arith. 44 | intros m' H'; elim (H m'); auto with arith. 45 | Defined. 46 | (* Transparent test. *) 47 | 48 | Definition le_lt : forall n m : nat, n <= m -> {n < m} + {n = m}. 49 | Proof. 50 | simple induction n; simple induction m; simpl in |- *; auto with arith. 51 | intros m' H1 H2; elim (H m'); auto with arith. 52 | Defined. 53 | (* Transparent le_lt. *) 54 | 55 | Definition compare : forall n m : nat, {n < m} + {n = m} + {n > m}. 56 | Proof. 57 | intros n m; elim (test n m); auto with arith. 58 | left; apply le_lt; trivial with arith. 59 | Defined. 60 | 61 | (* Transparent compare. *) 62 | 63 | 64 | -------------------------------------------------------------------------------- /SF_calculus/Test.v.d: -------------------------------------------------------------------------------- 1 | Test.vo Test.glob Test.v.beautified: Test.v 2 | Test.vio: Test.v 3 | -------------------------------------------------------------------------------- /SF_calculus/Test.vo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/SF_calculus/Test.vo -------------------------------------------------------------------------------- /SF_calculus/makefile.conf: -------------------------------------------------------------------------------- 1 | # This configuration file was generated by running: 2 | # coq_makefile -o makefile Adding.v Equal.v Extensions.v Fixpoints.v General.v SF_Closed.v SF_Eval.v SF_Normal.v SF_Tactics.v SF_Terms.v SF_reduction.v SF_size.v Star.v Substitution.v Tagging.v Test.v 3 | 4 | 5 | ############################################################################### 6 | # # 7 | # Project files. # 8 | # # 9 | ############################################################################### 10 | 11 | COQMF_VFILES = Adding.v Equal.v Extensions.v Fixpoints.v General.v SF_Closed.v SF_Eval.v SF_Normal.v SF_Tactics.v SF_Terms.v SF_reduction.v SF_size.v Star.v Substitution.v Tagging.v Test.v 12 | COQMF_MLIFILES = 13 | COQMF_MLFILES = 14 | COQMF_ML4FILES = 15 | COQMF_MLPACKFILES = 16 | COQMF_MLLIBFILES = 17 | 18 | ############################################################################### 19 | # # 20 | # Path directives (-I, -R, -Q). # 21 | # # 22 | ############################################################################### 23 | 24 | COQMF_OCAMLLIBS = -I . 25 | COQMF_SRC_SUBDIRS = . 26 | COQMF_COQLIBS = -I . -R . Top 27 | COQMF_COQLIBS_NOML = -R . Top 28 | 29 | ############################################################################### 30 | # # 31 | # Coq configuration. # 32 | # # 33 | ############################################################################### 34 | 35 | COQMF_LOCAL=0 36 | COQMF_COQLIB=/home/barry/.opam/4.05.0/lib/coq/ 37 | COQMF_DOCDIR=/home/barry/.opam/4.05.0/share/doc/coq/ 38 | COQMF_OCAMLFIND=/home/barry/.opam/4.05.0/bin/ocamlfind 39 | COQMF_CAMLP4=camlp5 40 | COQMF_CAMLP4O=/home/barry/.opam/4.05.0/bin/camlp5o 41 | COQMF_CAMLP4BIN=/home/barry/.opam/4.05.0/bin/ 42 | COQMF_CAMLP4LIB=/home/barry/.opam/4.05.0/lib/camlp5 43 | COQMF_CAMLP4OPTIONS=-loc loc 44 | COQMF_CAMLFLAGS=-thread -rectypes -w +a-4-9-27-41-42-44-45-48-50 -safe-string 45 | COQMF_HASNATDYNLINK=true 46 | COQMF_COQ_SRC_SUBDIRS=config dev lib kernel library engine pretyping interp parsing proofs tactics toplevel printing intf grammar ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/fourier plugins/funind plugins/ltac plugins/micromega plugins/nsatz plugins/omega plugins/quote plugins/romega plugins/rtauto plugins/setoid_ring plugins/ssr plugins/ssrmatching plugins/syntax plugins/xml 47 | COQMF_WINDRIVE=/home/barry/.opam/4.05.0/lib/coq 48 | 49 | ############################################################################### 50 | # # 51 | # Extra variables. # 52 | # # 53 | ############################################################################### 54 | 55 | COQMF_OTHERFLAGS = 56 | COQMF_INSTALLCOQDOCROOT = Top 57 | -------------------------------------------------------------------------------- /Tree_calculus/Abstraction4.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This Program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 021101301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Abstraction_to_Tree.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | Require Import Omega Max Bool List. 27 | Require Import IntensionalLib.SF_calculus.Test. 28 | Require Import IntensionalLib.SF_calculus.General. 29 | Require Import IntensionalLib.Tree_calculus.Abstraction_Terms. 30 | Require Import IntensionalLib.Tree_calculus.Abstraction_Reduction. 31 | Require Import IntensionalLib.Tree_calculus.Tree_Terms. 32 | Require Import IntensionalLib.Tree_calculus.Tree_Tactics. 33 | Require Import IntensionalLib.Tree_calculus.Tree_reduction. 34 | Require Import IntensionalLib.Tree_calculus.Tree_Normal. 35 | Require Import IntensionalLib.Tree_calculus.Tree_Closed. 36 | Require Import IntensionalLib.Tree_calculus.Substitution. 37 | Require Import IntensionalLib.Tree_calculus.Tree_Eval. 38 | Require Import IntensionalLib.Tree_calculus.Star. 39 | Require Import IntensionalLib.Tree_calculus.Wait. 40 | Require Import IntensionalLib.Tree_calculus.Fixpoints. 41 | Require Import IntensionalLib.Tree_calculus.Wave_Factor. 42 | Require Import IntensionalLib.Tree_calculus.Wave_Factor2. 43 | Require Import IntensionalLib.Tree_calculus.Equal. 44 | Require Import IntensionalLib.Tree_calculus.Case. 45 | Require Import IntensionalLib.Tree_calculus.Extensions. 46 | Require Import IntensionalLib.Tree_calculus.Wait2. 47 | Require Import IntensionalLib.Tree_calculus.Abstraction. 48 | Require Import IntensionalLib.Tree_calculus.Abstraction2. 49 | Require Import IntensionalLib.Tree_calculus.Abstraction3. 50 | 51 | 52 | Lemma b_r_op_red: forall M N, sf_red (App (App (App b_op M) N) r_op) r_op. 53 | Proof. 54 | intros; unfold b_op. 55 | eapply transitive_red. 56 | eapply preserves_app_sf_red. 57 | eapply preserves_app_sf_red. 58 | eapply2 app_comb_red. all: auto. 59 | eapply transitive_red. 60 | eapply2 Y2_fix. 61 | unfold b_fn at 1. 62 | eapply transitive_red. 63 | eapply preserves_app_sf_red. 64 | eapply2 star_opt_beta3. auto. 65 | unfold subst. 66 | rewrite ! subst_rec_preserves_extension. 67 | (* 1 *) 68 | eapply transitive_red. 69 | eapply2 extensions_by_matchfail. 70 | eapply2 matchfail_app_comb_l. 71 | eapply2 matchfail_app_comb_l. 72 | eapply2 matchfail_app_comb_r. 73 | eapply2 matchfail_program. 74 | eapply2 h_fn_program. 75 | split. eapply2 omega_k_normal. eapply2 omega_k_closed. 76 | eapply2 h_fn_not_omega. 77 | (* 1 *) 78 | eapply transitive_red. 79 | eapply2 extensions_by_matchfail. 80 | eapply2 matchfail_app_comb_l. 81 | eapply2 matchfail_app_comb_l. 82 | eapply2 matchfail_app_comb_l. 83 | eapply matchfail_program. 84 | split. apply app_comb_normal. 85 | apply omega_k_normal. 86 | apply omega_k_normal. 87 | rewrite maxvar_app_comb. rewrite ! omega_k_closed. auto. 88 | split. apply A_k_normal. apply A_k_closed. 89 | discriminate. 90 | (* 1 *) 91 | eapply transitive_red. 92 | eapply2 extensions_by_matchfail. 93 | unfold r_op, Y_k. 94 | eapply2 matchfail_app_comb_l. 95 | eapply2 matchfail_app_comb_l. 96 | eapply2 matchfail_app_comb_l. 97 | eapply2 program_matching. 98 | split. eapply2 omega_k_normal. eapply2 omega_k_closed. 99 | eapply2 matchfail_program. 100 | split. eapply2 omega_k_normal. eapply2 omega_k_closed. 101 | split. eapply2 A_k_normal. eapply2 A_k_closed. 102 | discriminate. 103 | (* 1 *) 104 | eapply transitive_red. 105 | eapply2 extensions_by_matchfail. 106 | unfold r_op, Y_k. 107 | eapply2 matchfail_app_comb_l. 108 | eapply2 matchfail_app_comb_r. 109 | eapply2 matchfail_program. 110 | split. eapply2 omega_k_normal. eapply2 omega_k_closed. 111 | split. eapply2 omega_k_normal. eapply2 omega_k_closed. 112 | replace 1 with (S (0+0)) by omega. 113 | apply omega_k_mono. 114 | (* 1 *) 115 | eapply transitive_red. 116 | eapply2 extensions_by_matchfail. 117 | unfold r_op, Y_k. 118 | eapply2 matchfail_app_comb_r. 119 | eapply2 matchfail_app_comb_l. 120 | eapply2 matchfail_compound_l. 121 | simpl. 122 | unfold_op; eapply2 matchfail_compound_r. 123 | (* 1 *) 124 | eapply transitive_red. 125 | eapply2 extensions_by_matchfail. 126 | unfold r_op, ab1. 127 | eapply2 matchfail_compound_l. 128 | eapply2 matchfail_compound_r. 129 | eapply2 matchfail_compound_r. 130 | eapply2 matchfail_compound_l. 131 | unfold_op. 132 | eapply2 matchfail_compound_r. 133 | (* 1 *) 134 | eapply transitive_red. 135 | eapply2 extensions_by_matchfail. 136 | unfold r_op. 137 | eapply2 matchfail_app_comb_r. 138 | eapply2 matchfail_app_comb_l. 139 | unfold compose, star_opt, occurs, eqnat. 140 | unfold_op. 141 | eapply2 matchfail_compound_l. 142 | eapply2 matchfail_compound_r. 143 | eapply2 matchfail_compound_r. 144 | simpl. 145 | eapply2 matchfail_compound_l. 146 | (* 1 *) 147 | unfold_op; simpl. repeat eval_tac. 148 | Qed. 149 | 150 | -------------------------------------------------------------------------------- /Tree_calculus/Abstraction_Reduction.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Abstraction_Reduction.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | (* 26 | Add LoadPath ".." as IntensionalLib. 27 | *) 28 | Require Import Arith. 29 | Require Import IntensionalLib.SF_calculus.General. 30 | Require Import IntensionalLib.Tree_calculus.Abstraction_Terms. 31 | Require Import IntensionalLib.Tree_calculus.Abstraction_Tactics. 32 | 33 | 34 | Ltac split_all := simpl; intros; 35 | match goal with 36 | | H : _ /\ _ |- _ => inversion_clear H; split_all 37 | | H : exists _, _ |- _ => inversion H; clear H; split_all 38 | | _ => try (split; split_all); try contradiction 39 | end; try congruence; auto. 40 | 41 | 42 | 43 | 44 | (* true compounds *) 45 | 46 | Fixpoint right_component (M : Abs_Term) := 47 | match M with 48 | | App _ M2 => M2 49 | | _ => M 50 | end. 51 | 52 | Definition left_component (U : Abs_Term) := 53 | match U with 54 | | App U1 _ => U1 55 | | _ => Op Iop 56 | end. 57 | 58 | 59 | Inductive true_compound : Abs_Term -> Prop := 60 | | h_compound : forall M, true_compound (App (Op Hop) M) 61 | | a_compound : forall M, true_compound (App (Op Aop) M) 62 | | b_compound : forall M, true_compound (App (Op Bop) M) 63 | . 64 | 65 | 66 | (* Abstraction-reduction *) 67 | 68 | 69 | Inductive abs_red1 : termred := 70 | | app_abs_red : 71 | forall M M' , 72 | abs_red1 M M' -> 73 | forall N N' : Abs_Term, abs_red1 N N' -> abs_red1 (App M N) (App M' N') 74 | | j_red: forall M, abs_red1 (App (Op Jop) M) (App (App (Op Hop) (Op Jop)) M) 75 | | r_red : forall M N, abs_red1 (App (App (Op Rop) M) N) (App (App (Op Hop) (App (Op Rop) M)) N) 76 | | h_red : forall M N P, abs_red1 (App (App (App (Op Hop) M) N) P) 77 | (App (App (Op Hop) (App (App (Op Hop) M) N)) P) 78 | | a_red : forall M N P, abs_red1 (App (App (App (Op Aop) M) N) P) (App (App (App (Op Bop) P) M) N) 79 | | i_red : forall M, abs_red1 (App (Op Iop) M) M 80 | | b_j_red : forall M N, abs_red1 (App (App (App (Op Bop) M) N) (Op Jop)) M 81 | | b_r_red : forall M N P, abs_red1 (App (App (App (Op Bop) M) N) (App (Op Rop) P)) (App N P) 82 | | b_h_red : forall M N P Q, abs_red1 (App (App (App (Op Bop) M) N) (App (App (Op Hop) P) Q)) 83 | (App (App (App (App (Op Bop) M) N) P) (App (App (App (Op Bop) M) N) Q)) 84 | | b_a_red : forall M N P Q, abs_red1 (App (App (App (Op Bop) M) N) (App (App (Op Aop) P) Q)) 85 | (App (App (Op Aop) (App (App (App (Op Bop) M) N) P)) Q) 86 | | b_i_red : forall M N, abs_red1 (App (App (App (Op Bop) M) N) (Op Iop)) (Op Iop) 87 | | b_b_red : forall M N P Q, abs_red1 (App (App (App (Op Bop) M) N) (App (App (Op Bop) P) Q)) 88 | (App (App (Op Bop) (App (App (App (Op Bop) M) N) P)) 89 | (App (App (App (Op Bop) M) N) Q)) 90 | | b_op_red : forall M N o, o<> Jop -> abs_red1 (App (App (App (Op Bop) M) N) (Op o)) (Op o) 91 | | b_compound_red: forall M N P Q, true_compound (App P Q) -> 92 | abs_red1 (App (App (App (Op Bop) M) N) (App P Q)) 93 | (App (App (App (App (Op Bop) M) N) P) (App (App (App (Op Bop) M) N) Q)) 94 | . 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /Tree_calculus/Abstraction_Terms.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Abstraction_Terms.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | 27 | Inductive operator := 28 | (* extensional operators *) 29 | | Jop 30 | | Rop 31 | | Hop 32 | (* intensional operators, for interpreting closure calculus *) 33 | | Aop (* equality of programs, e.g. vars *) 34 | | Iop 35 | | Bop 36 | . 37 | 38 | Inductive Abs_Term: Set := 39 | | Op : operator -> Abs_Term 40 | | App : Abs_Term -> Abs_Term -> Abs_Term 41 | . 42 | 43 | -------------------------------------------------------------------------------- /Tree_calculus/Abstraction_to_Tree.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This Program is free sofut even the implied warranty of *) 3 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 4 | (* GNU General Public License for more details. *) 5 | (* *) 6 | (* You should have received a copy of the GNU Lesser General Public *) 7 | (* License along with this program; if not, write to the Free *) 8 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 9 | (* 021101301 USA *) 10 | (**********************************************************************) 11 | 12 | (**********************************************************************) 13 | (* Abstraction_to_Tree.v *) 14 | (* *) 15 | (* Barry Jay *) 16 | (* *) 17 | (**********************************************************************) 18 | 19 | 20 | Require Import Omega Max Bool List. 21 | Require Import IntensionalLib.SF_calculus.Test. 22 | Require Import IntensionalLib.SF_calculus.General. 23 | Require Import IntensionalLib.Tree_calculus.Abstraction_Terms. 24 | Require Import IntensionalLib.Tree_calculus.Abstraction_Reduction. 25 | Require Import IntensionalLib.Tree_calculus.Tree_Terms. 26 | Require Import IntensionalLib.Tree_calculus.Tree_Tactics. 27 | Require Import IntensionalLib.Tree_calculus.Tree_reduction. 28 | Require Import IntensionalLib.Tree_calculus.Tree_Normal. 29 | Require Import IntensionalLib.Tree_calculus.Tree_Closed. 30 | Require Import IntensionalLib.Tree_calculus.Substitution. 31 | Require Import IntensionalLib.Tree_calculus.Tree_Eval. 32 | Require Import IntensionalLib.Tree_calculus.Star. 33 | Require Import IntensionalLib.Tree_calculus.Wait. 34 | Require Import IntensionalLib.Tree_calculus.Fixpoints. 35 | Require Import IntensionalLib.Tree_calculus.Wave_Factor. 36 | Require Import IntensionalLib.Tree_calculus.Wave_Factor2. 37 | Require Import IntensionalLib.Tree_calculus.Equal. 38 | Require Import IntensionalLib.Tree_calculus.Case. 39 | Require Import IntensionalLib.Tree_calculus.Extensions. 40 | Require Import IntensionalLib.Tree_calculus.Wait2. 41 | Require Import IntensionalLib.Tree_calculus.Abstraction. 42 | Require Import IntensionalLib.Tree_calculus.Abstraction2. 43 | Require Import IntensionalLib.Tree_calculus.Abstraction3. 44 | Require Import IntensionalLib.Tree_calculus.Abstraction4. 45 | Require Import IntensionalLib.Tree_calculus.Abstraction5. 46 | 47 | 48 | 49 | Definition op_to_tree o := 50 | match o with 51 | | Jop => j_op 52 | | Rop => r_op 53 | | Hop => h_op 54 | | Aop => abs_op 55 | | Iop => i_op 56 | | Bop => b_op 57 | end. 58 | 59 | 60 | Fixpoint abs_to_tree M := 61 | match M with 62 | | Abstraction_Terms.Op o => op_to_tree o 63 | | Abstraction_Terms.App M1 M2 => App (abs_to_tree M1) (abs_to_tree M2) 64 | end. 65 | 66 | Theorem translation_preserves_abs_reduction: 67 | forall M N, abs_red1 M N -> sf_red (abs_to_tree M) (abs_to_tree N). 68 | Proof. 69 | intros M N r; induction r; intros; 70 | unfold abs_to_tree; fold abs_to_tree; unfold op_to_tree. 71 | (* 14 *) 72 | auto. 73 | eapply2 j_red. 74 | eapply2 r_red. 75 | eapply2 h_red. 76 | eapply2 abs_red. 77 | unfold_op. repeat eval_tac. 78 | eapply2 b_j_red. 79 | eapply2 b_r_red. 80 | eapply2 b_h_red. 81 | eapply2 b_a_red. 82 | eapply2 b_i_red. 83 | eapply2 b_b_red. 84 | (* 2 *) 85 | generalize H; case o; intro. 86 | congruence. 87 | eapply2 b_r_op_red. 88 | eapply2 b_h_op_red. 89 | eapply2 b_abs_op_red. 90 | eapply2 b_i_op_red. 91 | eapply2 b_b_op_red. 92 | (* 1 *) 93 | inversion H; subst; unfold abs_to_tree; fold abs_to_tree; 94 | unfold op_to_tree; subst. 95 | eapply2 b_h1_red. 96 | eapply2 b_a1_red. 97 | eapply2 b_b1_red. 98 | Qed. 99 | 100 | -------------------------------------------------------------------------------- /Tree_calculus/General.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* General.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | Require Import Omega ArithRing. 26 | 27 | (* some general-purpose tactics *) 28 | 29 | Ltac eapply2 H := eapply H; eauto. 30 | 31 | 32 | Ltac split_all := simpl; intros; auto. 33 | 34 | Ltac noway := intros; assert False by omega; contradiction. 35 | 36 | Ltac exist x := exists x; split_all. 37 | 38 | Ltac gen_case H W := 39 | generalize H; clear H; case W; split_all. 40 | 41 | Ltac gen2_case H0 H1 W := 42 | generalize H0 H1; clear H0 H1; case W; split_all. 43 | 44 | Ltac gen3_case H0 H1 H2 W := 45 | generalize H0 H1 H2; clear H0 H1 H2; case W; split_all. 46 | 47 | Ltac gen4_case H0 H1 H2 H3 W := 48 | generalize H0 H1 H2 H3; clear H0 H1 H2 H3; case W; split_all. 49 | 50 | Ltac gen_inv H W := 51 | generalize H; clear H; inversion W; split_all. 52 | 53 | Ltac gen2_inv H0 H1 W := 54 | generalize H0 H1; clear H0 H1; inversion W; split_all. 55 | 56 | Ltac gen3_inv H0 H1 H2 W := 57 | generalize H0 H1 H2; clear H0 H1 H2; inversion W; split_all. 58 | 59 | Ltac gen4_inv H0 H1 H2 H3 W := 60 | generalize H0 H1 H2 H3; clear H0 H1 H2 H3; inversion W; split_all. 61 | 62 | 63 | Ltac gen_case_inv H M := gen_case H M; inversion H; auto. 64 | 65 | Ltac invsub := match goal with | H : _ = _ |- _ => inversion H; subst; clear H; invsub | _ => split_all end. 66 | 67 | 68 | (* some arithmetic *) 69 | 70 | 71 | 72 | 73 | Lemma max_is_max : forall m n, max m n >= m /\ max m n >= n. 74 | Proof. 75 | double induction m n; split; auto; try omega. 76 | elim (H0 n); intros; auto; simpl; omega. 77 | elim (H0 n); intros; auto; simpl; omega. 78 | Qed. 79 | 80 | 81 | Lemma max_succ: forall m n, S (max m n) = max (S m) (S n). 82 | Proof. double induction m n; split_all. Qed. 83 | 84 | Lemma max_pred: forall m n, pred (max m n) = max (pred m) (pred n). 85 | Proof. double induction m n; intros; auto. case n; intros; auto. Qed. 86 | 87 | Lemma max_max : forall m n p, m >= max n p -> m>= n /\ m>= p. 88 | Proof. 89 | induction m; intros n p. 90 | case n; case p; simpl; intros; split; auto; subst; try noway; try omega. 91 | intros. 92 | assert(m >= pred (max n p)) by omega. 93 | rewrite max_pred in H0. 94 | elim (IHm (pred n) (pred p)); split_all; omega. 95 | Qed. 96 | 97 | Lemma max_max2 : forall m n k, k>= m -> k>= n -> k>= max m n. 98 | Proof. 99 | double induction m n; simpl; intros; auto. 100 | assert(pred k >= max n1 n) . eapply2 H0; omega. omega. 101 | Qed. 102 | 103 | Lemma max_zero : forall m, max m 0 = m. 104 | Proof. induction m; split_all. Qed. 105 | 106 | Lemma max_plus: forall m n k, max m n +k = max (m+k) (n+k). 107 | Proof. 108 | double induction m n; simpl; intros; auto. 109 | induction k; simpl; auto. 110 | assert(max k (S (n0+k)) >= S(n0+k)) by eapply2 max_is_max. 111 | assert(S(n0+k) >= max k (S(n0+k))) . eapply2 max_max2. 112 | omega. 113 | omega. 114 | case k; simpl; intros; auto. 115 | assert(max (n+S n1) n1 >= n+ S n1) by eapply2 max_is_max. 116 | assert(n+ S n1 >= max (n+S n1) n1) . eapply2 max_max2. 117 | omega. 118 | omega. 119 | Qed. 120 | 121 | Lemma max_minus: forall m n k, max m n -k = max (m-k) (n-k). 122 | Proof. 123 | double induction m n; split_all. 124 | case k; split_all. 125 | rewrite max_zero. omega. 126 | case k; split_all. 127 | Qed. 128 | 129 | Lemma max_monotonic : forall m1 m2 n1 n2, m1 >= n1 -> m2 >= n2 -> max m1 m2 >= max n1 n2. 130 | Proof. 131 | double induction m1 m2; split_all. 132 | assert (n1 = 0) by omega; subst. 133 | assert (n2 = 0) by omega; subst. 134 | split_all. 135 | assert (n1 = 0) by omega; subst. split_all. 136 | assert (n2 = 0) by omega; subst. 137 | assert(max n1 0 = n1) . case n1; split_all. 138 | rewrite H2; auto. 139 | assert(n0 >= pred n1) by omega. 140 | cut(max n0 n >= pred (max n1 n2)). 141 | intro. 142 | omega. 143 | rewrite max_pred. 144 | eapply2 H0. 145 | omega. 146 | Qed. 147 | 148 | Lemma max_succ_zero : forall k n, max k (S n) = 0 -> False . 149 | Proof. split_all. assert(max k (S n) >= S n) by eapply2 max_is_max. noway. Qed. 150 | Ltac max_out := 151 | match goal with 152 | | H : max _ (S _) = 0 |- _ => assert False by (eapply2 max_succ_zero); noway 153 | | H : max ?m ?n = 0 |- _ => 154 | assert (m = 0) by (assert (max m n >= m) by eapply2 max_is_max; omega); 155 | assert (n = 0) by (assert (max m n >= n) by eapply2 max_is_max; omega); 156 | clear H; try omega; try noway 157 | | H : max ?m ?n <= 0 |- _ => 158 | assert (m = 0) by (assert (max m n >= m) by eapply2 max_is_max; omega); 159 | assert (n = 0) by (assert (max m n >= n) by eapply2 max_is_max; omega); 160 | clear H; try omega; try noway 161 | end. 162 | 163 | Lemma max_choice: forall m n, max m n = m \/ max m n = n. 164 | Proof. 165 | induction m; split_all. case n; split_all. 166 | assert(max m n0 = m \/ max m n0 = n0) by eapply2 IHm. 167 | inversion H; rewrite H0; auto. 168 | Qed. 169 | 170 | -------------------------------------------------------------------------------- /Tree_calculus/SF_Terms.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* SF-Calculus *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | (** The operators S and F are enough, but more may be added in future. *) 27 | 28 | Inductive operator := | Sop | Fop . 29 | 30 | (** The terms of SF-calculus are either variables (given as de Bruijn indices), operators or applications. 31 | Terms are called combinations if they do not use any variables. *) 32 | 33 | Inductive SF: Set := 34 | | Op : operator -> SF 35 | | App : SF -> SF -> SF 36 | . 37 | 38 | -------------------------------------------------------------------------------- /Tree_calculus/Test.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | 16 | 17 | (* Contribution to the Coq Library V6.3 (July 1999) *) 18 | 19 | (****************************************************************************) 20 | (* The Calculus of Inductive Constructions *) 21 | (* *) 22 | (* Projet Coq *) 23 | (* *) 24 | (* INRIA ENS-CNRS *) 25 | (* Rocquencourt Lyon *) 26 | (* *) 27 | (* Coq V5.10 *) 28 | (* Nov 25th 1994 *) 29 | (* *) 30 | (****************************************************************************) 31 | (* Test.v *) 32 | (****************************************************************************) 33 | 34 | (* Arithmetic tests *) 35 | 36 | Require Import Arith . 37 | 38 | (* Pattern-matching lemmas for comparing 2 naturals 39 | Similar to lemmas in Compare_dec *) 40 | 41 | Definition test : forall n m : nat, {n <= m} + {n > m}. 42 | Proof. 43 | simple induction n; simple induction m; simpl in |- *; auto with arith. 44 | intros m' H'; elim (H m'); auto with arith. 45 | Defined. 46 | (* Transparent test. *) 47 | 48 | Definition le_lt : forall n m : nat, n <= m -> {n < m} + {n = m}. 49 | Proof. 50 | simple induction n; simple induction m; simpl in |- *; auto with arith. 51 | intros m' H1 H2; elim (H m'); auto with arith. 52 | Defined. 53 | (* Transparent le_lt. *) 54 | 55 | Definition compare : forall n m : nat, {n < m} + {n = m} + {n > m}. 56 | Proof. 57 | intros n m; elim (test n m); auto with arith. 58 | left; apply le_lt; trivial with arith. 59 | Defined. 60 | 61 | (* Transparent compare. *) 62 | 63 | 64 | -------------------------------------------------------------------------------- /Tree_calculus/Tree_Eval.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | (**********************************************************************) 16 | 17 | (**********************************************************************) 18 | (* Tree_Eval.v *) 19 | (* *) 20 | (* Barry Jay *) 21 | (* *) 22 | (**********************************************************************) 23 | 24 | Require Import Arith Max. 25 | Require Import IntensionalLib.SF_calculus.General. 26 | Require Import IntensionalLib.Tree_calculus.Tree_Terms. 27 | Require Import IntensionalLib.Tree_calculus.Tree_Tactics. 28 | Require Import IntensionalLib.Tree_calculus.Tree_reduction. 29 | Require Import IntensionalLib.Tree_calculus.Tree_Normal. 30 | Require Import IntensionalLib.Tree_calculus.Tree_Closed. 31 | Require Import IntensionalLib.Tree_calculus.Substitution. 32 | 33 | 34 | Definition eval_app M N := 35 | match M with 36 | | App (App (Op Node) (Op Node)) M1 => M1 37 | | App (App (Op Node) (App (Op Node) M1)) M2 => 38 | App (App M2 N) (App M1 N) 39 | | App (App (Op Node) (App (App (Op Node) M1) M2)) M3 => 40 | App (App N M1) M2 41 | | x => App x N 42 | end. 43 | 44 | 45 | Lemma eval_app_from_Tree : forall M N, sf_red (App M N) (eval_app M N). 46 | Proof. 47 | induction M; split_all. 48 | gen_case IHM1 M1. gen_case IHM1 t. gen_case IHM1 o. 49 | gen_case IHM1 t0. 50 | (* 2 *) 51 | case o0; auto. red; one_step. 52 | (* 1 *) 53 | case t1; split_all. 54 | (* 2 *) 55 | case o0; split_all. red; one_step. 56 | (* 1 *) 57 | case t3; split_all. case o0; split_all. red; one_step. 58 | Qed. 59 | 60 | 61 | Fixpoint eval0 (M: Tree) := 62 | match M with 63 | | Ref i => Ref i 64 | | Op o => Op o 65 | | App (Op Fop) M11 => App (Op Fop) (eval0 M11) 66 | | App M1 M11 => eval_app (eval0 M1) M11 67 | end. 68 | 69 | Lemma eval0_from_Tree : forall M, sf_red M (eval0 M). 70 | Proof. 71 | induction M; split_all. 72 | eapply transitive_red. 73 | eapply preserves_app_sf_red. eapply2 IHM1. auto. 74 | eapply transitive_red. 75 | eapply2 eval_app_from_Tree. 76 | case M1; split_all. 77 | case o; split_all. 78 | eapply preserves_app_sf_red. auto. eapply2 IHM2. 79 | Qed. 80 | 81 | 82 | Ltac eval_tac := unfold_op; 83 | match goal with 84 | | |- sf_red ?M _ => red; eval_tac 85 | | |- multi_step sf_red1 ?M _ => 86 | (apply transitive_red with (eval0 M); 87 | [eapply2 eval0_from_Tree | 88 | unfold eval0, eval_app; unfold subst; split_all]) 89 | | _ => auto 90 | end. 91 | 92 | 93 | (* Boolean operations *) 94 | 95 | Definition not M := App (App M (App k_op i_op)) k_op. 96 | 97 | Lemma not_true : sf_red (not k_op) (App k_op i_op). 98 | Proof. unfold not; eval_tac. Qed. 99 | 100 | Lemma not_false : sf_red (not (App k_op i_op)) k_op. 101 | Proof. eval_tac. eval_tac. Qed. 102 | 103 | Definition iff M N := App (App M N) (not N). 104 | 105 | Lemma true_true : sf_red (iff k_op k_op) k_op. 106 | Proof. unfold iff; unfold not; eval_tac; split_all. Qed. 107 | Lemma true_false : sf_red (iff k_op (App k_op i_op)) (App k_op i_op). 108 | Proof. unfold iff; unfold not; eval_tac; split_all. Qed. 109 | Lemma false_true : sf_red (iff (App k_op i_op) k_op) (App k_op i_op). 110 | Proof. unfold iff; unfold not; eval_tac; eval_tac; eval_tac; eval_tac; split_all. Qed. 111 | Lemma false_false : sf_red (iff (App k_op i_op) (App k_op i_op)) k_op. 112 | Proof. 113 | unfold iff, not. unfold_op. repeat eval_tac. Qed. 114 | 115 | -------------------------------------------------------------------------------- /Tree_calculus/Tree_Normal.v: -------------------------------------------------------------------------------- 1 | (* This program is free software; you can redistribute it and/or *) 2 | (* modify it under the terms of the GNU Lesser General Public License *) 3 | (* as published by the Free Software Foundation; either version 2.1 *) 4 | (* of the License, or (at your option) any later version. *) 5 | (* *) 6 | (* This program is distributed in the hope that it will be useful, *) 7 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 8 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 9 | (* GNU General Public License for more details. *) 10 | (* *) 11 | (* You should have received a copy of the GNU Lesser General Public *) 12 | (* License along with this program; if not, write to the Free *) 13 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 14 | (* 02110-1301 USA *) 15 | 16 | (**********************************************************************) 17 | (* Tree_Normal.v *) 18 | (* *) 19 | (* Barry Jay *) 20 | (* *) 21 | (**********************************************************************) 22 | 23 | Require Import Arith Omega Max. 24 | Require Import IntensionalLib.SF_calculus.General. 25 | Require Import IntensionalLib.Tree_calculus.Tree_Terms. 26 | Require Import IntensionalLib.Tree_calculus.Tree_Tactics. 27 | Require Import IntensionalLib.Tree_calculus.Tree_reduction. 28 | 29 | 30 | Inductive status_val := 31 | | Active : status_val 32 | | Passive : status_val 33 | . 34 | 35 | Fixpoint status M := 36 | match M with 37 | | Ref _ => Active 38 | | Op _ => Passive 39 | | App (App (App (Op Node) M1) _ ) _ => status M1 40 | | App M1 _ => status M1 41 | end. 42 | 43 | (* normal terms *) 44 | 45 | Inductive normal : Tree -> Prop := 46 | | nf_ref : forall n, normal (Ref n) 47 | | nf_op : forall o, normal (Op o) 48 | | nf_active : forall M1 M2, normal M1 -> normal M2 -> 49 | status (App M1 M2) = Active -> 50 | normal (App M1 M2) 51 | | nf_compound : forall M1 M2, normal M1 -> normal M2 -> 52 | compound (App M1 M2) -> normal (App M1 M2) 53 | . 54 | 55 | Hint Constructors normal. 56 | 57 | 58 | 59 | 60 | Definition irreducible M (red:termred) := forall N, red M N -> False. 61 | 62 | Lemma ref_irreducible : forall n, irreducible (Ref n) sf_seqred1. 63 | Proof. intro n. red. split_all. inversion H; auto. Qed. 64 | 65 | Lemma normal_is_irreducible: 66 | forall M, normal M -> irreducible M sf_seqred1. 67 | Proof. 68 | intros M nor; induction nor; split_all. 69 | (* 4 *) 70 | eapply2 ref_irreducible. 71 | (* 3 *) 72 | red; split_all. inversion H. 73 | (* 2 *) 74 | intro. intro. inversion H0; subst; simpl in *; try discriminate. 75 | (* 4 *) 76 | eapply2 IHnor1. 77 | (* 3 *) 78 | eapply2 IHnor2. 79 | (* 1 *) 80 | intro. intro. inversion H0; subst; simpl in *; try (inversion H; fail). 81 | eapply2 IHnor1. 82 | eapply2 IHnor2. 83 | Qed. 84 | 85 | 86 | Theorem Tree_progress : forall (M : Tree), normal M \/ (exists N, sf_seqred1 M N) . 87 | Proof. 88 | induction M; try (inversion IHM); subst; split_all; eauto. 89 | (* 1 *) 90 | inversion IHM1; split_all. 2: right; inversion H; exist (App x M2). 91 | inversion IHM2; split_all. 2:right; inversion H0; exist (App M1 x). 92 | gen_case H M1. case o; try (right; eauto; fail); left; auto. 93 | inversion H; subst. 94 | (* 2 *) 95 | left; auto. 96 | eapply2 nf_active. gen_case H5 t. gen_case H5 t1. discriminate. 97 | (* 1 *) 98 | gen2_case H3 H5 t. 99 | left; case o; auto. 100 | gen2_case H3 H5 t1. 101 | gen2_case H3 H5 o; try (right; eauto; fail). 102 | inversion H3; subst. inversion H8. 103 | inversion H7; subst. left; eapply2 nf_active. 104 | right; eauto. left; eapply2 nf_active. 105 | right; eauto. inversion H5. 106 | (* 2 *) 107 | inversion H9; subst; eauto. 108 | (* 1 *) 109 | inversion H5. 110 | Qed. 111 | 112 | -------------------------------------------------------------------------------- /Tree_calculus/Tree_Terms.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Tree-Calculus *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | 26 | (* See "Trees not Numbers.pdf" *) 27 | 28 | (** More operators may be added in future. Strictly, 29 | the operator ~ is called the kernel, whose instances are nodes, perhaps leaves. *) 30 | 31 | Inductive operator := | Node . 32 | 33 | (** The terms of Tree-calculus are either variables (given as de Bruijn indices), operators or applications. 34 | Terms are called combinations if they do not use any variables. *) 35 | 36 | Inductive Tree: Set := 37 | | Ref : nat -> Tree 38 | | Op : operator -> Tree 39 | | App : Tree -> Tree -> Tree 40 | . 41 | 42 | -------------------------------------------------------------------------------- /Tree_calculus/Wave_Factor2.v: -------------------------------------------------------------------------------- 1 | (**********************************************************************) 2 | (* This program is free software; you can redistribute it and/or *) 3 | (* modify it under the terms of the GNU Lesser General Public License *) 4 | (* as published by the Free Software Foundation; either version 2.1 *) 5 | (* of the License, or (at your option) any later version. *) 6 | (* *) 7 | (* This program is distributed in the hope that it will be useful, *) 8 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 9 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 10 | (* GNU General Public License for more details. *) 11 | (* *) 12 | (* You should have received a copy of the GNU Lesser General Public *) 13 | (* License along with this program; if not, write to the Free *) 14 | (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) 15 | (* 02110-1301 USA *) 16 | (**********************************************************************) 17 | 18 | (**********************************************************************) 19 | (* Wave_Factor2.v *) 20 | (* *) 21 | (* Barry Jay *) 22 | (* *) 23 | (**********************************************************************) 24 | 25 | Require Import Arith Omega List Max. 26 | Require Import IntensionalLib.SF_calculus.Test. 27 | Require Import IntensionalLib.SF_calculus.General. 28 | Require Import IntensionalLib.Tree_calculus.Tree_Terms. 29 | Require Import IntensionalLib.Tree_calculus.Tree_Tactics. 30 | Require Import IntensionalLib.Tree_calculus.Tree_reduction. 31 | Require Import IntensionalLib.Tree_calculus.Tree_Normal. 32 | Require Import IntensionalLib.Tree_calculus.Tree_Closed. 33 | Require Import IntensionalLib.Tree_calculus.Substitution. 34 | Require Import IntensionalLib.Tree_calculus.Tree_Eval. 35 | Require Import IntensionalLib.Tree_calculus.Star. 36 | Require Import IntensionalLib.Tree_calculus.Wave_Factor. 37 | 38 | 39 | 40 | 41 | Lemma factor_fork: 42 | forall p q u t, 43 | sf_red(App (App (App Fop (App (App (Op Node) p) q)) u) t) 44 | (App (App t (App (Op Node) p)) q). 45 | Proof. 46 | intros; unfold Fop. 47 | eapply transitive_red. 48 | eapply2 star_opt_beta3. 49 | unfold subst, subst_rec; fold subst_rec. 50 | rewrite ! (subst_rec_closed is_leaf). 51 | 2: simpl; auto. 52 | insert_Ref_out. simpl. 53 | insert_Ref_out. 54 | unfold lift; rewrite ! lift_rec_null. 55 | rewrite ! subst_rec_lift_rec; try omega. 56 | rewrite ! lift_rec_null. 57 | eapply transitive_red. 58 | eapply preserves_app_sf_red. 59 | eapply preserves_app_sf_red. 60 | eapply2 fork_test. auto. 61 | eval_tac. eval_tac. eval_tac. eval_tac. 62 | eval_tac. eval_tac. eval_tac. eval_tac. 63 | eapply succ_red. eapply2 f_red. 64 | eval_tac. eval_tac. eval_tac. eval_tac. 65 | eval_tac. eval_tac. eval_tac. eval_tac. 66 | eapply transitive_red. 67 | eapply preserves_app_sf_red. 68 | eapply preserves_app_sf_red. 69 | eapply preserves_app_sf_red. 70 | eval_tac. all: auto. 71 | eapply transitive_red. 72 | eapply preserves_app_sf_red. 73 | eapply preserves_app_sf_red. 74 | eval_tac. all: auto. 75 | Qed. 76 | 77 | 78 | Lemma Fop_closed: maxvar Fop = 0. 79 | Proof. 80 | unfold Fop. unfold is_leaf, is_stem, is_fork, swap. 81 | unfold tree_test; unfold_op. 82 | rewrite ! maxvar_star_opt. 83 | rewrite ! maxvar_app. 84 | rewrite ! maxvar_star_opt. 85 | rewrite ! maxvar_app. 86 | cbv. auto. 87 | Qed. 88 | 89 | 90 | -------------------------------------------------------------------------------- /_CoqProject: -------------------------------------------------------------------------------- 1 | -R . IntensionalLib 2 | 3 | Closure_calculus/Closure_calculus.v 4 | 5 | SF_calculus/Test.v 6 | SF_calculus/General.v 7 | SF_calculus/SF_Terms.v 8 | SF_calculus/SF_Tactics.v 9 | SF_calculus/SF_reduction.v 10 | SF_calculus/SF_Normal.v 11 | SF_calculus/SF_Closed.v 12 | SF_calculus/Substitution.v 13 | SF_calculus/SF_Eval.v 14 | SF_calculus/Star.v 15 | SF_calculus/Fixpoints.v 16 | SF_calculus/Extensions.v 17 | SF_calculus/Tagging.v 18 | SF_calculus/Adding.v 19 | SF_calculus/SF_size.v 20 | 21 | Closure_to_SF/Abstraction_to_Combination.v 22 | Closure_to_SF/Eta.v 23 | Closure_to_SF/identity_abs_val.v 24 | 25 | Fieska_calculus/Test.v 26 | Fieska_calculus/General.v 27 | Fieska_calculus/Fieska_Terms.v 28 | Fieska_calculus/Fieska_Tactics.v 29 | Fieska_calculus/Fieska_reduction.v 30 | Fieska_calculus/Fieska_Normal.v 31 | Fieska_calculus/Fieska_Closed.v 32 | Fieska_calculus/Substitution.v 33 | Fieska_calculus/Fieska_Eval.v 34 | Fieska_calculus/Star.v 35 | Fieska_calculus/Fixpoints.v 36 | Fieska_calculus/Extensions.v 37 | Fieska_calculus/Tagging.v 38 | Fieska_calculus/Adding.v 39 | Fieska_calculus/Fieska_size.v 40 | 41 | Closure_to_Fieska/Abstraction_to_Combination.v 42 | Closure_to_Fieska/Eta.v 43 | Closure_to_Fieska/identity_abs_val.v 44 | Closure_to_Fieska/Optimization.v 45 | 46 | Abstraction_calculus/Abstraction_Terms.v 47 | Abstraction_calculus/Abstraction_Tactics.v 48 | Abstraction_calculus/Abstraction_Reduction.v 49 | Abstraction_calculus/Abstraction_Normal.v 50 | Abstraction_calculus/Abstraction_Equal.v 51 | Abstraction_calculus/Closure_to_Abstraction.v 52 | 53 | -------------------------------------------------------------------------------- /script: -------------------------------------------------------------------------------- 1 | coqc -R "." "IntensionalLib" Closure_calculus/Closure_calculus.v 2 | coqc -R "." "IntensionalLib" Closure_calculus/not_church_numerals.v 3 | coqc -R "." "IntensionalLib" SF_calculus/Test.v 4 | coqc -R "." "IntensionalLib" SF_calculus/General.v 5 | coqc -R "." "IntensionalLib" SF_calculus/SF_Terms.v 6 | coqc -R "." "IntensionalLib" SF_calculus/SF_Tactics.v 7 | coqc -R "." "IntensionalLib" SF_calculus/SF_reduction.v 8 | coqc -R "." "IntensionalLib" SF_calculus/SF_Normal.v 9 | coqc -R "." "IntensionalLib" SF_calculus/SF_Closed.v 10 | coqc -R "." "IntensionalLib" SF_calculus/Substitution.v 11 | coqc -R "." "IntensionalLib" SF_calculus/SF_Eval.v 12 | coqc -R "." "IntensionalLib" SF_calculus/Star.v 13 | coqc -R "." "IntensionalLib" SF_calculus/Fixpoints.v 14 | coqc -R "." "IntensionalLib" SF_calculus/Equal.v 15 | coqc -R "." "IntensionalLib" SF_calculus/Extensions.v 16 | 17 | coqc -R "." "IntensionalLib" Closure_to_SF/Tagging.v 18 | coqc -R "." "IntensionalLib" Closure_to_SF/Adding.v 19 | coqc -R "." "IntensionalLib" Closure_to_SF/SF_size.v 20 | coqc -R "." "IntensionalLib" Closure_to_SF/Abstraction_to_Combination.v 21 | 22 | coqc -R "." "IntensionalLib" Fieska_calculus/Test.v 23 | coqc -R "." "IntensionalLib" Fieska_calculus/General.v 24 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Terms.v 25 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Tactics.v 26 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_reduction.v 27 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Normal.v 28 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Closed.v 29 | coqc -R "." "IntensionalLib" Fieska_calculus/Substitution.v 30 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Eval.v 31 | coqc -R "." "IntensionalLib" Fieska_calculus/Star.v 32 | coqc -R "." "IntensionalLib" Fieska_calculus/Fixpoints.v 33 | coqc -R "." "IntensionalLib" Fieska_calculus/Extensions.v 34 | 35 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Tagging.v 36 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Adding.v 37 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Fieska_size.v 38 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Abstraction_to_Combination.v 39 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Eta.v 40 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Optimization.v 41 | 42 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Terms.v 43 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Tactics.v 44 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Reduction.v 45 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Normal.v 46 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Equal.v 47 | coqc -R "." "IntensionalLib" Abstraction_calculus/Closure_to_Abstraction.v 48 | 49 | Using the _CoqProject file, run 50 | 51 | coq_makefile -f _CoqProject -o Makefile 52 | make 53 | -------------------------------------------------------------------------------- /script~: -------------------------------------------------------------------------------- 1 | coqc -R "." "IntensionalLib" Closure_calculus/Closure_calculus.v 2 | coqc -R "." "IntensionalLib" Closure_calculus/not_church_numerals.v 3 | coqc -R "." "IntensionalLib" SF_calculus/Test.v 4 | coqc -R "." "IntensionalLib" SF_calculus/General.v 5 | coqc -R "." "IntensionalLib" SF_calculus/SF_Terms.v 6 | coqc -R "." "IntensionalLib" SF_calculus/SF_Tactics.v 7 | coqc -R "." "IntensionalLib" SF_calculus/SF_reduction.v 8 | coqc -R "." "IntensionalLib" SF_calculus/SF_Normal.v 9 | coqc -R "." "IntensionalLib" SF_calculus/SF_Closed.v 10 | coqc -R "." "IntensionalLib" SF_calculus/Substitution.v 11 | coqc -R "." "IntensionalLib" SF_calculus/SF_Eval.v 12 | coqc -R "." "IntensionalLib" SF_calculus/Star.v 13 | coqc -R "." "IntensionalLib" SF_calculus/Fixpoints.v 14 | coqc -R "." "IntensionalLib" SF_calculus/Equal.v 15 | coqc -R "." "IntensionalLib" SF_calculus/Extensions.v 16 | 17 | coqc -R "." "IntensionalLib" Closure_to_SF/Tagging.v 18 | coqc -R "." "IntensionalLib" Closure_to_SF/Adding.v 19 | coqc -R "." "IntensionalLib" Closure_to_SF/SF_size.v 20 | coqc -R "." "IntensionalLib" Closure_to_SF/Abstraction_to_Combination.v 21 | coqc -R "." "IntensionalLib" Closure_to_SF/identity_abs_val.v 22 | 23 | coqc -R "." "IntensionalLib" Fieska_calculus/Test.v 24 | coqc -R "." "IntensionalLib" Fieska_calculus/General.v 25 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Terms.v 26 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Tactics.v 27 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_reduction.v 28 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Normal.v 29 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Closed.v 30 | coqc -R "." "IntensionalLib" Fieska_calculus/Substitution.v 31 | coqc -R "." "IntensionalLib" Fieska_calculus/Fieska_Eval.v 32 | coqc -R "." "IntensionalLib" Fieska_calculus/Star.v 33 | coqc -R "." "IntensionalLib" Fieska_calculus/Fixpoints.v 34 | coqc -R "." "IntensionalLib" Fieska_calculus/Extensions.v 35 | 36 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Tagging.v 37 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Adding.v 38 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Fieska_size.v 39 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Abstraction_to_Combination.v 40 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Eta.v 41 | coqc -R "." "IntensionalLib" Closure_to_Fieska/identity_abs_val.v 42 | coqc -R "." "IntensionalLib" Closure_to_Fieska/Optimization.v 43 | 44 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Terms.v 45 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Tactics.v 46 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Reduction.v 47 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Normal.v 48 | coqc -R "." "IntensionalLib" Abstraction_calculus/Abstraction_Equal.v 49 | coqc -R "." "IntensionalLib" Abstraction_calculus/Closure_to_Abstraction.v 50 | 51 | Using the _CoqProject file, run 52 | 53 | coq_makefile -f _CoqProject -o Makefile 54 | make 55 | -------------------------------------------------------------------------------- /simpler_lambda_draft.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/simpler_lambda_draft.pdf -------------------------------------------------------------------------------- /the other left4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/the other left4.pdf -------------------------------------------------------------------------------- /type_for_lambda.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Barry-Jay/Intensional-computation/de09d3e646c1ea50127c5033b46576d8b4773259/type_for_lambda.pdf --------------------------------------------------------------------------------