-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1156 from andrew-johnson-4/implied-types
Implied types
- Loading branch information
Showing
18 changed files
with
22,293 additions
and
21,695 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "lambda_mountain" | ||
version = "1.20.42" | ||
version = "1.20.43" | ||
authors = ["Andrew <[email protected]>"] | ||
license = "MIT" | ||
description = "Typed Macro Assembler (backed by Coq proofs-of-correctness)" | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
|
||
type Bool is U64; | ||
|
||
let true = 1; | ||
let false = 0; |
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
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,25 @@ | ||
|
||
let denormalize-arrow(pt: Type): Type = ( | ||
match pt { | ||
TAnd{ left=left, right=right } => denormalize-arrow(left) && denormalize-arrow(right); | ||
TGround{tag:c"Arrow", parameters:[rng.. dom..]} => ( | ||
t3( c"Arrow", denormalize-cons(dom), rng ) | ||
); | ||
TGround{tag:c"Array", parameters:[rng.. dom..]} => ( | ||
t3( c"Array", denormalize-arrow(dom), rng ) | ||
); | ||
TGround{} => denormalize(pt); | ||
_ => pt; | ||
} | ||
); | ||
|
||
let denormalize-cons(pt: Type): Type = ( | ||
match pt { | ||
TAnd{ left=left, right=right } => denormalize-cons(left) && denormalize-cons(right); | ||
TGround{tag:c"Cons", parameters:[rng.. dom..]} => ( | ||
t3( c"Cons", denormalize-cons(dom), denormalize-cons(rng) ) | ||
); | ||
TGround{} => denormalize(pt); | ||
_ => pt; | ||
} | ||
); |
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
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
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 |
---|---|---|
@@ -1,50 +1,55 @@ | ||
|
||
reduce-plural := λ(: pts List<Type>). (: ( | ||
(let r (: LEOF List<Type>)) | ||
reduce-plural := λ(: dpts List<Type>). (: ( | ||
(let pts (: LEOF List<Tuple<Type,Type>>)) | ||
(for-each (pt in dpts) ( | ||
(set pts (cons( (Tuple( (denormalize-arrow pt) pt )) pts ))) | ||
)) | ||
(set pts (.reverse pts)) | ||
(let r (: LEOF List<Tuple<Type,Type>>)) | ||
(let maybe-constructor pts) | ||
(while (non-zero maybe-constructor) (match maybe-constructor ( | ||
() | ||
( (LCons( try tlt )) ( | ||
( (LCons( (Tuple( try-denormal try )) tlt )) ( | ||
(if (is-constructor try) ( | ||
(set r (cons( try r ))) | ||
(set r (cons( (Tuple( try-denormal try )) r ))) | ||
) ()) | ||
(set maybe-constructor tlt) | ||
)) | ||
))) | ||
(if (non-zero r) (set pts (: LEOF List<Type>)) ()) | ||
(if (non-zero r) (set pts (: LEOF List<Tuple<Type,Type>>)) ()) | ||
(while (non-zero pts) (match pts ( | ||
() | ||
( (LCons( try tlt )) ( | ||
( (LCons( (Tuple( try-denormal try )) tlt )) ( | ||
(set pts tlt) | ||
(for-each (tst in tlt) ( | ||
(for-each ((Tuple( tst-denormal tst )) in tlt) ( | ||
(if (non-zero try) ( | ||
(if (can-unify( (.domain try) (.domain tst) )) ( | ||
(if (can-unify( (.domain try-denormal) (.domain tst-denormal) )) ( | ||
(set try TAny) | ||
) ()) | ||
) ()) | ||
)) | ||
(if (non-zero try) ( | ||
(set r (cons( try r ))) | ||
(set r (cons( (Tuple( try-denormal try )) r ))) | ||
) ()) | ||
)) | ||
))) | ||
(set pts r) | ||
(set r (: LEOF List<Type>)) | ||
(let return (: LEOF List<Type>)) | ||
(while (non-zero pts) (match pts ( | ||
() | ||
( (LCons( try tlt )) ( | ||
( (LCons( (Tuple( try-denormal try )) tlt )) ( | ||
(set pts tlt) | ||
(for-each (tst in tlt) ( | ||
(for-each ((Tuple( tst-denormal tst )) in tlt) ( | ||
(if (non-zero try) ( | ||
(if (can-unify( (.domain try) (.domain tst) )) ( | ||
(if (can-unify( (.domain try-denormal) (.domain tst-denormal) )) ( | ||
(set try TAny) | ||
) ()) | ||
) ()) | ||
)) | ||
(if (non-zero try) ( | ||
(set r (cons( try r ))) | ||
(set return (cons( try return ))) | ||
) ()) | ||
)) | ||
))) | ||
r | ||
return | ||
) List<Type>); |
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,15 @@ | ||
|
||
let remove-info(base: Type, rm: Type): Type = ( | ||
match base { | ||
TAnd{ left=left, right=right } => ( | ||
let new-left = remove-info(left, rm); | ||
let new-right = remove-info(right, rm); | ||
if is(left,new-left) && is(right,new-right) then base | ||
else (left && right); | ||
); | ||
TGround{} => ( | ||
if can-unify(rm,base) then TAny else base | ||
); | ||
_ => base; | ||
} | ||
); |
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 |
---|---|---|
|
@@ -15,3 +15,4 @@ import SRC/tctx-and.lm; | |
|
||
# corollaries | ||
import SRC/quick-prop.lsts; | ||
import SRC/remove-info.lsts; |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
2233 | ||
2223331221 |