-
Notifications
You must be signed in to change notification settings - Fork 3
/
LamSF_Marks.v
81 lines (67 loc) · 3.3 KB
/
LamSF_Marks.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
(**********************************************************************)
(* This program is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1 *)
(* of the License, or (at your option) any later version. *)
(* *)
(* This program is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU General Public License for more details. *)
(* *)
(* You should have received a copy of the GNU Lesser General Public *)
(* License along with this program; if not, write to the Free *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA *)
(**********************************************************************)
(**********************************************************************)
(* Intensional Lambda Calculus *)
(* *)
(* is implemented in Coq by adapting the implementation of *)
(* Lambda Calculus from Project Coq *)
(* 2015 *)
(**********************************************************************)
(**********************************************************************)
(* LamSF_Marks.v *)
(* *)
(* adapted from Marks.v for Lambda Calculus *)
(* *)
(* Barry Jay *)
(* *)
(**********************************************************************)
Require Import Arith.
Require Import Test.
Require Import General.
Require Import LamSF_Terms.
Require Import LamSF_Redexes.
Require Import LamSF_Residuals.
(* Translation from terms to redexes *)
Fixpoint mark (e : lamSF) : redexes :=
match e with
| Ref i => Var i
| Op o => Opp o
| App M N => Ap false (mark M) (mark N)
| Abs M => Fun (mark M)
end.
(* Reverse translation : erasing the marks *)
Fixpoint unmark (e : redexes) : lamSF :=
match e with
| Var i => Ref i
| Opp o => Op o
| Ap b U V => App (unmark U) (unmark V)
| Fun U => Abs (unmark U)
end.
Lemma inverse : forall M : lamSF, M = unmark (mark M).
Proof.
simple induction M; simpl in |- *; trivial; simple induction 1; trivial.
simple induction 1; trivial.
Qed.
Lemma comp_unmark_eq : forall U V : redexes, comp U V -> unmark U = unmark V.
Proof.
simple induction 1; simpl in |- *; trivial; split_all.
Qed.
(* The converse is true, but not needed in the rest of the development *)
Lemma residuals_mark :
forall M, residuals (mark M) (mark M) (mark M).
Proof. induction M; split_all. Qed.
Hint Resolve residuals_mark.