-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement type checker * Clean up type checker impl * Remove get_subterms_of_pi_nf
- Loading branch information
Showing
5 changed files
with
447 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From Coq Require Extraction. | ||
|
||
(* We cannot use class based generalization for | ||
the following definitions as Coq does not support | ||
polymorphism across [Prop] and [Set] *) | ||
|
||
Definition sumbool_failable_bind {A B} (ab : {A} + {B}) {C D : Prop} (fail : B -> D) (next : A -> {C} + {D}) := | ||
match ab with | ||
| left a => next a | ||
| right b => right (fail b) | ||
end. | ||
Transparent sumbool_failable_bind. | ||
Arguments sumbool_failable_bind /. | ||
|
||
Notation "'let*b' a ':=' ab 'while' fail 'in' next" := (sumbool_failable_bind ab fail (fun a => next)) (at level 0, a pattern, next at level 10, right associativity, only parsing). | ||
Notation "'pureb' a" := (left a) (at level 0, only parsing). | ||
|
||
Definition sumor_failable_bind {A B} (ab : A + {B}) {C} {D : Prop} (fail : B -> D) (next : A -> C + {D}) := | ||
match ab with | ||
| inleft a => next a | ||
| inright b => inright (fail b) | ||
end. | ||
Transparent sumor_failable_bind. | ||
Arguments sumor_failable_bind /. | ||
|
||
Notation "'let*o' a ':=' ab 'while' fail 'in' next" := (sumor_failable_bind ab fail (fun a => next)) (at level 0, a pattern, next at level 10, right associativity, only parsing). | ||
Notation "'pureo' a" := (inleft a) (at level 0, only parsing). | ||
|
||
Definition sumbool_sumor_failable_bind {A B} (ab : {A} + {B}) {C} {D : Prop} (fail : B -> D) (next : A -> C + {D}) := | ||
match ab with | ||
| left a => next a | ||
| right b => inright (fail b) | ||
end. | ||
Transparent sumbool_sumor_failable_bind. | ||
Arguments sumbool_sumor_failable_bind /. | ||
|
||
Notation "'let*b->o' a ':=' ab 'while' fail 'in' next" := (sumbool_sumor_failable_bind ab fail (fun a => next)) (at level 0, a pattern, next at level 10, right associativity, only parsing). | ||
|
||
Definition sumor_sumbool_failable_bind {A B} (ab : A + {B}) {C} {D : Prop} (fail : B -> D) (next : A -> {C} + {D}) := | ||
match ab with | ||
| inleft a => next a | ||
| inright b => right (fail b) | ||
end. | ||
Transparent sumor_sumbool_failable_bind. | ||
Arguments sumor_sumbool_failable_bind /. | ||
|
||
Notation "'let*o->b' a ':=' ab 'while' fail 'in' next" := (sumor_sumbool_failable_bind ab fail (fun a => next)) (at level 0, a pattern, next at level 10, right associativity, only parsing). | ||
|
||
Extraction Inline sumbool_failable_bind sumor_failable_bind sumbool_sumor_failable_bind sumor_sumbool_failable_bind. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.