Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
cd40e1f
Start changing stateLang semantics for new thunks
myreen Dec 3, 2024
bc9103f
Propagate changes in stateLangScript and update state_app_unit_ProofS…
nikos-alexandris Dec 12, 2024
c374a42
Update proofs. unthunk remains
nikos-alexandris Dec 12, 2024
92a07bc
Added thunk app primitives to state lang. Proofs need fixing
nikos-alexandris Dec 17, 2024
be5ce29
Fixed proofs and minor style inconsintencies of previous commits. One…
nikos-alexandris Dec 29, 2024
506feb1
Update `binary/pure_backendProgScript`
nikos-alexandris Dec 30, 2024
109ed6a
Fix force semantics and env to ns mapping
nikos-alexandris Jan 7, 2025
399be8e
Changed force semantics to apply function directly instead of going t…
nikos-alexandris Jan 10, 2025
1206254
Changed `measureInduct`s to `application_ind`s
nikos-alexandris Jan 12, 2025
46c63f6
Remove two cheats, but add many more
myreen Jan 15, 2025
a292862
Collect cheats in stateLangTheory
myreen Jan 15, 2025
2099638
Finish my part of state_unthunkProof
myreen Jan 15, 2025
425b421
Hacking during meeting
myreen Jan 17, 2025
9849cc8
Assert thunkLang Force doesn't produce thunks.
nikos-alexandris Feb 14, 2025
fc73f0d
box doesn't return thunk
nikos-alexandris Mar 23, 2025
3cf1bde
ForceK2 and BoxK don't return thunks
nikos-alexandris Mar 23, 2025
b1848e9
ForceK2 and BoxK don't return thunks
nikos-alexandris Mar 23, 2025
9a46498
fix env_to_state proof
nikos-alexandris Mar 23, 2025
37b6ce2
This commit comes after adding the check in the `thunkLang` semantics…
nikos-alexandris Apr 16, 2025
ae71b07
Proved a cheat in stateLangScript and removed `rec_env` as a duplicat…
nikos-alexandris Apr 20, 2025
b2dcc52
Proved remaining cheats in stateLangScript
nikos-alexandris Apr 21, 2025
2876a6a
Fixed `Delay_Lam` and `Let_Delay_Var` proofs
nikos-alexandris Apr 26, 2025
d71769a
Merge remote-tracking branch 'origin/master' into cake-thunks.
nikos-alexandris Apr 28, 2025
98c22f0
Merged master and updated HOL version.
nikos-alexandris Apr 28, 2025
c99346a
Fixed state-to-cake pass to account for the new thunk representation in
nikos-alexandris Apr 29, 2025
7072877
Merge remote-tracking branch 'origin/master' into cake-thunks
nikos-alexandris May 13, 2025
e7a1436
Merge remote-tracking branch 'origin/master' into cake-thunks
nikos-alexandris Aug 20, 2025
0b050f7
Update for HOL changes
nikos-alexandris Aug 20, 2025
809efe5
Merge remote-tracking branch 'origin/master' into cake-thunks
nikos-alexandris Aug 26, 2025
0d6a3a1
Small fix after master merge
nikos-alexandris Aug 26, 2025
f446cb7
Fixed `thunk_Let_Lam_ForceTheory` for force changes
nikos-alexandris Aug 26, 2025
bbf5d05
Fix `thunk_case_inl` and `thunk_remove_unuseful_bindings`
nikos-alexandris Aug 27, 2025
6379781
thunk_case_d2b
nikos-alexandris Aug 27, 2025
c0b9022
Fixes for HOL changes
nikos-alexandris Aug 31, 2025
54a5d98
Remove recursion of `application` stateLang
hrutvik Feb 14, 2025
3e75245
Delete various unused stateLang theorems
hrutvik Feb 14, 2025
a25e5ee
Update remaining stateLang proofs
hrutvik Aug 30, 2025
3e3da89
Merge remote-tracking branch 'origin/master' into cake-thunks
nikos-alexandris Sep 17, 2025
82b2859
Update for change in name of while theory
nikos-alexandris Sep 25, 2025
67794aa
Merge remote-tracking branch 'origin/master' into cake-thunks
nikos-alexandris Sep 26, 2025
41de570
Fixes for theory syntax
nikos-alexandris Sep 26, 2025
a6dbd3f
Fixes for theory syntax
nikos-alexandris Sep 26, 2025
d772e07
Added missing check in `ForceMutK` in `stateLang` to fix
nikos-alexandris Sep 26, 2025
cc14d6e
Fixes for `state_unthunk`
nikos-alexandris Oct 10, 2025
2e87106
Fix stateLang
nikos-alexandris Oct 20, 2025
94a0e59
Cheated broken unused thunk proofs
nikos-alexandris Oct 20, 2025
8ec4058
Leave unused proofs cheated
nikos-alexandris Oct 23, 2025
07943e5
Add `check_thm` to top level correctness theorem
nikos-alexandris Oct 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions compiler/backend/languages/semantics/envLangScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ Definition dest_anyThunk_def:
od
End

Definition is_anyThunk_def:
is_anyThunk v = (∃tv. dest_anyThunk v = INR tv)
End

Definition dest_Constructor_def[simp]:
dest_Constructor (Constructor s vs) = return (s, vs) ∧
dest_Constructor _ = fail Type_error
Expand Down Expand Up @@ -243,7 +247,7 @@ Definition eval_to_def:
eval_to k env (Box x) =
(do
v <- eval_to k env x;
return (Thunk (INL v))
if is_anyThunk v then fail Type_error else return (Thunk (INL v))
od) ∧
eval_to k env (Force x) =
(if k = 0 then fail Diverge else
Expand All @@ -252,14 +256,21 @@ Definition eval_to_def:
(wx, binds) <- dest_anyThunk v;
case wx of
INL v => return v
| INR (env, y) => eval_to (k - 1) (mk_rec_env binds env) y
| INR (env, y) =>
do
res <- eval_to (k - 1) (mk_rec_env binds env) y;
if is_anyThunk res then fail Type_error else return res
od
od) ∧
eval_to k env (Prim op xs) =
(case op of
Cons s =>
do
vs <- result_map (λx. eval_to k env x) xs;
return (Constructor s vs)
if EVERY is_anyThunk vs then
return (Constructor s vs)
else
fail Type_error
od
| If => fail Type_error
| Seq => fail Type_error
Expand Down Expand Up @@ -366,7 +377,8 @@ Proof
\\ Cases_on ‘dest_anyThunk y’ \\ gs []
\\ pairarg_tac \\ gvs []
\\ BasicProvers.TOP_CASE_TAC \\ gs []
\\ BasicProvers.TOP_CASE_TAC \\ gs [])
\\ BasicProvers.TOP_CASE_TAC \\ gs []
\\ simp [oneline sum_bind_def] \\ rpt (CASE_TAC \\ rw []) \\ gvs [])
>- ((* Prim *)
dsimp []
\\ strip_tac
Expand All @@ -387,7 +399,17 @@ Proof
\\ rw [] \\ gs [])
\\ fs [DECIDE “A ⇒ ¬MEM a b ⇔ MEM a b ⇒ ¬A”]
\\ IF_CASES_TAC \\ gs []
\\ rw [MAP_MAP_o, combinTheory.o_DEF, MAP_EQ_f])
\\ rw [MAP_MAP_o, combinTheory.o_DEF, MAP_EQ_f]
\\ (
gvs [EVERY_EL, EL_MAP, EXISTS_MEM, MEM_MAP, MEM_EL]
\\ first_x_assum $ drule_then assume_tac \\ gvs []
\\ rpt (first_x_assum $ qspec_then ‘EL n xs’ assume_tac) \\ gvs []
\\ pop_assum $ drule_at_then Any assume_tac \\ gvs []
\\ rpt (
qpat_x_assum ‘_ ⇒ _’ mp_tac \\ impl_tac >- (qexists ‘n’ \\ simp [])
\\ strip_tac)
\\ Cases_on ‘eval_to k env (EL n xs)’
\\ Cases_on ‘eval_to j env (EL n xs)’ \\ gvs []))
>- ((* IsEq *)
gvs [LENGTH_EQ_NUM_compute]
\\ rename1 ‘eval_to (k - 1) env x’
Expand Down
Loading