Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Andrew Hirsch
Pirouette Coq Code
Commits
ab81157d
Commit
ab81157d
authored
Sep 21, 2021
by
Andrew Hirsch
Browse files
Cleaned up example language modules.
parent
2acfe358
Changes
3
Hide whitespace changes
Inline
Side-by-side
NatLang.v
View file @
ab81157d
...
...
@@ -98,10 +98,6 @@ Module NatLang <: LocalLang.
(
e
⟨
e
|
ξ
1
⟩
)
⟨
e
|
ξ
2
⟩
=
e
⟨
e
|
fun
n
=>
ξ
2
(
ξ
1
n
)
⟩
.
Proof
using
.
intro
e
;
induction
e
;
intros
ξ
1
ξ
2
;
cbn
;
try
rewrite
IHe
;
reflexivity
.
Qed
.
(
*
Theorem
ExprSubstFusion
:
forall
(
e
:
Expr
)
(
σ
1
σ
2
:
nat
->
Expr
),
*
)
(
*
(
e
[
e
|
σ
1
])
[
e
|
σ
2
]
=
e
[
e
|
fun
n
=>
σ
1
n
[
e
|
σ
2
]].
*
)
(
*
Proof
using
.
intro
e
;
induction
e
;
intros
σ
1
σ
2
;
cbn
;
try
rewrite
IHe
;
reflexivity
.
Qed
.
*
)
Definition
ExprUpSubst
:
(
nat
->
Expr
)
->
nat
->
Expr
:=
fun
σ
n
=>
match
n
with
...
...
STLC.v
View file @
ab81157d
...
...
@@ -139,40 +139,5 @@ Module STLC <: (TypedLocalLang LambdaCalc).
Proof
.
unfold
ExprSubstTyping
.
intros
Γ
n
.
unfold
ExprIdSubst
.
apply
ExprVarTyping
.
Qed
.
(
*
Lemma
ExprSubstLWeakening
:
forall
(
Γ
Δ
1
Δ
2
:
nat
->
ExprTyp
)
(
σ
:
nat
->
Expr
)
(
ξ
:
nat
->
nat
),
*
)
(
*
(
forall
n
,
Δ
1
n
=
Δ
2
(
ξ
n
))
->
*
)
(
*
Γ
⊢
es
σ
⊣
Δ
1
->
*
)
(
*
Γ
⊢
es
fun
n
=>
(
σ
n
)
⟨
e
|
ξ⟩
⊣
Δ
2.
*
)
(
*
Proof
.
*
)
(
*
intros
Γ
Δ
1
Δ
2
σ
ξ
sub
Δ
typing
.
*
)
(
*
unfold
ExprSubstTyping
in
*
;
intro
n
.
*
)
(
*
eapply
ExprWeakening
;
eauto
.
*
)
(
*
Qed
.
*
)
(
*
Lemma
ExprSubstRWeakening
:
forall
(
Γ
1
Γ
2
Δ
:
nat
->
ExprTyp
)
(
σ
:
nat
->
Expr
)
(
ξ
:
nat
->
nat
),
*
)
(
*
(
forall
n
,
Γ
1
(
ξ
n
)
=
Γ
2
n
)
->
*
)
(
*
Γ
1
⊢
es
σ
⊣
Δ
->
*
)
(
*
Γ
2
⊢
es
fun
n
=>
σ
(
ξ
n
)
⊣
Δ
.
*
)
(
*
Proof
.
*
)
(
*
intros
Γ
1
Γ
2
Δ
σ
ξ
sub
Γ
typing
.
*
)
(
*
unfold
ExprSubstTyping
in
*
;
intro
n
.
*
)
(
*
rewrite
<-
sub
Γ
.
apply
typing
.
*
)
(
*
Qed
.
*
)
(
*
Lemma
ExprSubstTypeExpand
:
forall
(
Γ
Δ
:
nat
->
ExprTyp
)
(
σ
:
nat
->
Expr
),
*
)
(
*
Γ
⊢
es
σ
⊣
Δ
->
*
)
(
*
forall
τ
:
ExprTyp
,
ExprSubstTyping
(
fun
n
=>
match
n
with
|
0
=>
τ
|
S
n
=>
Γ
n
end
)
*
)
(
*
(
ExprUpSubst
σ
)
*
)
(
*
(
fun
n
=>
match
n
with
|
0
=>
τ
|
S
n
=>
Δ
n
end
).
*
)
(
*
Proof
.
*
)
(
*
intros
Γ
Δ
σ
typing
τ
.
*
)
(
*
unfold
ExprUpSubst
.
*
)
(
*
unfold
ExprSubstTyping
in
*
.
*
)
(
*
intro
m
.
*
)
(
*
unfold
ExprUpSubst
.
destruct
m
;
simpl
.
*
)
(
*
apply
ExprVarTyping
.
*
)
(
*
apply
ExprWeakening
with
(
Γ
:=
Δ
);
auto
.
*
)
(
*
Qed
.
*
)
End
STLC
.
TypedNatLang.v
View file @
ab81157d
...
...
@@ -104,40 +104,5 @@ Module TypedNatLang <: (TypedLocalLang NatLang).
Proof
.
unfold
ExprSubstTyping
.
intros
Γ
n
.
unfold
ExprIdSubst
.
apply
ExprVarTyping
.
Qed
.
(
*
Lemma
ExprSubstLWeakening
:
forall
(
Γ
Δ
1
Δ
2
:
nat
->
ExprTyp
)
(
σ
:
nat
->
Expr
)
(
ξ
:
nat
->
nat
),
*
)
(
*
(
forall
n
,
Δ
1
n
=
Δ
2
(
ξ
n
))
->
*
)
(
*
Γ
⊢
es
σ
⊣
Δ
1
->
*
)
(
*
Γ
⊢
es
fun
n
=>
(
σ
n
)
⟨
e
|
ξ⟩
⊣
Δ
2.
*
)
(
*
Proof
.
*
)
(
*
intros
Γ
Δ
1
Δ
2
σ
ξ
sub
Δ
typing
.
*
)
(
*
unfold
ExprSubstTyping
in
*
;
intro
n
.
*
)
(
*
eapply
ExprWeakening
;
eauto
.
*
)
(
*
Qed
.
*
)
(
*
Lemma
ExprSubstRWeakening
:
forall
(
Γ
1
Γ
2
Δ
:
nat
->
ExprTyp
)
(
σ
:
nat
->
Expr
)
(
ξ
:
nat
->
nat
),
*
)
(
*
(
forall
n
,
Γ
1
(
ξ
n
)
=
Γ
2
n
)
->
*
)
(
*
Γ
1
⊢
es
σ
⊣
Δ
->
*
)
(
*
Γ
2
⊢
es
fun
n
=>
σ
(
ξ
n
)
⊣
Δ
.
*
)
(
*
Proof
.
*
)
(
*
intros
Γ
1
Γ
2
Δ
σ
ξ
sub
Γ
typing
.
*
)
(
*
unfold
ExprSubstTyping
in
*
;
intro
n
.
*
)
(
*
rewrite
<-
sub
Γ
.
apply
typing
.
*
)
(
*
Qed
.
*
)
(
*
Lemma
ExprSubstTypeExpand
:
forall
(
Γ
Δ
:
nat
->
ExprTyp
)
(
σ
:
nat
->
Expr
),
*
)
(
*
Γ
⊢
es
σ
⊣
Δ
->
*
)
(
*
forall
τ
:
ExprTyp
,
ExprSubstTyping
(
fun
n
=>
match
n
with
|
0
=>
τ
|
S
n
=>
Γ
n
end
)
*
)
(
*
(
ExprUpSubst
σ
)
*
)
(
*
(
fun
n
=>
match
n
with
|
0
=>
τ
|
S
n
=>
Δ
n
end
).
*
)
(
*
Proof
.
*
)
(
*
intros
Γ
Δ
σ
typing
τ
.
*
)
(
*
unfold
ExprUpSubst
.
*
)
(
*
unfold
ExprSubstTyping
in
*
.
*
)
(
*
intro
m
.
*
)
(
*
unfold
ExprUpSubst
.
destruct
m
;
simpl
.
*
)
(
*
apply
ExprVarTyping
.
*
)
(
*
apply
ExprWeakening
with
(
Γ
:=
Δ
);
auto
.
*
)
(
*
Qed
.
*
)
End
TypedNatLang
.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment