Skip to content

Commit

Permalink
Fix weird TOC (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ailrun authored Sep 18, 2024
1 parent 7a00839 commit f5c2bb5
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 29 deletions.
13 changes: 9 additions & 4 deletions theories/Core/Semantic/PER/Definitions.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Notation "R <~> R'" := (relation_equivalence R R') (at level 95, no associativit

Generalizable All Variables.

(** ** Helper Bundles *)
(** *** Helper Bundles *)
(** Related modulo evaluation *)
Inductive rel_mod_eval (R : relation domain -> domain -> domain -> Prop) A ρ A' ρ' R' : Prop := mk_rel_mod_eval : forall a a', {{ ⟦ A ⟧ ρ ↘ a }} -> {{ ⟦ A' ⟧ ρ' ↘ a' }} -> {{ DF a ≈ a' ∈ R ↘ R' }} -> rel_mod_eval R A ρ A' ρ' R'.
#[global]
Expand All @@ -31,7 +31,7 @@ Arguments mk_rel_mod_app {_ _ _ _ _}.
#[export]
Hint Constructors rel_mod_app : mcltt.

(** ** (Some Elements of) PER Lattice *)
(** *** (Some Elements of) PER Lattice *)

Definition per_bot : relation domain_ne := fun m n => (forall s, exists L, {{ Rne m in s ↘ L }} /\ {{ Rne n in s ↘ L }}).
#[global]
Expand Down Expand Up @@ -77,6 +77,7 @@ Inductive per_ne : relation domain :=
#[export]
Hint Constructors per_ne : mcltt.

(** * Universe/Element PER *)
(** ** Universe/Element PER Definition *)

Section Per_univ_elem_core_def.
Expand Down Expand Up @@ -229,6 +230,8 @@ End Per_univ_elem_ind_def.

Reserved Notation "'Sub' a <: b 'at' i" (in custom judg at level 90, a custom domain, b custom domain, i constr).

(** * Universe Subtyping *)

Inductive per_subtyp : nat -> domain -> domain -> Prop :=
| per_subtyp_neut :
`( {{ Dom b ≈ b' ∈ per_bot }} ->
Expand All @@ -255,15 +258,15 @@ where "'Sub' a <: b 'at' i" := (per_subtyp i a b) (in custom judg) : type_scope.
#[export]
Hint Constructors per_subtyp : mcltt.

(** ** Context/Environment PER *)

Definition rel_typ i A ρ A' ρ' R' := rel_mod_eval (per_univ_elem i) A ρ A' ρ' R'.
Arguments rel_typ _ _ _ _ _ _ /.
#[export]
Hint Transparent rel_typ : mcltt.
#[export]
Hint Unfold rel_typ : mcltt.

(** * Context/Environment PER *)

Inductive per_ctx_env : relation env -> ctx -> ctx -> Prop :=
| per_ctx_env_nil :
`{ forall env_rel,
Expand Down Expand Up @@ -294,6 +297,8 @@ Hint Unfold valid_ctx : mcltt.

Reserved Notation "'SubE' Γ <: Δ" (in custom judg at level 90, Γ custom exp, Δ custom exp).

(** * Context Subtyping *)

Inductive per_ctx_subtyp : ctx -> ctx -> Prop :=
| per_ctx_subtyp_nil :
{{ SubE ⋅ <: ⋅ }}
Expand Down
10 changes: 5 additions & 5 deletions theories/Core/Soundness/LogicalRelation/CoreLemmas.v
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ Ltac apply_predicate_equivalence :=
rewrite_predicate_equivalence_left;
clear_predicate_equivalence.

(** ** Simple Morphism instance for [glu_univ_elem] *)
(** *** Simple Morphism instance for [glu_univ_elem] *)
Add Parametric Morphism i : (glu_univ_elem i)
with signature glu_typ_pred_equivalence ==> glu_exp_pred_equivalence ==> eq ==> iff as simple_glu_univ_elem_morphism_iff.
Proof with mautosolve.
Expand All @@ -420,7 +420,7 @@ Proof with mautosolve.
try (etransitivity; [symmetry + idtac|]; eassumption); eauto.
Qed.

(** ** Morphism instances for [neut_glu_*_pred]s *)
(** *** Morphism instances for [neut_glu_*_pred]s *)
Add Parametric Morphism i : (neut_glu_typ_pred i)
with signature per_bot ==> eq ==> eq ==> iff as neut_glu_typ_pred_morphism_iff.
Proof with mautosolve.
Expand Down Expand Up @@ -450,7 +450,7 @@ Proof with mautosolve.
split; apply neut_glu_exp_pred_morphism_iff; mauto.
Qed.

(** ** Morphism instances for [pi_glu_*_pred]s *)
(** *** Morphism instances for [pi_glu_*_pred]s *)
Add Parametric Morphism i IR : (pi_glu_typ_pred i IR)
with signature glu_typ_pred_equivalence ==> glu_exp_pred_equivalence ==> eq ==> eq ==> eq ==> iff as pi_glu_typ_pred_morphism_iff.
Proof with mautosolve.
Expand Down Expand Up @@ -662,7 +662,7 @@ Proof.
eassumption.
Qed.

(** ** Morphism instances for [glu_univ_elem] *)
(** *** Morphism instances for [glu_univ_elem] *)
Add Parametric Morphism i : (glu_univ_elem i)
with signature glu_typ_pred_equivalence ==> glu_exp_pred_equivalence ==> per_univ i ==> iff as glu_univ_elem_morphism_iff.
Proof with mautosolve.
Expand Down Expand Up @@ -943,7 +943,7 @@ Proof.
mauto.
Qed.

(** ** Simple Morphism instance for [glu_ctx_env] *)
(** *** Simple Morphism instance for [glu_ctx_env] *)
Add Parametric Morphism : glu_ctx_env
with signature glu_sub_pred_equivalence ==> eq ==> iff as simple_glu_ctx_env_morphism_iff.
Proof.
Expand Down
10 changes: 5 additions & 5 deletions theories/Core/Soundness/LogicalRelation/Lemmas.v
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ Proof.
eapply glu_univ_elem_exp_lower; mauto.
Qed.

(** ** Lemmas for [glu_rel_typ_with_sub] and [glu_rel_exp_with_sub] *)
(** *** Lemmas for [glu_rel_typ_with_sub] and [glu_rel_exp_with_sub] *)

Lemma mk_glu_rel_typ_with_sub' : forall {i Δ A σ ρ a},
{{ ⟦ A ⟧ ρ ↘ a }} ->
Expand Down Expand Up @@ -672,7 +672,7 @@ Qed.
#[export]
Hint Resolve glu_rel_typ_with_sub_implies_glu_rel_exp_with_sub : mcltt.

(** ** Lemmas for [glu_ctx_env] *)
(** *** Lemmas for [glu_ctx_env] *)

Lemma glu_ctx_env_sub_resp_ctx_eq : forall {Γ Sb},
{{ EG Γ ∈ glu_ctx_env ↘ Sb }} ->
Expand Down Expand Up @@ -1039,7 +1039,7 @@ Proof.
eapply glu_ctx_env_sub_monotone; mauto 4.
Qed.

(** ** Tactics for [glu_rel_*] *)
(** *** Tactics for [glu_rel_*] *)

Ltac destruct_glu_rel_by_assumption sub_glu_rel H :=
repeat
Expand Down Expand Up @@ -1079,7 +1079,7 @@ Ltac destruct_glu_rel_typ_with_sub :=
end;
unmark_all.

(** ** Lemmas about [glu_rel_exp] *)
(** *** Lemmas about [glu_rel_exp] *)

Lemma glu_rel_exp_clean_inversion1 : forall {Γ Sb M A},
{{ EG Γ ∈ glu_ctx_env ↘ Sb }} ->
Expand Down Expand Up @@ -1148,7 +1148,7 @@ Qed.
#[export]
Hint Resolve glu_rel_exp_to_wf_exp : mcltt.

(** ** Lemmas about [glu_rel_sub] *)
(** *** Lemmas about [glu_rel_sub] *)

Lemma glu_rel_sub_clean_inversion1 : forall {Γ Sb τ Γ'},
{{ EG Γ ∈ glu_ctx_env ↘ Sb }} ->
Expand Down
7 changes: 4 additions & 3 deletions theories/Core/Syntactic/Syntax.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ From Coq Require Import List String.

From Mcltt Require Import Base.

(** ** Concrete Syntax Tree *)
(** * Concrete Syntax Tree *)
Module Cst.
Inductive obj : Set :=
| typ : nat -> obj
Expand All @@ -16,7 +16,7 @@ Inductive obj : Set :=
| var : string -> obj.
End Cst.

(** ** Abstract Syntac Tree *)
(** * Abstract Syntac Tree *)
Inductive exp : Set :=
(** Universe *)
| a_typ : nat -> exp
Expand Down Expand Up @@ -65,7 +65,7 @@ Definition exp_to_num e :=
| None => None
end.

(** *** Syntactic Normal/Neutral Form *)
(** ** Syntactic Normal/Neutral Form *)
Inductive nf : Set :=
| nf_typ : nat -> nf
| nf_nat : nf
Expand Down Expand Up @@ -123,6 +123,7 @@ Arguments q σ/.
#[global] Bind Scope mcltt_scope with ne.
Open Scope mcltt_scope.

(** ** Syntactic Notations *)
Module Syntax_Notations.
Notation "{{{ x }}}" := x (at level 0, x custom exp at level 99, format "'{{{' x '}}}'") : mcltt_scope.
Notation "( x )" := x (in custom exp at level 0, x custom exp at level 60) : mcltt_scope.
Expand Down
12 changes: 6 additions & 6 deletions theories/Core/Syntactic/System/Lemmas.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From Mcltt Require Import Base LibTactics System.Definitions.
Import Syntax_Notations.

(** ** Core Presuppositions *)
(** *** Core Presuppositions *)
Lemma ctx_decomp : forall {Γ A}, {{ ⊢ Γ , A }} -> {{ ⊢ Γ }} /\ exists i, {{ Γ ⊢ A : Type@i }}.
Proof with now eauto.
inversion 1...
Expand Down Expand Up @@ -220,7 +220,7 @@ Proof with mautosolve.
assert (m <= max n m) by lia...
Qed.

(** ** Additional Lemmas for Syntactic PERs *)
(** *** Additional Lemmas for Syntactic PERs *)

Lemma exp_eq_refl : forall {Γ M A},
{{ Γ ⊢ M : A }} ->
Expand Down Expand Up @@ -251,7 +251,7 @@ Proof. mauto. Qed.
#[export]
Hint Resolve sub_eq_refl : mcltt.

(** ** Lemmas for [exp] of [{{{ Type@i }}}] *)
(** *** Lemmas for [exp] of [{{{ Type@i }}}] *)

Lemma exp_sub_typ : forall {Δ Γ A σ i},
{{ Δ ⊢ A : Type@i }} ->
Expand Down Expand Up @@ -475,7 +475,7 @@ Qed.
#[export]
Hint Resolve exp_eq_sub_sub_compose_cong_typ : mcltt.

(** ** Lemmas for [exp] of [{{{ ℕ }}}] *)
(** *** Lemmas for [exp] of [{{{ ℕ }}}] *)

Lemma exp_sub_nat : forall {Δ Γ M σ},
{{ Δ ⊢ M : ℕ }} ->
Expand Down Expand Up @@ -674,7 +674,7 @@ Qed.
#[export]
Hint Resolve exp_eq_sub_sub_compose_cong_nat : mcltt.

(** ** Other Tedious Lemmas *)
(** *** Other Tedious Lemmas *)

Lemma exp_eq_sub_sub_compose_cong : forall {Γ Δ Δ' Ψ σ τ σ' τ' M A i},
{{ Ψ ⊢ A : Type@i }} ->
Expand Down Expand Up @@ -1018,7 +1018,7 @@ Qed.
#[export]
Hint Resolve sub_eq_q_sigma_compose_weak_weak_extend_succ_var_1 : mcltt.

(** ** Lemmas for [wf_subtyp] *)
(** *** Lemmas for [wf_subtyp] *)

Fact wf_subtyp_refl : forall {Γ A i},
{{ Γ ⊢ A : Type@i }} ->
Expand Down
2 changes: 1 addition & 1 deletion theories/Frontend/Elaborator.v
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Proof.
assert (y = x); fsetdec.
Qed.

(** ** Well scopedness lemma *)
(** *** Well scopedness lemma *)

(** If the set of free variables in a cst are contained in a context
then elaboration succeeds with that context, and the result is a closed term *)
Expand Down
10 changes: 5 additions & 5 deletions theories/LibTactics.v
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Create HintDb mcltt discriminated.
#[export]
Typeclasses Transparent arrows.

(** ** Generalization of Variables *)
(** *** Generalization of Variables *)

Tactic Notation "gen" ident(x) := generalize dependent x.
Tactic Notation "gen" ident(x) ident(y) := gen x; gen y.
Tactic Notation "gen" ident(x) ident(y) ident(z) := gen x y; gen z.
Tactic Notation "gen" ident(x) ident(y) ident(z) ident(w) := gen x y z; gen w.

(** ** Marking-based Tactics *)
(** *** Marking-based Tactics *)

Definition __mark__ (n : nat) A (a : A) : A := a.
Arguments __mark__ n {A} a : simpl never.
Expand Down Expand Up @@ -59,7 +59,7 @@ Tactic Notation "on_all_hyp:" tactic4(tac) :=
Tactic Notation "on_all_hyp_rev:" tactic4(tac) :=
mark_all_with 0; (on_all_marked_hyp_rev: tac).

(** ** Simple helper *)
(** *** Simple helper *)

Ltac destruct_logic :=
destruct_one_pair
Expand Down Expand Up @@ -189,7 +189,7 @@ Ltac dir_inversion_clear_by_head head := match_by_head head ltac:(fun H => direc
Ltac destruct_by_head head := match_by_head head ltac:(fun H => destruct H).
Ltac dir_destruct_by_head head := match_by_head head ltac:(fun H => directed destruct H).

(** ** McLTT automation *)
(** *** McLTT automation *)

Tactic Notation "mauto" :=
eauto with mcltt core.
Expand Down Expand Up @@ -403,7 +403,7 @@ Ltac solve_refl :=
Thus, we try [Equivalence_Reflexive] as well. *)
solve [reflexivity || apply Equivalence_Reflexive].

(** ** Helper Instances for Generalized Rewriting *)
(** *** Helper Instances for Generalized Rewriting *)
#[export]
Hint Extern 1 (subrelation (@predicate_equivalence ?Ts) _) => (let H := fresh "H" in intros ? ? H; exact H) : typeclass_instances.

Expand Down

0 comments on commit f5c2bb5

Please sign in to comment.