Skip to content
Snippets Groups Projects
Commit 32f9c45d authored by Ralf Jung's avatar Ralf Jung
Browse files
parents 08306201 018e8b64
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -30,6 +30,7 @@ theories/typing/typing.v ...@@ -30,6 +30,7 @@ theories/typing/typing.v
theories/typing/lft_contexts.v theories/typing/lft_contexts.v
theories/typing/type_context.v theories/typing/type_context.v
theories/typing/cont_context.v theories/typing/cont_context.v
theories/typing/uninit.v
theories/typing/own.v theories/typing/own.v
theories/typing/uniq_bor.v theories/typing/uniq_bor.v
theories/typing/shr_bor.v theories/typing/shr_bor.v
......
...@@ -6,7 +6,7 @@ Section bool. ...@@ -6,7 +6,7 @@ Section bool.
Context `{typeG Σ}. Context `{typeG Σ}.
Program Definition bool : type := Program Definition bool : type :=
{| st_size := 1; st_own tid vl := ( z:bool, vl = [ #z ])%I |}. {| st_own tid vl := ( z:bool, vl = [ #z ])%I |}.
Next Obligation. iIntros (tid vl) "H". iDestruct "H" as (z) "%". by subst. Qed. Next Obligation. iIntros (tid vl) "H". iDestruct "H" as (z) "%". by subst. Qed.
Lemma typed_bool ρ (b:Datatypes.bool): typed_step_ty ρ #b bool. Lemma typed_bool ρ (b:Datatypes.bool): typed_step_ty ρ #b bool.
......
...@@ -10,8 +10,7 @@ Section fn. ...@@ -10,8 +10,7 @@ Section fn.
Program Definition fn {A n} (E : A elctx) Program Definition fn {A n} (E : A elctx)
(tys : A vec type n) (ty : A type) : type := (tys : A vec type n) (ty : A type) : type :=
{| st_size := 1; {| st_own tid vl := ( f, vl = [f] (x : A) (args : vec val n) (k : val),
st_own tid vl := ( f, vl = [f] (x : A) (args : vec val n) (k : val),
typed_body (E x) [] typed_body (E x) []
[CctxElt k [] 1 (λ v, [TCtx_holds (v!!!0) (ty x)])] [CctxElt k [] 1 (λ v, [TCtx_holds (v!!!0) (ty x)])]
(zip_with (TCtx_holds of_val) args (tys x)) (zip_with (TCtx_holds of_val) args (tys x))
......
...@@ -6,7 +6,7 @@ Section int. ...@@ -6,7 +6,7 @@ Section int.
Context `{typeG Σ}. Context `{typeG Σ}.
Program Definition int : type := Program Definition int : type :=
{| st_size := 1; st_own tid vl := ( z:Z, vl = [ #z ])%I |}. {| st_own tid vl := ( z:Z, vl = [ #z ])%I |}.
Next Obligation. iIntros (tid vl) "H". iDestruct "H" as (z) "%". by subst. Qed. Next Obligation. iIntros (tid vl) "H". iDestruct "H" as (z) "%". by subst. Qed.
Lemma typed_int ρ (z:Datatypes.nat) : Lemma typed_int ρ (z:Datatypes.nat) :
......
...@@ -4,17 +4,11 @@ From lrust.lifetime Require Import borrow frac_borrow. ...@@ -4,17 +4,11 @@ From lrust.lifetime Require Import borrow frac_borrow.
From lrust.lang Require Export new_delete. From lrust.lang Require Export new_delete.
From lrust.lang Require Import heap. From lrust.lang Require Import heap.
From lrust.typing Require Export type. From lrust.typing Require Export type.
From lrust.typing Require Import typing product perm. From lrust.typing Require Import typing product perm uninit.
Section own. Section own.
Context `{typeG Σ}. Context `{typeG Σ}.
(* Even though it does not seem too natural to put this here, it is
the only place where it is used. *)
Program Definition uninit : type :=
{| st_size := 1; st_own tid vl := length vl = 1%nat⌝%I |}.
Next Obligation. done. Qed.
Program Definition freeable_sz (n : nat) (sz : nat) (l : loc) : iProp Σ := Program Definition freeable_sz (n : nat) (sz : nat) (l : loc) : iProp Σ :=
match sz, n return _ with match sz, n return _ with
| 0%nat, _ => True | 0%nat, _ => True
...@@ -123,7 +117,7 @@ Section own. ...@@ -123,7 +117,7 @@ Section own.
Proof. intros ?? Heq. split; f_equiv; apply Heq. Qed. Proof. intros ?? Heq. split; f_equiv; apply Heq. Qed.
Lemma typed_new ρ (n : nat): Lemma typed_new ρ (n : nat):
0 n typed_step_ty ρ (new [ #n]%E) (own n (Π(replicate n uninit))). 0 n typed_step_ty ρ (new [ #n]%E) (own n (uninit n)).
Proof. Proof.
iIntros (Hn tid) "!#(#HEAP&_&_&$)". iApply (wp_new with "HEAP"); try done. iIntros (Hn tid) "!#(#HEAP&_&_&$)". iApply (wp_new with "HEAP"); try done.
iIntros "!>*(% & H† & H↦)". iExists _. iSplit. done. iNext. iIntros "!>*(% & H† & H↦)". iExists _. iSplit. done. iNext.
...@@ -133,9 +127,7 @@ Section own. ...@@ -133,9 +127,7 @@ Section own.
clear Hn. apply (inj Z.of_nat) in Hlen. subst. clear Hn. apply (inj Z.of_nat) in Hlen. subst.
iInduction vl as [|v vl] "IH". done. iInduction vl as [|v vl] "IH". done.
iExists [v], vl. iSplit. done. by iSplit. iExists [v], vl. iSplit. done. by iSplit.
- assert (ty_size (Π (replicate n uninit)) = n) as ->. - by rewrite uninit_sz freeable_sz_full.
{ clear. induction n; rewrite //= IHn //. }
by rewrite freeable_sz_full.
Qed. Qed.
Lemma typed_delete ty (ν : expr): Lemma typed_delete ty (ν : expr):
...@@ -178,8 +170,7 @@ Section own. ...@@ -178,8 +170,7 @@ Section own.
Qed. Qed.
Lemma consumes_move ty n: Lemma consumes_move ty n:
consumes ty (λ ν, ν own n ty)%P consumes ty (λ ν, ν own n ty)%P (λ ν, ν own n (uninit ty.(ty_size)))%P.
(λ ν, ν own n (Π(replicate ty.(ty_size) uninit)))%P.
Proof. Proof.
iIntros (ν tid Φ E ?) "_ H◁ Htl HΦ". iApply (has_type_wp with "H◁"). iIntros (ν tid Φ E ?) "_ H◁ Htl HΦ". iApply (has_type_wp with "H◁").
iIntros (v) "Hνv H◁". iDestruct "Hνv" as %Hνv. iIntros (v) "Hνv H◁". iDestruct "Hνv" as %Hνv.
...@@ -192,7 +183,6 @@ Section own. ...@@ -192,7 +183,6 @@ Section own.
- rewrite -Hlen. iExists vl. iIntros "{$H↦}!>". clear. - rewrite -Hlen. iExists vl. iIntros "{$H↦}!>". clear.
iInduction vl as [|v vl] "IH". done. iInduction vl as [|v vl] "IH". done.
iExists [v], vl. iSplit. done. by iSplit. iExists [v], vl. iSplit. done. by iSplit.
- assert (ty_size (Π (replicate (ty_size ty) uninit)) = ty_size ty) as ->; last by auto. - rewrite uninit_sz; auto.
clear. induction ty.(ty_size). done. by apply (f_equal S).
Qed. Qed.
End own. End own.
...@@ -7,8 +7,17 @@ Section product. ...@@ -7,8 +7,17 @@ Section product.
Context `{typeG Σ}. Context `{typeG Σ}.
Program Definition unit : type := Program Definition unit : type :=
{| st_size := 0; st_own tid vl := vl = []⌝%I |}. {| ty_size := 0; ty_own tid vl := vl = []⌝%I; ty_shr κ tid E l := True%I |}.
Next Obligation. iIntros (tid vl) "%". simpl. by subst. Qed. Next Obligation. iIntros (tid vl) "%". by subst. Qed.
Next Obligation. by iIntros (???????) "_ _". Qed.
Next Obligation. by iIntros (???????) "_ _ $". Qed.
Global Instance unit_copy : Copy unit.
Proof.
split. by apply _.
iIntros (???????) "_ _ $". iExists 1%Qp. iSplitL; last by auto.
iExists []. iSplitL; last by auto. rewrite heap_mapsto_vec_nil. auto.
Qed.
Lemma split_prod_mt tid ty1 ty2 q l : Lemma split_prod_mt tid ty1 ty2 q l :
(l ↦∗{q}: λ vl, (l ↦∗{q}: λ vl,
...@@ -109,11 +118,18 @@ Section product. ...@@ -109,11 +118,18 @@ Section product.
iMod ("Hclose2" with "[H2 H↦2]") as "[$$]". by iExists _; iFrame. done. iMod ("Hclose2" with "[H2 H↦2]") as "[$$]". by iExists _; iFrame. done.
Qed. Qed.
Definition product := fold_right product2 unit. Definition product := foldr product2 unit.
(* Given that in practice, product will be used with concrete lists, Global Instance product_mono E L:
there should be no need to declare [Copy] and [Proper] instances Proper (Forall2 (subtype E L) ==> subtype E L) product.
for [product]. *) Proof. intros ??. induction 1. done. by simpl; f_equiv. Qed.
Global Instance product_proper E L:
Proper (Forall2 (eqtype E L) ==> eqtype E L) product.
Proof. intros ??. induction 1. done. by simpl; f_equiv. Qed.
(* FIXME : this instance is never going to be used, because Forall is
not a typeclass. *)
Global Instance product_copy tys : Forall Copy tys Copy (product tys).
Proof. induction 1; apply _. Qed.
End product. End product.
Arguments product : simpl never. Arguments product : simpl never.
...@@ -122,71 +138,59 @@ Notation Π := product. ...@@ -122,71 +138,59 @@ Notation Π := product.
Section typing. Section typing.
Context `{typeG Σ}. Context `{typeG Σ}.
(* FIXME : do we still need this (flattening and unflattening)? *) Global Instance prod2_assoc E L : Assoc (eqtype E L) product2.
Lemma ty_incl_prod2_assoc1 ρ ty1 ty2 ty3 :
ty_incl ρ (product2 ty1 (product2 ty2 ty3)) (product2 (product2 ty1 ty2) ty3).
Proof. Proof.
iIntros (tid) "_ _!>". iSplit; iIntros "!#/=*H". split; (split; simpl; [by rewrite assoc| |]; intros; iIntros "_ _ _ H").
- iDestruct "H" as (vl1 vl') "(% & Ho1 & H)". - iDestruct "H" as (vl1 vl') "(% & Ho1 & H)".
iDestruct "H" as (vl2 vl3) "(% & Ho2 & Ho3)". subst. iDestruct "H" as (vl2 vl3) "(% & Ho2 & Ho3)". subst.
iExists _, _. iSplit. by rewrite assoc. iFrame. iExists _, _. by iFrame. iExists _, _. iSplit. by rewrite assoc. iFrame. iExists _, _. by iFrame.
- iDestruct "H" as (E1 E2') "(% & Hs1 & H)". - iDestruct "H" as (E1 E2') "(% & Hs1 & H)".
iDestruct "H" as (E2 E3) "(% & Hs2 & Hs3)". rewrite shift_loc_assoc_nat. iDestruct "H" as (E2 E3) "(% & Hs2 & Hs3)". rewrite shift_loc_assoc_nat.
iSplit; last by rewrite assoc.
iExists (E1 E2), E3. iSplit. by iPureIntro; set_solver. iFrame. iExists (E1 E2), E3. iSplit. by iPureIntro; set_solver. iFrame.
iExists E1, E2. iSplit. by iPureIntro; set_solver. by iFrame. iExists E1, E2. iSplit. by iPureIntro; set_solver. by iFrame.
Qed.
Lemma ty_incl_prod2_assoc2 ρ ty1 ty2 ty3 :
ty_incl ρ (product2 (product2 ty1 ty2) ty3) (product2 ty1 (product2 ty2 ty3)).
Proof.
iIntros (tid) "_ _!>". iSplit; iIntros "!#/=*H".
- iDestruct "H" as (vl1 vl') "(% & H & Ho3)". - iDestruct "H" as (vl1 vl') "(% & H & Ho3)".
iDestruct "H" as (vl2 vl3) "(% & Ho1 & Ho2)". subst. iDestruct "H" as (vl2 vl3) "(% & Ho1 & Ho2)". subst.
iExists _, _. iSplit. by rewrite -assoc. iFrame. iExists _, _. by iFrame. iExists _, _. iSplit. by rewrite -assoc. iFrame. iExists _, _. by iFrame.
- iDestruct "H" as (E1' E3) "(% & H & Hs3)". - iDestruct "H" as (E1' E3) "(% & H & Hs3)".
iDestruct "H" as (E1 E2) "(% & Hs1 & Hs2)". rewrite shift_loc_assoc_nat. iDestruct "H" as (E1 E2) "(% & Hs1 & Hs2)". rewrite shift_loc_assoc_nat.
iSplit; last by rewrite assoc.
iExists E1, (E2 E3). iSplit. by iPureIntro; set_solver. iFrame. iExists E1, (E2 E3). iSplit. by iPureIntro; set_solver. iFrame.
iExists E2, E3. iSplit. by iPureIntro; set_solver. by iFrame. iExists E2, E3. iSplit. by iPureIntro; set_solver. by iFrame.
Qed. Qed.
(* Global Instance prod2_unit_leftid E L : LeftId (eqtype E L) unit product2.
Lemma ty_incl_prod_flatten ρ tyl1 tyl2 tyl3 :
ty_incl ρ (Π(tyl1 ++ Π tyl2 :: tyl3))
(Π(tyl1 ++ tyl2 ++ tyl3)).
Proof. Proof.
(* apply (ty_incl_weaken _ ⊤). apply perm_incl_top. *) intros ty. split; (split; [done| |]); intros; iIntros "#LFT _ _ H".
(* induction tyl1; last by apply (ty_incl_prod2 _ _ _ _ _ _). *) - iDestruct "H" as (? ?) "(% & % & ?)". by subst.
(* induction tyl2 as [|ty tyl2 IH]; simpl. *) - iDestruct "H" as (? ?) "(% & ? & ?)". rewrite shift_loc_0.
(* - iIntros (tid) "#LFT _". iSplitL; iIntros "/=!>!#*H". *) iApply (ty_shr_mono with "LFT []"); last done. set_solver. iApply lft_incl_refl.
(* + iDestruct "H" as (vl1 vl2) "(% & % & Ho)". subst. done. *) - iExists [], _. eauto.
(* + iDestruct "H" as (E1 E2) "(% & H1 & Ho)". iSplit; last done. *) - iExists , F. rewrite shift_loc_0. iFrame. by iPureIntro; set_solver.
(* rewrite shift_loc_0. iApply (ty_shr_mono with "LFT [] Ho"). set_solver. *) Qed.
(* iApply lft_incl_refl. *)
(* - etransitivity. apply ty_incl_prod2_assoc2. *) Global Instance prod2_unit_rightid E L : RightId (eqtype E L) unit product2.
(* eapply (ty_incl_prod2 _ _ _ _ _ _). done. apply IH. *)
(* Qed. *)
Lemma ty_incl_prod_unflatten ρ tyl1 tyl2 tyl3 :
ty_incl ρ (Π(tyl1 ++ tyl2 ++ tyl3))
(Π(tyl1 ++ Π tyl2 :: tyl3)).
Proof. Proof.
(* apply (ty_incl_weaken _ ⊤). apply perm_incl_top. *) intros ty. split; (split; [by rewrite /= -plus_n_O| |]); intros; iIntros "#LFT _ _ H".
(* induction tyl1; last by apply (ty_incl_prod2 _ _ _ _ _ _). *) - iDestruct "H" as (? ?) "(% & ? & %)". subst. by rewrite app_nil_r.
(* induction tyl2 as [|ty tyl2 IH]; simpl. *) - iDestruct "H" as (? ?) "(% & ? & _)".
(* - iIntros (tid) "#LFT _". iMod (bor_create with "LFT []") as "[Hbor _]". *) iApply (ty_shr_mono with "LFT []"); last done. set_solver. iApply lft_incl_refl.
(* done. instantiate (1:=True%I). by auto. instantiate (1:=static). *) - iExists _, []. rewrite app_nil_r. eauto.
(* iMod (bor_fracture (λ _, True%I) with "LFT Hbor") as "#Hbor". done. *) - iExists F, ∅. iFrame. by iPureIntro; set_solver.
(* iSplitL; iIntros "/=!>!#*H". *) Qed.
(* + iExists [], vl. iFrame. auto. *)
(* + iSplit; last done. iExists ∅, E. iSplit. iPureIntro; set_solver. *) Lemma eqtype_prod_flatten E L tyl1 tyl2 tyl3 :
(* rewrite shift_loc_0. iFrame. iExists []. iSplit; last auto. *) eqtype E L (Π(tyl1 ++ Π tyl2 :: tyl3)) (Π(tyl1 ++ tyl2 ++ tyl3)).
(* setoid_rewrite heap_mapsto_vec_nil. *) Proof.
(* iApply (frac_bor_shorten with "[] Hbor"). iApply lft_incl_static. *) unfold product. induction tyl1; simpl; last by f_equiv.
(* - etransitivity; last apply ty_incl_prod2_assoc1. *) induction tyl2. by rewrite left_id. by rewrite /= -assoc; f_equiv.
(* eapply (ty_incl_prod2 _ _ _ _ _ _). done. apply IH. *) Qed.
(* Qed. *)
*) Lemma eqtype_prod_nil_flatten E L tyl1 tyl2 :
eqtype E L (Π(Π tyl1 :: tyl2)) (Π(tyl1 ++ tyl2)).
Proof. apply (eqtype_prod_flatten _ _ []). Qed.
Lemma eqtype_prod_flatten_nil E L tyl1 tyl2 :
eqtype E L (Π(tyl1 ++ [Π tyl2])) (Π(tyl1 ++ tyl2)).
Proof. by rewrite (eqtype_prod_flatten E L tyl1 tyl2 []) app_nil_r. Qed.
Lemma eqtype_prod_app E L tyl1 tyl2 :
eqtype E L (Π[Π tyl1; Π tyl2]) (Π(tyl1 ++ tyl2)).
Proof. by rewrite -eqtype_prod_flatten_nil -eqtype_prod_nil_flatten. Qed.
End typing. End typing.
...@@ -8,8 +8,7 @@ Section shr_bor. ...@@ -8,8 +8,7 @@ Section shr_bor.
Context `{typeG Σ}. Context `{typeG Σ}.
Program Definition shr_bor (κ : lft) (ty : type) : type := Program Definition shr_bor (κ : lft) (ty : type) : type :=
{| st_size := 1; {| st_own tid vl :=
st_own tid vl :=
( (l:loc), vl = [ #l ] ty.(ty_shr) κ tid (lrustN) l)%I |}. ( (l:loc), vl = [ #l ] ty.(ty_shr) κ tid (lrustN) l)%I |}.
Next Obligation. Next Obligation.
iIntros (κ ty tid vl) "H". iDestruct "H" as (l) "[% _]". by subst. iIntros (κ ty tid vl) "H". iDestruct "H" as (l) "[% _]". by subst.
...@@ -18,7 +17,7 @@ Section shr_bor. ...@@ -18,7 +17,7 @@ Section shr_bor.
Global Instance subtype_shr_bor_mono E L : Global Instance subtype_shr_bor_mono E L :
Proper (lctx_lft_incl E L --> subtype E L ==> subtype E L) shr_bor. Proper (lctx_lft_incl E L --> subtype E L ==> subtype E L) shr_bor.
Proof. Proof.
intros κ1 κ2 ty1 ty2 Hty. apply subtype_simple_type. done. intros κ1 κ2 ty1 ty2 Hty. apply subtype_simple_type.
iIntros (??) "#LFT #HE #HL H". iDestruct ( with "HE HL") as "#Hκ". iIntros (??) "#LFT #HE #HL H". iDestruct ( with "HE HL") as "#Hκ".
iDestruct "H" as (l) "(% & H)". subst. iExists _. iSplit. done. iDestruct "H" as (l) "(% & H)". subst. iExists _. iSplit. done.
iApply (ty2.(ty_shr_mono) with "LFT Hκ"). reflexivity. iApply (ty2.(ty_shr_mono) with "LFT Hκ"). reflexivity.
......
...@@ -6,7 +6,7 @@ From lrust.typing Require Import type_incl. ...@@ -6,7 +6,7 @@ From lrust.typing Require Import type_incl.
Section sum. Section sum.
Context `{typeG Σ}. Context `{typeG Σ}.
Program Definition emp : type := {| st_size := 0; st_own tid vl := False%I |}. Program Definition emp : type := {| st_own tid vl := False%I |}.
Next Obligation. iIntros (tid vl) "[]". Qed. Next Obligation. iIntros (tid vl) "[]". Qed.
Global Instance emp_empty : Empty type := emp. Global Instance emp_empty : Empty type := emp.
...@@ -101,7 +101,6 @@ Existing Instance LstTySize_nil. ...@@ -101,7 +101,6 @@ Existing Instance LstTySize_nil.
Hint Extern 1 (LstTySize _ (_ :: _)) => Hint Extern 1 (LstTySize _ (_ :: _)) =>
apply LstTySize_cons; [compute; reflexivity|] : typeclass_instances. apply LstTySize_cons; [compute; reflexivity|] : typeclass_instances.
(* Σ is commonly used for the current functor. So it cannot be defined (* Σ is commonly used for the current functor. So it cannot be defined
as Π for products. We stick to the following form. *) as Π for products. We stick to the following form. *)
Notation "Σ[ ty1 ; .. ; tyn ]" := Notation "Σ[ ty1 ; .. ; tyn ]" :=
......
...@@ -56,16 +56,15 @@ Section type. ...@@ -56,16 +56,15 @@ Section type.
that simple_type does depend on it. Otherwise, the coercion defined that simple_type does depend on it. Otherwise, the coercion defined
bellow will not be acceptable by Coq. *) bellow will not be acceptable by Coq. *)
Record simple_type `{typeG Σ} := Record simple_type `{typeG Σ} :=
{ st_size : nat; { st_own : thread_id list val iProp Σ;
st_own : thread_id list val iProp Σ;
st_size_eq tid vl : st_own tid vl -∗ length vl = st_size; st_size_eq tid vl : st_own tid vl -∗ length vl = 1%nat;
st_own_persistent tid vl : PersistentP (st_own tid vl) }. st_own_persistent tid vl : PersistentP (st_own tid vl) }.
Global Existing Instance st_own_persistent. Global Existing Instance st_own_persistent.
Program Definition ty_of_st (st : simple_type) : type := Program Definition ty_of_st (st : simple_type) : type :=
{| ty_size := st.(st_size); ty_own := st.(st_own); {| ty_size := 1; ty_own := st.(st_own);
(* [st.(st_own) tid vl] needs to be outside of the fractured (* [st.(st_own) tid vl] needs to be outside of the fractured
borrow, otherwise I do not know how to prove the shr part of borrow, otherwise I do not know how to prove the shr part of
...@@ -168,12 +167,11 @@ Qed. ...@@ -168,12 +167,11 @@ Qed.
Qed. Qed.
Lemma subtype_simple_type (st1 st2 : simple_type) : Lemma subtype_simple_type (st1 st2 : simple_type) :
st1.(st_size) = st2.(st_size)
( tid vl, lft_ctx -∗ elctx_interp_0 E -∗ llctx_interp_0 L -∗ ( tid vl, lft_ctx -∗ elctx_interp_0 E -∗ llctx_interp_0 L -∗
st1.(st_own) tid vl -∗ st2.(st_own) tid vl) st1.(st_own) tid vl -∗ st2.(st_own) tid vl)
subtype st1 st2. subtype st1 st2.
Proof. Proof.
intros Hsz Hst. iIntros. iSplit; first done. iSplit; iAlways. intros Hst. iIntros. iSplit; first done. iSplit; iAlways.
- iIntros. iApply (Hst with "* [] [] []"); done. - iIntros. iApply (Hst with "* [] [] []"); done.
- iIntros (????) "H". - iIntros (????) "H".
iDestruct "H" as (vl) "[Hf [Hown|H†]]"; iExists vl; iFrame "Hf"; last by auto. iDestruct "H" as (vl) "[Hf [Hown|H†]]"; iExists vl; iFrame "Hf"; last by auto.
......
From lrust.typing Require Export type.
From lrust.typing Require Import product.
Section uninit.
Context `{typeG Σ}.
Program Definition uninit_1 : type :=
{| st_own tid vl := length vl = 1%nat⌝%I |}.
Next Obligation. done. Qed.
Definition uninit (n : nat) : type :=
Π (replicate n uninit_1).
Global Instance uninit_copy n : Copy (uninit n).
Proof. apply product_copy, Forall_replicate, _. Qed.
Lemma uninit_sz n : ty_size (uninit n) = n.
Proof. induction n. done. simpl. by f_equal. Qed.
Lemma eqtype_uninit_product E L ns :
eqtype E L (uninit (foldr plus 0%nat ns)) (Π(uninit <$> ns)).
Proof.
induction ns as [|n ns IH]. done. revert IH.
by rewrite /= /uninit replicate_plus eqtype_prod_nil_flatten -!eqtype_prod_app=>->.
Qed.
End uninit.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment