├── .holpath ├── profiler ├── profiler_test.txt ├── readmePrefix ├── README.md └── Holmakefile ├── pancake ├── temp │ └── README.md ├── parser │ ├── readmePrefix │ └── README.md ├── proofs │ └── readmePrefix ├── static_checker │ ├── readmePrefix │ ├── README.md │ └── Holmakefile ├── semantics │ └── readmePrefix ├── readmePrefix ├── pan_commonScript.sml └── pan_to_wordScript.sml ├── compiler ├── bootstrap │ ├── compilation │ │ ├── ag32 │ │ │ ├── 32 │ │ │ │ ├── Makefile │ │ │ │ ├── proofs │ │ │ │ │ ├── readmePrefix │ │ │ │ │ └── README.md │ │ │ │ ├── readmePrefix │ │ │ │ └── ag32BootstrapScript.sml │ │ │ └── README.md │ │ ├── arm8 │ │ │ ├── 64 │ │ │ │ ├── Makefile │ │ │ │ ├── hello.cml │ │ │ │ ├── how-to.md │ │ │ │ ├── basis_ffi.c │ │ │ │ ├── proofs │ │ │ │ │ ├── readmePrefix │ │ │ │ │ └── README.md │ │ │ │ ├── readmePrefix │ │ │ │ └── arm8BootstrapScript.sml │ │ │ ├── hello.cml │ │ │ └── README.md │ │ ├── x64 │ │ │ ├── 32 │ │ │ │ ├── Makefile │ │ │ │ ├── hello.cml │ │ │ │ ├── how-to.md │ │ │ │ ├── basis_ffi.c │ │ │ │ ├── proofs │ │ │ │ │ ├── readmePrefix │ │ │ │ │ └── README.md │ │ │ │ ├── readmePrefix │ │ │ │ └── x64BootstrapScript.sml │ │ │ ├── 64 │ │ │ │ ├── Makefile │ │ │ │ ├── hello.cml │ │ │ │ ├── how-to.md │ │ │ │ ├── basis_ffi.c │ │ │ │ ├── repl_boot.cml │ │ │ │ ├── candle_boot.ml │ │ │ │ ├── candle_records.ml │ │ │ │ ├── proofs │ │ │ │ │ ├── readmePrefix │ │ │ │ │ └── README.md │ │ │ │ ├── test-hello.cml │ │ │ │ ├── readmePrefix │ │ │ │ └── sexprBootstrap32Script.sml │ │ │ ├── hello.cml │ │ │ └── README.md │ │ ├── .gitignore │ │ └── README.md │ ├── README.md │ └── translation │ │ └── readmePrefix ├── dafny │ ├── examples │ │ ├── empty_main.dfy │ │ ├── output │ │ │ ├── .gitignore │ │ │ └── README.md │ │ ├── assert.dfy │ │ ├── just_hello.dfy │ │ ├── .gitignore │ │ ├── function_call.dfy │ │ ├── plus_one.dfy │ │ ├── abs.dfy │ │ ├── add_one_n_times.dfy │ │ ├── is_even.dfy │ │ ├── mccarthy.dfy │ │ └── sum_to_n.dfy │ ├── semantics │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── compilation │ │ ├── .gitignore │ │ ├── readmePrefix │ │ ├── README.md │ │ └── dafny_compilerCompileScript.sml │ ├── proofs │ │ └── readmePrefix │ ├── readmePrefix │ ├── translation │ │ ├── readmePrefix │ │ ├── cakeml_astProgScript.sml │ │ ├── dafny_astProgScript.sml │ │ ├── dafny_remove_assertProgScript.sml │ │ ├── Holmakefile │ │ └── result_monadProgScript.sml │ ├── vcg │ │ ├── readmePrefix │ │ ├── examples │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── README.md │ │ └── Holmakefile │ └── dafny_miscScript.sml ├── backend │ ├── readmePrefix │ ├── San │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── x64 │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── ag32 │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ └── ag32_decompilerLib.sig │ │ ├── readmePrefix │ │ ├── Holmakefile │ │ └── export_ag32Script.sml │ ├── arm7 │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── arm8 │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── mips │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── pattern_matching │ │ ├── readmePrefix │ │ ├── Holmakefile │ │ └── README.md │ ├── riscv │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── serialiser │ │ ├── readmePrefix │ │ ├── Holmakefile │ │ └── README.md │ ├── gc │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── cv_compute │ │ ├── readmePrefix │ │ ├── backend_asmLib.sig │ │ ├── backend_x64Script.sml │ │ ├── backend_ag32Script.sml │ │ ├── backend_arm7Script.sml │ │ ├── backend_arm8Script.sml │ │ ├── backend_mipsScript.sml │ │ ├── backend_riscvScript.sml │ │ └── Holmakefile │ ├── arm8_asl │ │ ├── readmePrefix │ │ └── README.md │ ├── proofs │ │ └── readmePrefix │ ├── reg_alloc │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── semantics │ │ └── readmePrefix │ ├── source_to_sourceScript.sml │ └── presLangLib.sig ├── scheme │ ├── readmePrefix │ ├── proofs │ │ └── readmePrefix │ ├── examples │ │ ├── print.scm │ │ ├── README.md │ │ ├── tailfib.scm │ │ ├── basis_scheme.c │ │ ├── facimp.scm │ │ └── fib.scm │ ├── translation │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── compilation │ │ ├── readmePrefix │ │ ├── README.md │ │ ├── scheme_compilerCompileScript.sml │ │ └── Holmakefile │ └── unverified │ │ └── README.md ├── parsing │ ├── tests │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── proofs │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── ocaml │ │ ├── readmePrefix │ │ ├── Holmakefile │ │ └── README.md │ └── Holmakefile ├── proofs │ ├── readmePrefix │ └── README.md ├── benchmarks │ ├── readmePrefix │ ├── cakeml_benchmarks │ │ ├── cakeml │ │ │ ├── basis_ffi.c │ │ │ ├── Makefile │ │ │ ├── readmePrefix │ │ │ └── Holmakefile │ │ ├── ocaml │ │ │ ├── README.md │ │ │ ├── fib.ml │ │ │ ├── foldl.ml │ │ │ ├── reverse.ml │ │ │ └── Makefile │ │ ├── sml │ │ │ ├── README.md │ │ │ ├── fib.sml │ │ │ └── foldl.sml │ │ ├── README.md │ │ └── run_all.sh │ ├── mlton_benchmarks │ │ ├── cakeml │ │ │ ├── basis_ffi.c │ │ │ ├── Makefile │ │ │ ├── readmePrefix │ │ │ ├── tak.cml │ │ │ └── Holmakefile │ │ ├── README.md │ │ └── sml │ │ │ ├── README.md │ │ │ └── tak.sml │ └── README.md ├── encoders │ ├── monadic_enc │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── arm8_asl │ │ ├── readmePrefix │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ └── README.md │ │ └── README.md │ ├── README.md │ ├── ag32 │ │ ├── readmePrefix │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── ag32_targetLib.sig │ │ ├── Holmakefile │ │ └── README.md │ ├── arm7 │ │ ├── readmePrefix │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── arm7_targetLib.sig │ │ └── Holmakefile │ ├── arm8 │ │ ├── readmePrefix │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── arm8_targetLib.sig │ │ ├── README.md │ │ └── Holmakefile │ ├── mips │ │ ├── readmePrefix │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── mips_targetLib.sig │ │ ├── README.md │ │ └── Holmakefile │ ├── x64 │ │ ├── readmePrefix │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── x64_targetLib.sig │ │ ├── Holmakefile │ │ └── README.md │ ├── riscv │ │ ├── readmePrefix │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── riscv_targetLib.sig │ │ ├── README.md │ │ └── Holmakefile │ ├── tests │ │ ├── readmePrefix │ │ ├── encodeLib.sig │ │ └── README.md │ └── asm │ │ ├── readmePrefix │ │ └── Holmakefile ├── printing │ ├── test │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ └── Holmakefile ├── inference │ ├── tests │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ └── proofs │ │ ├── readmePrefix │ │ └── Holmakefile ├── repl │ └── readmePrefix └── readmePrefix ├── examples ├── compilation │ ├── .gitignore │ ├── x64 │ │ ├── wordcountCompileScript.sml │ │ ├── proofs │ │ │ ├── wordcountProofScript.sml │ │ │ └── readmePrefix │ │ ├── readmePrefix │ │ ├── catCompileScript.sml │ │ ├── diffCompileScript.sml │ │ ├── echoCompileScript.sml │ │ ├── grepCompileScript.sml │ │ ├── sortCompileScript.sml │ │ ├── helloCompileScript.sml │ │ ├── patchCompileScript.sml │ │ └── helloErrCompileScript.sml │ ├── readmePrefix │ ├── ag32 │ │ ├── readmePrefix │ │ ├── proofs │ │ │ └── readmePrefix │ │ ├── sortCompileScript.sml │ │ ├── helloCompileScript.sml │ │ ├── wordcountCompileScript.sml │ │ └── Holmakefile │ ├── README.md │ └── Holmakefile ├── splitwordsScript.sml ├── lpr_checker │ ├── readmePrefix │ ├── array │ │ ├── readmePrefix │ │ └── compilation │ │ │ ├── readmePrefix │ │ │ ├── proofs │ │ │ └── readmePrefix │ │ │ ├── proofsARM8 │ │ │ ├── readmePrefix │ │ │ └── README.md │ │ │ ├── lpr_arrayCompileARM8Script.sml │ │ │ ├── lpr_arrayPackingCompileScript.sml │ │ │ ├── lpr_arrayRamseyCompileScript.sml │ │ │ └── lpr_arrayCompileScript.sml │ └── README.md ├── opentheory │ ├── compilation │ │ ├── .gitignore │ │ ├── ag32 │ │ │ ├── readmePrefix │ │ │ ├── proofs │ │ │ │ ├── readmePrefix │ │ │ │ └── README.md │ │ │ ├── readerCompileScript.sml │ │ │ ├── README.md │ │ │ └── Holmakefile │ │ ├── proofs │ │ │ ├── readmePrefix │ │ │ └── README.md │ │ ├── readmePrefix │ │ └── README.md │ └── readmePrefix ├── wordcountProgScript.sml ├── xlrup_checker │ ├── readmePrefix │ ├── array │ │ ├── readmePrefix │ │ ├── compilation │ │ │ ├── readmePrefix │ │ │ ├── proofs │ │ │ │ ├── readmePrefix │ │ │ │ └── README.md │ │ │ ├── README.md │ │ │ └── xlrupCompileScript.sml │ │ └── README.md │ └── README.md ├── deflate │ ├── translation │ │ ├── readmePrefix │ │ ├── compilation │ │ │ ├── readmePrefix │ │ │ ├── tests │ │ │ │ ├── README.md │ │ │ │ └── chess.png │ │ │ ├── compressionCompileScript.sml │ │ │ ├── decompressionCompileScript.sml │ │ │ ├── deflateDecodeCompileScript.sml │ │ │ └── deflateEncodeCompileScript.sml │ │ └── README.md │ ├── readmePrefix │ └── Holmakefile ├── pseudo_bool │ ├── readmePrefix │ ├── graph_encoding │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── cnf_encoding │ │ ├── readmePrefix │ │ └── README.md │ └── array │ │ ├── compilation │ │ ├── readmePrefix │ │ ├── proofs │ │ │ └── readmePrefix │ │ ├── proofsARM8 │ │ │ ├── readmePrefix │ │ │ └── README.md │ │ ├── cnfCompileScript.sml │ │ ├── mcisCompileScript.sml │ │ ├── wcnfCompileScript.sml │ │ ├── mccisCompileScript.sml │ │ ├── cliqueCompileScript.sml │ │ ├── subgraph_isoCompileScript.sml │ │ └── npbc_fullCompileScript.sml │ │ └── readmePrefix ├── scpog_checker │ ├── readmePrefix │ ├── array │ │ ├── readmePrefix │ │ ├── compilation │ │ │ ├── readmePrefix │ │ │ ├── proofs │ │ │ │ ├── readmePrefix │ │ │ │ └── README.md │ │ │ └── README.md │ │ └── README.md │ └── README.md ├── vipr │ ├── compilation │ │ ├── readmePrefix │ │ ├── README.md │ │ └── viprCompileScript.sml │ ├── readmePrefix │ └── Holmakefile ├── flover │ ├── Infra │ │ ├── readmePrefix │ │ ├── FloverCompLib.sml │ │ ├── Holmakefile │ │ ├── ResultsLib.sml │ │ └── README.md │ ├── readmePrefix │ ├── semantics │ │ ├── readmePrefix │ │ └── Holmakefile │ └── Holmakefile ├── sat_encodings │ ├── demo │ │ ├── README.md │ │ ├── numBoolRangeExample.lisp │ │ ├── readmePrefix │ │ ├── graphProblem.lisp │ │ ├── sudokuExample.lisp │ │ ├── unsatSudokuExample.lisp │ │ └── killerSudokuExample.lisp │ ├── translation │ │ ├── readmePrefix │ │ └── compilation │ │ │ ├── readmePrefix │ │ │ ├── sudokuEncoderCompileScript.sml │ │ │ ├── nQueensEncoderCompileScript.sml │ │ │ ├── killerSudokuEncoderCompileScript.sml │ │ │ ├── numBoolRangeEncoderCompileScript.sml │ │ │ └── graphColoringEncoderCompileScript.sml │ ├── readmePrefix │ ├── case_studies │ │ ├── readmePrefix │ │ └── Holmakefile │ └── Holmakefile ├── template │ ├── compilation │ │ ├── readmePrefix │ │ ├── README.md │ │ └── example_funsCompileScript.sml │ ├── translation │ │ ├── readmePrefix │ │ ├── README.md │ │ └── Holmakefile │ ├── readmePrefix │ ├── example_funsScript.sml │ ├── README.md │ └── Holmakefile └── readmePrefix ├── unverified ├── front-end │ ├── .gitignore │ ├── Makefile │ ├── README.md │ └── cake_stub.sml ├── sexpr-bootstrap │ ├── x64 │ │ ├── 32 │ │ │ ├── how-to.md │ │ │ ├── basis_ffi.c │ │ │ ├── Makefile │ │ │ ├── readmePrefix │ │ │ ├── x64SexprScript.sml │ │ │ └── README.md │ │ ├── 64 │ │ │ ├── how-to.md │ │ │ ├── basis_ffi.c │ │ │ ├── Makefile │ │ │ ├── readmePrefix │ │ │ └── x64SexprScript.sml │ │ └── README.md │ ├── .gitignore │ └── README.md ├── ocaml-syntax │ ├── lib │ │ └── README.md │ ├── tests │ │ ├── boyer-patch │ │ ├── .gitignore │ │ ├── README.md │ │ ├── boyer-patch.sed │ │ ├── fib.ml │ │ └── Makefile │ ├── .ocamlinit │ ├── .gitignore │ ├── ocaml2cakeml │ └── Makefile ├── hol-light-syntax │ ├── ocaml_j │ ├── README.md │ └── Makefile ├── readmePrefix ├── reg_alloc │ └── README.md └── Holmakefile ├── developers ├── bin │ ├── .gitignore │ ├── readmePrefix │ └── README.md ├── rebuild-excludes ├── artefacts ├── build-excludes ├── readmePrefix └── wc.sh ├── tutorial ├── solutions │ ├── splitwordsScript.sml │ ├── wordfreqProofScript.sml │ ├── wordfreqCompileScript.sml │ └── readmePrefix ├── readmePrefix ├── wordfreqCompileScript.sml └── wordcountCompileScript.sml ├── translator ├── okasaki-examples │ ├── test.sh │ ├── readmePrefix │ └── Holmakefile ├── other-examples │ ├── test.sh │ ├── readmePrefix │ ├── auxiliary │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── example_91Script.sml │ ├── example_qsortScript.sml │ ├── example_regexp_matcherScript.sml │ └── Holmakefile ├── readmePrefix ├── monadic │ ├── readmePrefix │ ├── monad_base │ │ ├── readmePrefix │ │ ├── Holmakefile │ │ └── README.md │ └── examples │ │ └── readmePrefix └── Holmakefile ├── cv_translator ├── readmePrefix └── backend_x64_evalScript.sml ├── candle ├── prover │ ├── compute │ │ └── readmePrefix │ └── readmePrefix ├── standard │ ├── syntax │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── ml_kernel │ │ ├── lisp │ │ │ ├── readmePrefix │ │ │ ├── Holmakefile │ │ │ └── README.md │ │ ├── readmePrefix │ │ └── runtime_checkLib.sig │ ├── semantics │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── readmePrefix │ ├── monadic │ │ ├── readmePrefix │ │ └── Holmakefile │ └── Holmakefile ├── set-theory │ ├── readmePrefix │ └── Holmakefile ├── overloading │ ├── syntax │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── ml_checker │ │ ├── readmePrefix │ │ └── README.md │ ├── semantics │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── ml_kernel │ │ └── readmePrefix │ ├── readmePrefix │ ├── monadic │ │ ├── readmePrefix │ │ └── Holmakefile │ └── Holmakefile ├── syntax-lib │ ├── readmePrefix │ ├── README.md │ └── Holmakefile ├── readmePrefix └── Holmakefile ├── semantics ├── proofs │ ├── readmePrefix │ ├── semanticsComputeLib.sig │ └── Holmakefile ├── ffi │ ├── readmePrefix │ ├── README.md │ └── Holmakefile ├── alt_semantics │ ├── proofs │ │ ├── readmePrefix │ │ └── Holmakefile │ ├── readmePrefix │ └── Holmakefile └── readmePrefix ├── characteristic ├── examples │ ├── readmePrefix │ └── README.md ├── cfAppLib.sig ├── readmePrefix ├── eqSolveRewriteLib.sig ├── xcf.sig ├── cfNormaliseLib.sig └── cfLib.sml ├── basis ├── pure │ ├── basisComputeLib.sig │ ├── readmePrefix │ ├── mlstringLib.sig │ ├── mlvectorSyntax.sig │ └── Holmakefile ├── readmePrefix ├── basis_ffiLib.sig └── basis.sml ├── misc ├── basicComputeLib.sig └── readmePrefix └── Holmakefile /.holpath: -------------------------------------------------------------------------------- 1 | CAKEMLDIR 2 | -------------------------------------------------------------------------------- /profiler/profiler_test.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pancake/temp/README.md: -------------------------------------------------------------------------------- 1 | Temporary files 2 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/ag32/32/Makefile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/compilation/.gitignore: -------------------------------------------------------------------------------- 1 | cake_* 2 | *.S 3 | -------------------------------------------------------------------------------- /pancake/parser/readmePrefix: -------------------------------------------------------------------------------- 1 | The Pancake parser. 2 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/64/Makefile: -------------------------------------------------------------------------------- 1 | ../Makefile -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/32/Makefile: -------------------------------------------------------------------------------- 1 | ../Makefile -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/Makefile: -------------------------------------------------------------------------------- 1 | ../Makefile -------------------------------------------------------------------------------- /compiler/dafny/examples/empty_main.dfy: -------------------------------------------------------------------------------- 1 | method Main() {} -------------------------------------------------------------------------------- /unverified/front-end/.gitignore: -------------------------------------------------------------------------------- 1 | *.hi 2 | cakeml_uv 3 | -------------------------------------------------------------------------------- /compiler/backend/readmePrefix: -------------------------------------------------------------------------------- 1 | The CakeML compiler backend. 2 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/32/hello.cml: -------------------------------------------------------------------------------- 1 | ../hello.cml -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/hello.cml: -------------------------------------------------------------------------------- 1 | ../hello.cml -------------------------------------------------------------------------------- /developers/bin/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | cake* 3 | basis_ffi* 4 | -------------------------------------------------------------------------------- /examples/splitwordsScript.sml: -------------------------------------------------------------------------------- 1 | ../tutorial/splitwordsScript.sml -------------------------------------------------------------------------------- /tutorial/solutions/splitwordsScript.sml: -------------------------------------------------------------------------------- 1 | ../splitwordsScript.sml -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/64/hello.cml: -------------------------------------------------------------------------------- 1 | ../../x64/hello.cml -------------------------------------------------------------------------------- /compiler/scheme/readmePrefix: -------------------------------------------------------------------------------- 1 | A compiler from Scheme to CakeML 2 | -------------------------------------------------------------------------------- /examples/lpr_checker/readmePrefix: -------------------------------------------------------------------------------- 1 | An LPR checker built on CakeML 2 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/.gitignore: -------------------------------------------------------------------------------- 1 | reader 2 | readerIO 3 | -------------------------------------------------------------------------------- /examples/wordcountProgScript.sml: -------------------------------------------------------------------------------- 1 | ../tutorial/wordcountProgScript.sml -------------------------------------------------------------------------------- /pancake/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Proofs files for compiling Pancake. 2 | -------------------------------------------------------------------------------- /translator/okasaki-examples/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | poly < test.ml 3 | -------------------------------------------------------------------------------- /translator/other-examples/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | poly < test.ml 3 | -------------------------------------------------------------------------------- /tutorial/solutions/wordfreqProofScript.sml: -------------------------------------------------------------------------------- 1 | ../wordfreqProofScript.sml -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/32/how-to.md: -------------------------------------------------------------------------------- 1 | ../../../../how-to.md -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/64/how-to.md: -------------------------------------------------------------------------------- 1 | ../../../../how-to.md -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/64/how-to.md: -------------------------------------------------------------------------------- 1 | ../../../../../how-to.md -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/32/how-to.md: -------------------------------------------------------------------------------- 1 | ../../../../../how-to.md -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/how-to.md: -------------------------------------------------------------------------------- 1 | ../../../../../how-to.md -------------------------------------------------------------------------------- /compiler/dafny/examples/output/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !README.md -------------------------------------------------------------------------------- /compiler/dafny/semantics/readmePrefix: -------------------------------------------------------------------------------- 1 | Definition of Dafny's semantics. -------------------------------------------------------------------------------- /compiler/parsing/tests/readmePrefix: -------------------------------------------------------------------------------- 1 | Tests for the lexer and parser. 2 | -------------------------------------------------------------------------------- /cv_translator/readmePrefix: -------------------------------------------------------------------------------- 1 | Translator to cv type used by cv_compute 2 | -------------------------------------------------------------------------------- /examples/xlrup_checker/readmePrefix: -------------------------------------------------------------------------------- 1 | An XLRUP checker built on CakeML 2 | -------------------------------------------------------------------------------- /tutorial/solutions/wordfreqCompileScript.sml: -------------------------------------------------------------------------------- 1 | ../wordfreqCompileScript.sml -------------------------------------------------------------------------------- /candle/prover/compute/readmePrefix: -------------------------------------------------------------------------------- 1 | A verified Candle compute primitive. 2 | -------------------------------------------------------------------------------- /candle/standard/syntax/readmePrefix: -------------------------------------------------------------------------------- 1 | Syntax of the HOL inference system. 2 | -------------------------------------------------------------------------------- /compiler/backend/San/readmePrefix: -------------------------------------------------------------------------------- 1 | A case study for the shared memory feature. -------------------------------------------------------------------------------- /compiler/dafny/compilation/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated binary 2 | dafny_compiler -------------------------------------------------------------------------------- /compiler/dafny/examples/assert.dfy: -------------------------------------------------------------------------------- 1 | method Main() { 2 | assert 0 != 1; 3 | } -------------------------------------------------------------------------------- /compiler/dafny/examples/output/README.md: -------------------------------------------------------------------------------- 1 | Output directory for examples 2 | -------------------------------------------------------------------------------- /compiler/dafny/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Correctness proofs for the Dafny compiler. -------------------------------------------------------------------------------- /compiler/dafny/readmePrefix: -------------------------------------------------------------------------------- 1 | A verified VCG and verified compiler for Dafny 2 | -------------------------------------------------------------------------------- /compiler/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Correctness proof for the CakeML compiler. 2 | -------------------------------------------------------------------------------- /compiler/scheme/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Proofs for Scheme to CakeML compiler 2 | -------------------------------------------------------------------------------- /examples/deflate/translation/readmePrefix: -------------------------------------------------------------------------------- 1 | Translation scripts for Defalte. 2 | -------------------------------------------------------------------------------- /examples/pseudo_bool/readmePrefix: -------------------------------------------------------------------------------- 1 | A checker for pseudo-boolean constraints 2 | -------------------------------------------------------------------------------- /examples/scpog_checker/readmePrefix: -------------------------------------------------------------------------------- 1 | A checker for SCPOG format in CakeML 2 | -------------------------------------------------------------------------------- /examples/vipr/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | Compilation of VIPR proof checker 2 | -------------------------------------------------------------------------------- /pancake/static_checker/readmePrefix: -------------------------------------------------------------------------------- 1 | Support files for Pancake static checker -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/32/basis_ffi.c: -------------------------------------------------------------------------------- 1 | ../../../../basis/basis_ffi.c -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/64/basis_ffi.c: -------------------------------------------------------------------------------- 1 | ../../../../basis/basis_ffi.c -------------------------------------------------------------------------------- /candle/prover/readmePrefix: -------------------------------------------------------------------------------- 1 | Proof of soundness for the Candle theorem prover. 2 | -------------------------------------------------------------------------------- /compiler/benchmarks/readmePrefix: -------------------------------------------------------------------------------- 1 | Two benchmark suites for the CakeML compiler. 2 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/64/basis_ffi.c: -------------------------------------------------------------------------------- 1 | ../../../../../basis/basis_ffi.c -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/32/basis_ffi.c: -------------------------------------------------------------------------------- 1 | ../../../../../basis/basis_ffi.c -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/basis_ffi.c: -------------------------------------------------------------------------------- 1 | ../../../../../basis/basis_ffi.c -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/repl_boot.cml: -------------------------------------------------------------------------------- 1 | ../../../../repl/repl_boot.cml -------------------------------------------------------------------------------- /compiler/dafny/examples/just_hello.dfy: -------------------------------------------------------------------------------- 1 | method Main() { 2 | print "hello"; 3 | } -------------------------------------------------------------------------------- /compiler/dafny/translation/readmePrefix: -------------------------------------------------------------------------------- 1 | Translation scripts for the Dafny compiler. -------------------------------------------------------------------------------- /compiler/encoders/monadic_enc/readmePrefix: -------------------------------------------------------------------------------- 1 | Monadic implementation of encoder. 2 | -------------------------------------------------------------------------------- /compiler/printing/test/readmePrefix: -------------------------------------------------------------------------------- 1 | Tests for the pretty-printer apparatus. 2 | -------------------------------------------------------------------------------- /semantics/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Theorems about CakeML's syntax and semantics. 2 | -------------------------------------------------------------------------------- /candle/set-theory/readmePrefix: -------------------------------------------------------------------------------- 1 | A specification of (roughly) Zermelo's set theory. 2 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/cakeml/basis_ffi.c: -------------------------------------------------------------------------------- 1 | ../../../../basis/basis_ffi.c -------------------------------------------------------------------------------- /compiler/benchmarks/mlton_benchmarks/cakeml/basis_ffi.c: -------------------------------------------------------------------------------- 1 | ../../../../basis/basis_ffi.c -------------------------------------------------------------------------------- /compiler/dafny/vcg/readmePrefix: -------------------------------------------------------------------------------- 1 | Verification condition generation (VCG) for Dafny. 2 | -------------------------------------------------------------------------------- /compiler/scheme/examples/print.scm: -------------------------------------------------------------------------------- 1 | (letrec ((touch 0)) (begin (set! touch 1) touch)) 2 | -------------------------------------------------------------------------------- /examples/flover/Infra/readmePrefix: -------------------------------------------------------------------------------- 1 | Infrastructural lemmas and formalizations for FloVer -------------------------------------------------------------------------------- /examples/pseudo_bool/graph_encoding/readmePrefix: -------------------------------------------------------------------------------- 1 | Encoders for various graph problems 2 | -------------------------------------------------------------------------------- /examples/sat_encodings/demo/README.md: -------------------------------------------------------------------------------- 1 | Scripts and example problems for the encoders. 2 | -------------------------------------------------------------------------------- /examples/sat_encodings/demo/numBoolRangeExample.lisp: -------------------------------------------------------------------------------- 1 | ((neq 1 2) (1 0 5) (2 0 8)) 2 | -------------------------------------------------------------------------------- /examples/sat_encodings/demo/readmePrefix: -------------------------------------------------------------------------------- 1 | Scripts and example problems for the encoders. -------------------------------------------------------------------------------- /examples/sat_encodings/translation/readmePrefix: -------------------------------------------------------------------------------- 1 | Translation scripts for puzzle encodings. -------------------------------------------------------------------------------- /pancake/semantics/readmePrefix: -------------------------------------------------------------------------------- 1 | Semantics for Pancake and its intermediate languages. 2 | -------------------------------------------------------------------------------- /translator/readmePrefix: -------------------------------------------------------------------------------- 1 | A proof-producing translator from HOL functions to CakeML. 2 | -------------------------------------------------------------------------------- /tutorial/solutions/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains solutions for the tutorial. 2 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/lib/README.md: -------------------------------------------------------------------------------- 1 | This directory contains some old CakeML code. 2 | -------------------------------------------------------------------------------- /compiler/backend/x64/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the x64-specific proofs. 2 | -------------------------------------------------------------------------------- /compiler/dafny/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | Compilation scripts for the Dafny to CakeML backend. -------------------------------------------------------------------------------- /compiler/scheme/translation/readmePrefix: -------------------------------------------------------------------------------- 1 | CakeML translation of Scheme-to-CakeML compiler 2 | -------------------------------------------------------------------------------- /examples/deflate/translation/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | Scripts for compilation of Deflate 2 | -------------------------------------------------------------------------------- /examples/deflate/translation/compilation/tests/README.md: -------------------------------------------------------------------------------- 1 | Files used for testing deflate 2 | -------------------------------------------------------------------------------- /examples/lpr_checker/array/readmePrefix: -------------------------------------------------------------------------------- 1 | Improving the LRAT checker with arrays (manually) 2 | -------------------------------------------------------------------------------- /examples/pseudo_bool/cnf_encoding/readmePrefix: -------------------------------------------------------------------------------- 1 | Encoders for various CNF-based problems 2 | -------------------------------------------------------------------------------- /compiler/backend/ag32/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the Silver-specific proofs. 2 | -------------------------------------------------------------------------------- /compiler/backend/arm7/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the ARMv7-specific proofs. 2 | -------------------------------------------------------------------------------- /compiler/backend/arm8/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the ARMv8-specific proofs. 2 | -------------------------------------------------------------------------------- /compiler/backend/mips/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the mips-specific proofs. 2 | -------------------------------------------------------------------------------- /compiler/backend/pattern_matching/readmePrefix: -------------------------------------------------------------------------------- 1 | The CakeML pattern matching expressions compiler -------------------------------------------------------------------------------- /compiler/backend/riscv/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the RISC-V-specific proofs. 2 | -------------------------------------------------------------------------------- /compiler/backend/serialiser/readmePrefix: -------------------------------------------------------------------------------- 1 | Proofs and automation for serialising HOL values. 2 | -------------------------------------------------------------------------------- /compiler/benchmarks/mlton_benchmarks/cakeml/Makefile: -------------------------------------------------------------------------------- 1 | ../../../bootstrap/compilation/x64/64/Makefile -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/candle_boot.ml: -------------------------------------------------------------------------------- 1 | ../../../../../candle/prover/candle_boot.ml -------------------------------------------------------------------------------- /compiler/dafny/vcg/examples/readmePrefix: -------------------------------------------------------------------------------- 1 | Examples of proving and using VCs generated by the VCG. -------------------------------------------------------------------------------- /compiler/parsing/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Soundness and completeness proofs for the CakeML PEG. 2 | -------------------------------------------------------------------------------- /compiler/scheme/examples/README.md: -------------------------------------------------------------------------------- 1 | Example Scheme programs compiled using the Scheme compiler 2 | -------------------------------------------------------------------------------- /examples/compilation/x64/wordcountCompileScript.sml: -------------------------------------------------------------------------------- 1 | ../../../tutorial/wordcountCompileScript.sml -------------------------------------------------------------------------------- /examples/deflate/readmePrefix: -------------------------------------------------------------------------------- 1 | Scripts relevant to the formalisation of the DEFLATE algorithm 2 | -------------------------------------------------------------------------------- /examples/sat_encodings/readmePrefix: -------------------------------------------------------------------------------- 1 | Encodings of puzzles to CNF, to use as SAT-solver input. 2 | -------------------------------------------------------------------------------- /examples/scpog_checker/array/readmePrefix: -------------------------------------------------------------------------------- 1 | Improving the SCPOG checker with arrays (manually) 2 | -------------------------------------------------------------------------------- /examples/template/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | Compilation scripts for simple example functions. 2 | -------------------------------------------------------------------------------- /examples/template/translation/readmePrefix: -------------------------------------------------------------------------------- 1 | Translation of HOL functions into CakeML programs. 2 | -------------------------------------------------------------------------------- /examples/xlrup_checker/array/readmePrefix: -------------------------------------------------------------------------------- 1 | Improving the XLRUP checker with arrays (manually) 2 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/32/Makefile: -------------------------------------------------------------------------------- 1 | ../../../../compiler/bootstrap/compilation/x64/Makefile -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/64/Makefile: -------------------------------------------------------------------------------- 1 | ../../../../compiler/bootstrap/compilation/x64/Makefile -------------------------------------------------------------------------------- /candle/overloading/syntax/readmePrefix: -------------------------------------------------------------------------------- 1 | Syntax of the HOL inference system with ad-hoc overloading. 2 | -------------------------------------------------------------------------------- /candle/standard/ml_kernel/lisp/readmePrefix: -------------------------------------------------------------------------------- 1 | Parsing and pretty printing of simple s-expressions 2 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/cakeml/Makefile: -------------------------------------------------------------------------------- 1 | ../../../bootstrap/compilation/x64/64/Makefile -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/candle_records.ml: -------------------------------------------------------------------------------- 1 | ../../../../../candle/prover/candle_records.ml -------------------------------------------------------------------------------- /compiler/parsing/ocaml/readmePrefix: -------------------------------------------------------------------------------- 1 | OCaml lexer and parser frontend for the Candle theorem prover. 2 | -------------------------------------------------------------------------------- /compiler/scheme/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | Compilation scripts for the Scheme-to-CakeML compiler. 2 | -------------------------------------------------------------------------------- /compiler/scheme/unverified/README.md: -------------------------------------------------------------------------------- 1 | An unverified compiler from Scheme to ML written in Haskell 2 | -------------------------------------------------------------------------------- /examples/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | Compilation of the CakeML examples to different architectures. 2 | -------------------------------------------------------------------------------- /examples/compilation/x64/proofs/wordcountProofScript.sml: -------------------------------------------------------------------------------- 1 | ../../../../tutorial/wordcountProofScript.sml -------------------------------------------------------------------------------- /examples/lpr_checker/array/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | An LRAT checker built on CakeML with arrays 2 | -------------------------------------------------------------------------------- /examples/opentheory/readmePrefix: -------------------------------------------------------------------------------- 1 | Implementation of an OpenTheory reader based on the Candle kernel. 2 | -------------------------------------------------------------------------------- /examples/sat_encodings/translation/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | Compilation scripts for puzzle encodings. -------------------------------------------------------------------------------- /examples/scpog_checker/array/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | An SCPOG checker built on CakeML with arrays 2 | -------------------------------------------------------------------------------- /examples/xlrup_checker/array/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | An XLRUP checker built on CakeML with arrays 2 | -------------------------------------------------------------------------------- /unverified/hol-light-syntax/ocaml_j: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rlwrap ocamltop_j -I +compiler-libs -I +camlp5 3 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/tests/boyer-patch: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sed -f boyer-patch.sed -i boyer.cml 4 | -------------------------------------------------------------------------------- /candle/syntax-lib/readmePrefix: -------------------------------------------------------------------------------- 1 | Auxiliary definitions used for manipulating (deeply embedded) HOL syntax. 2 | -------------------------------------------------------------------------------- /characteristic/examples/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains examples of how the CF tactics can be used. 2 | -------------------------------------------------------------------------------- /compiler/backend/x64/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the x64-specific part of the compiler backend. 2 | -------------------------------------------------------------------------------- /compiler/encoders/arm8_asl/readmePrefix: -------------------------------------------------------------------------------- 1 | Definition of the compiler configureation for ASL-derived ARMv8. 2 | -------------------------------------------------------------------------------- /examples/compilation/x64/readmePrefix: -------------------------------------------------------------------------------- 1 | Compile the examples via in-logic evaluation to x86 machine code. 2 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | Compiling the pseudo-boolean constraints checker 2 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/readmePrefix: -------------------------------------------------------------------------------- 1 | Improving the pseudoboolean proof checker with arrays (manually) 2 | -------------------------------------------------------------------------------- /candle/standard/semantics/readmePrefix: -------------------------------------------------------------------------------- 1 | Semantics, soundness, and consistency for the HOL inference system. 2 | -------------------------------------------------------------------------------- /compiler/backend/arm7/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the ARMv7-specific part of the compiler backend. 2 | -------------------------------------------------------------------------------- /compiler/backend/arm8/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the ARMv8-specific part of the compiler backend. 2 | -------------------------------------------------------------------------------- /compiler/backend/mips/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the mips-specific part of the compiler backend. 2 | -------------------------------------------------------------------------------- /compiler/backend/riscv/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the RISC-V-specific part of the compiler backend. 2 | -------------------------------------------------------------------------------- /examples/compilation/ag32/readmePrefix: -------------------------------------------------------------------------------- 1 | Compile the examples via in-logic evaluation to Silver machine code. 2 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the unverified bootstrap of the compiler. 2 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/ocaml/README.md: -------------------------------------------------------------------------------- 1 | This diretory contains OCaml programs used for benchmarking. 2 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/sml/README.md: -------------------------------------------------------------------------------- 1 | This diretory contains SML programs used for benchmarking. 2 | -------------------------------------------------------------------------------- /compiler/bootstrap/README.md: -------------------------------------------------------------------------------- 1 | Theories that perform proof-grounded bootstrapping of 2 | the CakeML compiler in HOL. 3 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/ag32/readmePrefix: -------------------------------------------------------------------------------- 1 | Compilation of the OpenTheory article checker to the Silver ISA. 2 | -------------------------------------------------------------------------------- /translator/other-examples/readmePrefix: -------------------------------------------------------------------------------- 1 | A few other examples of HOL functions that can be translated into CakeML. 2 | -------------------------------------------------------------------------------- /candle/overloading/ml_checker/readmePrefix: -------------------------------------------------------------------------------- 1 | Implementation of an I/O shim for extracting a cyclicity checker 2 | binary. 3 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/cakeml/readmePrefix: -------------------------------------------------------------------------------- 1 | This diretory contains CakeML programs used for benchmarking. 2 | -------------------------------------------------------------------------------- /compiler/encoders/arm8_asl/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Proof that the compiler configuration for ASL-derived ARMv8 is valid. 2 | -------------------------------------------------------------------------------- /examples/sat_encodings/case_studies/readmePrefix: -------------------------------------------------------------------------------- 1 | Different puzzles and problems encoded to suitable versatile datatypes. -------------------------------------------------------------------------------- /unverified/front-end/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | ghc -O --make Main -o cake_uv 3 | 4 | clean: 5 | rm -f *.o *.hi cake_uv 6 | 7 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/.ocamlinit: -------------------------------------------------------------------------------- 1 | #use "topfind";; 2 | #require "batteries";; 3 | #require "compiler-libs.common";; 4 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.cml 2 | *.out 3 | boyer 4 | countGraphs 5 | fib 6 | knuthBendix 7 | streams 8 | -------------------------------------------------------------------------------- /examples/lpr_checker/array/compilation/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for LPR checker with arrays 2 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for PB checker with arrays 2 | -------------------------------------------------------------------------------- /pancake/readmePrefix: -------------------------------------------------------------------------------- 1 | The Pancake compiler, i.e. a C-like compiler built from the lower 2 | parts of the CakeML compiler. 3 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/.gitignore: -------------------------------------------------------------------------------- 1 | cake-sexpr* 2 | cake-unverified* 3 | x64/64/how-to.* 4 | x64/64/*.cake 5 | x64/64/cake 6 | -------------------------------------------------------------------------------- /basis/pure/basisComputeLib.sig: -------------------------------------------------------------------------------- 1 | signature basisComputeLib = sig 2 | val add_basis_compset : computeLib.compset -> unit 3 | end 4 | -------------------------------------------------------------------------------- /compiler/backend/gc/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the garbage collector (GC) algorithms and 2 | their verification proofs. 3 | -------------------------------------------------------------------------------- /compiler/benchmarks/mlton_benchmarks/README.md: -------------------------------------------------------------------------------- 1 | This directory contains benchmark programs from the MLton benchmark 2 | suite. 3 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/hello.cml: -------------------------------------------------------------------------------- 1 | (* 2 | A simple hello world program in CakeML 3 | *) 4 | print "Hello, World!\n"; 5 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/proofsARM8/readmePrefix: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for PB checker with arrays 2 | -------------------------------------------------------------------------------- /examples/scpog_checker/array/compilation/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for SCPOG checker with arrays 2 | -------------------------------------------------------------------------------- /examples/xlrup_checker/array/compilation/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for xlrup checker with arrays 2 | -------------------------------------------------------------------------------- /misc/basicComputeLib.sig: -------------------------------------------------------------------------------- 1 | signature basicComputeLib = 2 | sig 3 | val add_basic_compset : computeLib.compset -> unit 4 | end 5 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/.gitignore: -------------------------------------------------------------------------------- 1 | *.cmi 2 | *.cmx 3 | *.swp 4 | ocamlToCakeML 5 | typedOCamlToCakeML 6 | formatted 7 | test.ml 8 | -------------------------------------------------------------------------------- /basis/readmePrefix: -------------------------------------------------------------------------------- 1 | Contains the beginnings of a standard basis library for CakeML, 2 | similar to the standard basis library of SML. 3 | -------------------------------------------------------------------------------- /compiler/backend/ag32/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the Silver-specific part of the compiler 2 | backend and associated proofs. 3 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/readmePrefix: -------------------------------------------------------------------------------- 1 | Files that prepare the compiler backend for computation using HOL4's 2 | cv_compute mechanism. -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/hello.cml: -------------------------------------------------------------------------------- 1 | (* 2 | A simple hello world program in CakeML 3 | *) 4 | print "Hello, World!\n"; 5 | -------------------------------------------------------------------------------- /compiler/inference/tests/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains tests that evaluate the type inferencer inside 2 | the logic of HOL. 3 | -------------------------------------------------------------------------------- /compiler/repl/readmePrefix: -------------------------------------------------------------------------------- 1 | Some definitions and proofs used in the proof of the CakeML 2 | and Candle read-eval-print loop (REPL). 3 | -------------------------------------------------------------------------------- /examples/vipr/readmePrefix: -------------------------------------------------------------------------------- 1 | Formalisation of VIPR: Verifying Integer Programming Results 2 | https://github.com/ambros-gleixner/VIPR 3 | -------------------------------------------------------------------------------- /characteristic/cfAppLib.sig: -------------------------------------------------------------------------------- 1 | signature cfAppLib = sig 2 | include Abbrev 3 | 4 | val app_of_Arrow_rule : hol_type -> thm -> thm 5 | end 6 | -------------------------------------------------------------------------------- /compiler/backend/arm8_asl/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains proofs for the ASL-derived ARMv8-specific part of the 2 | compiler backend. 3 | -------------------------------------------------------------------------------- /developers/rebuild-excludes: -------------------------------------------------------------------------------- 1 | .HOLMK 2 | .hollogs 3 | heap 4 | developers/readme_gen 5 | semantics/addancs 6 | tutorial/solutions/make_ex 7 | -------------------------------------------------------------------------------- /examples/compilation/x64/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorems for the examples as compiled to 2 | x86 machine code. 3 | -------------------------------------------------------------------------------- /misc/readmePrefix: -------------------------------------------------------------------------------- 1 | Auxiliary files providing glue between a standard HOL installation 2 | and what we want to use for CakeML development. 3 | -------------------------------------------------------------------------------- /translator/monadic/readmePrefix: -------------------------------------------------------------------------------- 1 | Extensions to the proof-producing translator to support 2 | stateful/imperative (monadic) HOL functions. 3 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/tests/README.md: -------------------------------------------------------------------------------- 1 | This directory contains old files that were used to test an OCaml to 2 | CakeML translation tool. 3 | -------------------------------------------------------------------------------- /compiler/backend/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the correctness proofs for all of the 2 | different phases of the compiler backend. 3 | -------------------------------------------------------------------------------- /compiler/backend/reg_alloc/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the proofs of the register allocator and 2 | parallel-move algorithms. 3 | -------------------------------------------------------------------------------- /compiler/backend/reg_alloc/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the implementation of the register allocator 2 | and parallel-move algorithms. 3 | -------------------------------------------------------------------------------- /compiler/benchmarks/mlton_benchmarks/sml/README.md: -------------------------------------------------------------------------------- 1 | This diretory contains benchmark programs from the MLton benchmark 2 | suite in SML syntax. 3 | -------------------------------------------------------------------------------- /compiler/encoders/README.md: -------------------------------------------------------------------------------- 1 | Encoders for CakeML's ASM abstract assembly language into each of the concrete 2 | targets of the CakeML compiler. 3 | -------------------------------------------------------------------------------- /compiler/encoders/ag32/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for Silver. 3 | -------------------------------------------------------------------------------- /compiler/encoders/arm7/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for ARMv7. 3 | -------------------------------------------------------------------------------- /compiler/encoders/arm8/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for ARMv8. 3 | -------------------------------------------------------------------------------- /compiler/encoders/mips/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for MIPS. 3 | -------------------------------------------------------------------------------- /compiler/encoders/x64/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for x64. 3 | -------------------------------------------------------------------------------- /examples/compilation/ag32/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorems for the examples as compiled to 2 | Silver machine code. 3 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/32/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains files that create an unverified bootstrap of 2 | the 32-bit compiler. 3 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/64/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains files that create an unverified bootstrap of 2 | the 64-bit compiler. 3 | -------------------------------------------------------------------------------- /candle/readmePrefix: -------------------------------------------------------------------------------- 1 | Verification of a HOL theorem prover, based on HOL Light 2 | (http://www.cl.cam.ac.uk/~jrh13/hol-light/), implemented in CakeML. 3 | -------------------------------------------------------------------------------- /compiler/encoders/ag32/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the Silver target is OK. 3 | -------------------------------------------------------------------------------- /compiler/encoders/arm7/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the ARMv7 target is OK. 3 | -------------------------------------------------------------------------------- /compiler/encoders/arm8/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the ARMv8 target is OK. 3 | -------------------------------------------------------------------------------- /compiler/encoders/mips/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the MIPS target is OK. 3 | -------------------------------------------------------------------------------- /compiler/encoders/riscv/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for RISC-V. 3 | -------------------------------------------------------------------------------- /compiler/encoders/x64/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the x64 target is OK. 3 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | The directory contains end-to-end correctness theorems for the 2 | OpenTheory article checker. 3 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the script that does in-logic compilation of 2 | the OpenTheory article checker. 3 | -------------------------------------------------------------------------------- /examples/vipr/compilation/README.md: -------------------------------------------------------------------------------- 1 | Compilation of VIPR proof checker 2 | 3 | [viprCompileScript.sml](viprCompileScript.sml): 4 | Compile cake_vipr 5 | -------------------------------------------------------------------------------- /unverified/readmePrefix: -------------------------------------------------------------------------------- 1 | Various unverified tools, e.g. tools for converting OCaml to CakeML 2 | and an SML version of the CakeML register allocator. 3 | -------------------------------------------------------------------------------- /candle/standard/readmePrefix: -------------------------------------------------------------------------------- 1 | Definition of the inference system for HOL, including semantics in set theory 2 | and proofs of soundness and consistency. 3 | -------------------------------------------------------------------------------- /characteristic/readmePrefix: -------------------------------------------------------------------------------- 1 | A verified CakeML adaption of Arthur Charguéraud's "Characteristic 2 | Formulae for the Verification of Imperative Programs" 3 | -------------------------------------------------------------------------------- /compiler/benchmarks/mlton_benchmarks/cakeml/readmePrefix: -------------------------------------------------------------------------------- 1 | This diretory contains benchmark programs from the MLton benchmark 2 | suite adapted for CakeML. 3 | -------------------------------------------------------------------------------- /compiler/encoders/riscv/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the RISC-V target is OK. 3 | -------------------------------------------------------------------------------- /compiler/inference/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the correctness proofs for the type 2 | inferencer: both soundness and completeness proofs. 3 | -------------------------------------------------------------------------------- /examples/lpr_checker/array/compilation/proofsARM8/readmePrefix: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for LPR checker with arrays 2 | against ARM8 model 3 | -------------------------------------------------------------------------------- /semantics/ffi/readmePrefix: -------------------------------------------------------------------------------- 1 | Definition of CakeML's observational semantics, in particular traces of calls 2 | over the Foreign-Function Interface (FFI). 3 | -------------------------------------------------------------------------------- /translator/monadic/monad_base/readmePrefix: -------------------------------------------------------------------------------- 1 | The state-and-exception monad that is used by the proof-producing translator 2 | for monadic HOL functions. 3 | -------------------------------------------------------------------------------- /characteristic/eqSolveRewriteLib.sig: -------------------------------------------------------------------------------- 1 | signature eqSolveRewriteLib = 2 | sig 3 | include Abbrev 4 | val ELIM_UNKWN_CONV : term HOLset.set -> conv 5 | end 6 | -------------------------------------------------------------------------------- /examples/deflate/translation/compilation/tests/chess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CakeML/cakeml/HEAD/examples/deflate/translation/compilation/tests/chess.png -------------------------------------------------------------------------------- /examples/template/readmePrefix: -------------------------------------------------------------------------------- 1 | A simple example of how a standalone CakeML program can be produced from 2 | a functional program defined as functions in HOL. 3 | -------------------------------------------------------------------------------- /candle/overloading/semantics/readmePrefix: -------------------------------------------------------------------------------- 1 | Semantics, soundness, and consistency for the HOL inference system 2 | with ad-hoc overloading of constant definitions. 3 | -------------------------------------------------------------------------------- /compiler/encoders/tests/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory brings together all of the encoder definitions and 2 | provides a Lib that can be used to test the encoders. 3 | -------------------------------------------------------------------------------- /candle/standard/ml_kernel/readmePrefix: -------------------------------------------------------------------------------- 1 | Implementation of the monadic functions in (deeply embedded) CakeML, 2 | generated by the translator (proof-producing synthesis). 3 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/README.md: -------------------------------------------------------------------------------- 1 | This directory contains benchmark programs that we use to measure the 2 | performance of the generated CakeML programs. 3 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/ag32/32/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the end-to-end correctness theorem for the 2 | 32-bit version of the CakeML compiler. 3 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/64/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the end-to-end correctness theorem for the 2 | 64-bit version of the CakeML compiler. 3 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/32/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the end-to-end correctness theorem for the 2 | 32-bit version of the CakeML compiler. 3 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the end-to-end correctness theorem for the 2 | 64-bit version of the CakeML compiler. 3 | -------------------------------------------------------------------------------- /candle/overloading/ml_kernel/readmePrefix: -------------------------------------------------------------------------------- 1 | Implementation of the monadic functions in (deeply embedded) CakeML, 2 | generated by the translator (proof-producing synthesis). 3 | -------------------------------------------------------------------------------- /examples/flover/readmePrefix: -------------------------------------------------------------------------------- 1 | # FloVer - A Certificate Checker for Roundoff Error Bounds 2 | 3 | This is a copy of the FloVer code at [https://gitlab.mpi-sws.org/AVA/FloVer] 4 | -------------------------------------------------------------------------------- /semantics/alt_semantics/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | The direcory contains proofs about the old relational semantics for 2 | CakeML. This directory might be deleted in the future. 3 | -------------------------------------------------------------------------------- /tutorial/readmePrefix: -------------------------------------------------------------------------------- 1 | An extended worked example on using HOL and CakeML to write verified programs, 2 | that was presented as a tutorial on CakeML at PLDI and ICFP in 2017. 3 | -------------------------------------------------------------------------------- /unverified/reg_alloc/README.md: -------------------------------------------------------------------------------- 1 | A snapshot of the register allocator from the CakeML compiler, translated from 2 | HOL to CakeML then pretty-printed in Standard ML syntax. 3 | -------------------------------------------------------------------------------- /candle/standard/ml_kernel/runtime_checkLib.sig: -------------------------------------------------------------------------------- 1 | signature runtime_checkLib = sig 2 | 3 | include Abbrev 4 | 5 | val check : term quotation list -> thm -> thm 6 | 7 | end 8 | -------------------------------------------------------------------------------- /compiler/encoders/asm/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory defines a target-neutral assmebly language that the 2 | intermediate languages of the lower half of the compiler makes use of. 3 | -------------------------------------------------------------------------------- /developers/bin/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory represents a stage in the build sequence where the latest 2 | available cake binary is downloaded to perform testing and bootstrapping. 3 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/ag32/proofs/readmePrefix: -------------------------------------------------------------------------------- 1 | End-to-end correctness proofs that relate the OpenTheory article 2 | checker to the behaviour of the Silver machine code. 3 | -------------------------------------------------------------------------------- /translator/monadic/examples/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains example applications of the monadic translator. 2 | These examples serve as test cases of the monadic translator. 3 | -------------------------------------------------------------------------------- /unverified/hol-light-syntax/README.md: -------------------------------------------------------------------------------- 1 | A work in progress attempt to translate the particular OCaml syntax used by HOL 2 | Light into Standard ML (as a step towards CakeML). 3 | 4 | -------------------------------------------------------------------------------- /candle/overloading/readmePrefix: -------------------------------------------------------------------------------- 1 | Definition of the inference system for HOL with ad-hoc overloading, 2 | including semantics in set theory and proofs of soundness and 3 | consistency. 4 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/backend_asmLib.sig: -------------------------------------------------------------------------------- 1 | signature backend_asmLib = 2 | sig 3 | 4 | include Abbrev 5 | 6 | val define_target_specific_backend : thm -> thm 7 | 8 | end 9 | -------------------------------------------------------------------------------- /compiler/encoders/x64/x64_targetLib.sig: -------------------------------------------------------------------------------- 1 | signature x64_targetLib = 2 | sig 3 | val add_x64_encode_compset: computeLib.compset -> unit 4 | val x64_encode_conv: Conv.conv 5 | end 6 | -------------------------------------------------------------------------------- /compiler/scheme/examples/tailfib.scm: -------------------------------------------------------------------------------- 1 | (letrec 2 | ((fib (lambda (n a b) 3 | (if (eqv? n 0) a 4 | (fib (- n 1) (+ a b) a))))) 5 | (fib 35 0 1)) 6 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | x64/64/cake 3 | x64/64/test-hello.cake 4 | x64/64/cake-sexpr-32 5 | x64/64/cake-sexpr-64 6 | x64/64/output 7 | x64/64/expected_output 8 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/test-hello.cml: -------------------------------------------------------------------------------- 1 | (* 2 | A hello world program used for testing that the bootstrapped 3 | compiler was built succesfully. 4 | *) 5 | print "Hello!\n"; 6 | -------------------------------------------------------------------------------- /compiler/encoders/ag32/ag32_targetLib.sig: -------------------------------------------------------------------------------- 1 | signature ag32_targetLib = 2 | sig 3 | val add_ag32_encode_compset: computeLib.compset -> unit 4 | val ag32_encode_conv: Conv.conv 5 | end 6 | -------------------------------------------------------------------------------- /compiler/encoders/arm7/arm7_targetLib.sig: -------------------------------------------------------------------------------- 1 | signature arm7_targetLib = 2 | sig 3 | val add_arm7_encode_compset: computeLib.compset -> unit 4 | val arm7_encode_conv: Conv.conv 5 | end 6 | -------------------------------------------------------------------------------- /compiler/encoders/arm8/arm8_targetLib.sig: -------------------------------------------------------------------------------- 1 | signature arm8_targetLib = 2 | sig 3 | val add_arm8_encode_compset: computeLib.compset -> unit 4 | val arm8_encode_conv: Conv.conv 5 | end 6 | -------------------------------------------------------------------------------- /compiler/encoders/mips/mips_targetLib.sig: -------------------------------------------------------------------------------- 1 | signature mips_targetLib = 2 | sig 3 | val add_mips_encode_compset: computeLib.compset -> unit 4 | val mips_encode_conv: Conv.conv 5 | end 6 | -------------------------------------------------------------------------------- /basis/pure/readmePrefix: -------------------------------------------------------------------------------- 1 | HOL definitions of the pure functions used in the CakeML basis. 2 | 3 | The CakeML code for the pure parts of the basis is produced 4 | from these by the translator. 5 | -------------------------------------------------------------------------------- /compiler/encoders/riscv/riscv_targetLib.sig: -------------------------------------------------------------------------------- 1 | signature riscv_targetLib = 2 | sig 3 | val add_riscv_encode_compset: computeLib.compset -> unit 4 | val riscv_encode_conv: Conv.conv 5 | end 6 | -------------------------------------------------------------------------------- /profiler/readmePrefix: -------------------------------------------------------------------------------- 1 | Basic profiling facilities for theories and proofs. 2 | 3 | Supports data export to a format that is understood by 4 | [FlameGraph](https://github.com/brendangregg/FlameGraph). -------------------------------------------------------------------------------- /semantics/alt_semantics/readmePrefix: -------------------------------------------------------------------------------- 1 | Alternative definitions of the semantics: 2 | - using inductive relations (as opposed to functional big-step style), and, 3 | - as a small-step relation. 4 | -------------------------------------------------------------------------------- /translator/other-examples/auxiliary/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains definitions used for miscellaneous translator 2 | examples from used in the original ICFP paper about the translator. 3 | -------------------------------------------------------------------------------- /translator/okasaki-examples/readmePrefix: -------------------------------------------------------------------------------- 1 | Examples of using the CakeML translator on functional programs based on the 2 | algorithms in "Purely Functional Data Structures" by Chris Okasaki (1996). 3 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/README.md: -------------------------------------------------------------------------------- 1 | This directory contains scripts that compile the CakeML compiler 2 | inside the logic to produce the verified machine code implementing the 3 | compiler itself. 4 | -------------------------------------------------------------------------------- /examples/template/translation/README.md: -------------------------------------------------------------------------------- 1 | Translation of HOL functions into CakeML programs. 2 | 3 | [example_funsProgScript.sml](example_funsProgScript.sml): 4 | Translate HOL functions into CakeML code 5 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/32/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains scripts that compile the CakeML compiler 2 | inside the logic to produce the verified machine code version of the 3 | 32-bit compiler. 4 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains scripts that compile the CakeML compiler 2 | inside the logic to produce the verified machine code version of the 3 | 64-bit compiler. 4 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/README.md: -------------------------------------------------------------------------------- 1 | This directory contains scripts that compile the CakeML compiler 2 | inside the logic to produce the verified x64 machine code implementing 3 | the compiler itself. 4 | -------------------------------------------------------------------------------- /compiler/dafny/compilation/README.md: -------------------------------------------------------------------------------- 1 | Compilation scripts for the Dafny to CakeML backend. 2 | 3 | [dafny_compilerCompileScript.sml](dafny_compilerCompileScript.sml): 4 | Compiles the Dafny to CakeML compiler. 5 | -------------------------------------------------------------------------------- /examples/template/compilation/README.md: -------------------------------------------------------------------------------- 1 | Compilation scripts for simple example functions. 2 | 3 | [example_funsCompileScript.sml](example_funsCompileScript.sml): 4 | Compile the encoder for the sudoku puzzle 5 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/ag32/32/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains scripts that compile the CakeML compiler 2 | inside the logic to produce the verified machine code version of the 3 | 32-bit compiler. 4 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/ag32/README.md: -------------------------------------------------------------------------------- 1 | This directory contains scripts that compile the CakeML compiler 2 | inside the logic to produce the verified Silver machine code 3 | implementing the compiler itself. 4 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/64/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains scripts that compile the CakeML compiler 2 | inside the logic to produce the verified machine code version of the 3 | 64-bit compiler. 4 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/README.md: -------------------------------------------------------------------------------- 1 | This directory contains scripts that compile the CakeML compiler 2 | inside the logic to produce the verified arm8 machine code implementing 3 | the compiler itself. 4 | -------------------------------------------------------------------------------- /compiler/readmePrefix: -------------------------------------------------------------------------------- 1 | A verified compiler for CakeML, including: 2 | - lexing and PEG parsing, 3 | - type inference, 4 | - compilation to ASM assembly language, and, 5 | - code generation to x86, ARM, and more. 6 | -------------------------------------------------------------------------------- /unverified/hol-light-syntax/Makefile: -------------------------------------------------------------------------------- 1 | HOLLIGHT ?= $(HOME)/hol-light 2 | 3 | ast: 4 | ocamlopt -c ast.ml 5 | 6 | ocamltop_j: 7 | exec ocamlmktop -o $@ -I +camlp5 nums.cma unix.cma camlp5o.cma $(HOLLIGHT)/pa_j.cmo 8 | -------------------------------------------------------------------------------- /compiler/dafny/vcg/examples/README.md: -------------------------------------------------------------------------------- 1 | Examples of proving and using VCs generated by the VCG. 2 | 3 | [dafny_vcg_exampleScript.sml](dafny_vcg_exampleScript.sml): 4 | Concrete examples demonstrating the wp calculus. 5 | -------------------------------------------------------------------------------- /examples/readmePrefix: -------------------------------------------------------------------------------- 1 | Examples of verified programs built using CakeML infrastructure. 2 | 3 | Larger examples (like the CakeML compiler and Candle theorem prover) can be 4 | found in their own top-level directories. 5 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/README.md: -------------------------------------------------------------------------------- 1 | An alternative bootstrapping process: The translated AST of the compiler is 2 | printed as an S-expression then fed into a previously built executable of the 3 | CakeML compiler. 4 | -------------------------------------------------------------------------------- /candle/syntax-lib/README.md: -------------------------------------------------------------------------------- 1 | Auxiliary definitions used for manipulating (deeply embedded) HOL syntax. 2 | 3 | [holSyntaxLibScript.sml](holSyntaxLibScript.sml): 4 | Definitions for manipulating (deeply embedded) HOL syntax. 5 | -------------------------------------------------------------------------------- /basis/pure/mlstringLib.sig: -------------------------------------------------------------------------------- 1 | signature mlstringLib = sig 2 | 3 | include Abbrev 4 | 5 | val smart_dest_mlstring_case : term -> term * (term * term) list * term 6 | 7 | val mlstring_case_conv : conv 8 | 9 | end 10 | -------------------------------------------------------------------------------- /compiler/encoders/tests/encodeLib.sig: -------------------------------------------------------------------------------- 1 | signature encodeLib = 2 | sig 3 | datatype arch = Compare | All | ARMv6 | ARMv8 | x86_64 | MIPS | RISCV 4 | val encodings : arch list -> Term.term Abbrev.quotation list -> unit 5 | end 6 | -------------------------------------------------------------------------------- /compiler/scheme/compilation/README.md: -------------------------------------------------------------------------------- 1 | Compilation scripts for the Scheme-to-CakeML compiler. 2 | 3 | [scheme_compilerCompileScript.sml](scheme_compilerCompileScript.sml): 4 | In-logic compilation of the Scheme-to-CakeML compiler 5 | -------------------------------------------------------------------------------- /compiler/scheme/examples/basis_scheme.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ffischeme_out (unsigned char *c, long clen, unsigned char *a, long alen) { 4 | for (int i=0; i hol_type 6 | val dest_vector_type : hol_type -> hol_type 7 | val is_vector_type : hol_type -> bool 8 | end 9 | -------------------------------------------------------------------------------- /compiler/encoders/x64/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the x64 target is OK. 3 | 4 | [x64_targetProofScript.sml](x64_targetProofScript.sml): 5 | Prove `encoder_correct` for x64 6 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/ocaml2cakeml: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cat "${BASH_SOURCE%/*}/lib/pervasives.cml" "${BASH_SOURCE%/*}/lib/list.cml" \ 4 | "${BASH_SOURCE%/*}/lib/array.cml" \ 5 | <(echo; "${BASH_SOURCE%/*}/formatted" <<< `cat $1`) 6 | -------------------------------------------------------------------------------- /candle/overloading/ml_checker/README.md: -------------------------------------------------------------------------------- 1 | Implementation of an I/O shim for extracting a cyclicity checker 2 | binary. 3 | 4 | [ml_cyclicityCheckerProgScript.sml](ml_cyclicityCheckerProgScript.sml): 5 | An I/O shim for the verified cyclicity checker 6 | -------------------------------------------------------------------------------- /compiler/encoders/mips/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the MIPS target is OK. 3 | 4 | [mips_targetProofScript.sml](mips_targetProofScript.sml): 5 | Prove `encoder_correct` for MIPS 6 | -------------------------------------------------------------------------------- /compiler/encoders/arm7/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the ARMv7 target is OK. 3 | 4 | [arm7_targetProofScript.sml](arm7_targetProofScript.sml): 5 | Prove `encoder_correct` for ARMv7 6 | -------------------------------------------------------------------------------- /compiler/parsing/tests/README.md: -------------------------------------------------------------------------------- 1 | Tests for the lexer and parser. 2 | 3 | [cmlTestsScript.sml](cmlTestsScript.sml): 4 | Some tests for the compiler's parser. 5 | 6 | [lexerTestsScript.sml](lexerTestsScript.sml): 7 | Some tests for the compiler's lexer. 8 | -------------------------------------------------------------------------------- /compiler/scheme/examples/fib.scm: -------------------------------------------------------------------------------- 1 | (letrec 2 | ((fib (lambda (n) 3 | (if (eqv? n 0) n 4 | (if (eqv? n 1) n 5 | (+ (fib (- n 1)) 6 | (fib (- n 2)))))))) 7 | (fib 30)) 8 | -------------------------------------------------------------------------------- /compiler/encoders/riscv/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the RISC-V target is OK. 3 | 4 | [riscv_targetProofScript.sml](riscv_targetProofScript.sml): 5 | Prove `encoder_correct` for RISC-V 6 | -------------------------------------------------------------------------------- /candle/standard/monadic/readmePrefix: -------------------------------------------------------------------------------- 1 | Implementation of the Candle kernel as monadic functions in HOL (i.e. a 2 | shallow embedding), and proof that they refine the HOL inference system. 3 | 4 | The kernel implementation is heavily based on the HOL Light kernel. 5 | -------------------------------------------------------------------------------- /compiler/proofs/README.md: -------------------------------------------------------------------------------- 1 | Correctness proof for the CakeML compiler. 2 | 3 | [compilerProofScript.sml](compilerProofScript.sml): 4 | Prove top-level correctness theorem for complete compiler, i.e. the 5 | combination of parsing, type inference, compiler backend. 6 | -------------------------------------------------------------------------------- /examples/sat_encodings/demo/graphProblem.lisp: -------------------------------------------------------------------------------- 1 | ((red blue green) 2 | ((1 (2 5 6)) 3 | (2 (1 3 7)) 4 | (3 (2 4 8)) 5 | (4 (3 5 9)) 6 | (5 (1 4 10)) 7 | (6 (1 8 9)) 8 | (7 (2 9 10)) 9 | (8 (3 6 10)) 10 | (9 (4 6 7)) 11 | (10 (5 7 8)))) 12 | -------------------------------------------------------------------------------- /pancake/pan_commonScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Common definitions for Pancake compiler 3 | *) 4 | Theory pan_common 5 | Libs 6 | preamble 7 | 8 | Definition distinct_lists_def: 9 | distinct_lists xs ys = 10 | EVERY (\x. ~MEM x ys) xs 11 | End 12 | 13 | 14 | -------------------------------------------------------------------------------- /candle/overloading/monadic/readmePrefix: -------------------------------------------------------------------------------- 1 | Implementation of the Candle kernel as monadic functions in HOL (i.e. a 2 | shallow embedding), and proof that they refine the HOL inference system. 3 | 4 | The kernel implementation is heavily based on the HOL Light kernel. 5 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/ocaml/fib.ml: -------------------------------------------------------------------------------- 1 | let rec fib n = 2 | if (n < 2) 3 | then n 4 | else ((fib (n - 1)) + (fib (n - 2)));; 5 | let rec use_fib n = 6 | (((((fib n) + (fib n)) + (fib n)) + (fib n)) + (fib n)) + (fib n);; 7 | let test = use_fib 40;; 8 | -------------------------------------------------------------------------------- /compiler/encoders/ag32/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the Silver target is OK. 3 | 4 | [ag32_targetProofScript.sml](ag32_targetProofScript.sml): 5 | Prove `encoder_correct` for ag32, i.e. Silver ISA 6 | -------------------------------------------------------------------------------- /compiler/backend/x64/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the x64-specific proofs. 2 | 3 | [x64_configProofScript.sml](x64_configProofScript.sml): 4 | For x64, prove that the compiler configuration is well formed, and 5 | instantiate the compiler correctness theorem. 6 | -------------------------------------------------------------------------------- /unverified/front-end/README.md: -------------------------------------------------------------------------------- 1 | A CakeML front-end written in Haskell. It tries to give reasonable parse and 2 | type error messages that include source locations. It includes a rudimentary 3 | CakeML to OCaml and CakeML to SML translator, currently used for benchmarking. 4 | -------------------------------------------------------------------------------- /compiler/backend/arm7/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the ARMv7-specific proofs. 2 | 3 | [arm7_configProofScript.sml](arm7_configProofScript.sml): 4 | For ARMv7, prove that the compiler configuration is well formed, and 5 | instantiate the compiler correctness theorem. 6 | -------------------------------------------------------------------------------- /compiler/backend/arm8/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the ARMv8-specific proofs. 2 | 3 | [arm8_configProofScript.sml](arm8_configProofScript.sml): 4 | For ARMv8, prove that the compiler configuration is well formed, and 5 | instantiate the compiler correctness theorem. 6 | -------------------------------------------------------------------------------- /compiler/backend/mips/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the mips-specific proofs. 2 | 3 | [mips_configProofScript.sml](mips_configProofScript.sml): 4 | For MIPS, prove that the compiler configuration is well formed, and 5 | instantiate the compiler correctness theorem. 6 | -------------------------------------------------------------------------------- /compiler/backend/semantics/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the semantics for each 2 | intermediate language that is used in the compiler backend. This 3 | directory also contains generic properties about the semantics of each 4 | intermediate language. 5 | -------------------------------------------------------------------------------- /compiler/dafny/examples/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore files without extensions (e.g. binaries) 2 | * 3 | !*/ 4 | !*.* 5 | 6 | **/*.cs 7 | **/*.csproj 8 | **/*.deps.json 9 | **/*.dll 10 | **/*.pdb 11 | **/*.runtimeconfig.json 12 | 13 | **/*.dtr 14 | **/*.sexp 15 | 16 | **/obj/ 17 | -------------------------------------------------------------------------------- /examples/pseudo_bool/cnf_encoding/README.md: -------------------------------------------------------------------------------- 1 | Encoders for various CNF-based problems 2 | 3 | [cnf_to_pbScript.sml](cnf_to_pbScript.sml): 4 | Parsing CNFs and convert into npbc 5 | 6 | [wcnf_to_pbScript.sml](wcnf_to_pbScript.sml): 7 | WCNF into pbc, written in a tutorial style 8 | -------------------------------------------------------------------------------- /examples/sat_encodings/demo/sudokuExample.lisp: -------------------------------------------------------------------------------- 1 | ((5 3 0 0 7 0 0 0 0) 2 | (6 0 0 1 9 5 0 0 0) 3 | (0 9 8 0 0 0 0 6 0) 4 | (8 0 0 0 6 0 0 0 3) 5 | (4 0 0 8 0 3 0 0 1) 6 | (7 0 0 0 2 0 0 0 6) 7 | (0 6 0 0 0 0 2 8 0) 8 | (0 0 0 4 1 9 0 0 5) 9 | (0 0 0 0 8 0 0 7 9)) 10 | -------------------------------------------------------------------------------- /compiler/backend/riscv/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the RISC-V-specific proofs. 2 | 3 | [riscv_configProofScript.sml](riscv_configProofScript.sml): 4 | For RISC-V, prove that the compiler configuration is well formed, 5 | and instantiate the compiler correctness theorem. 6 | -------------------------------------------------------------------------------- /examples/compilation/README.md: -------------------------------------------------------------------------------- 1 | Compilation of the CakeML examples to different architectures. 2 | 3 | [ag32](ag32): 4 | Compile the examples via in-logic evaluation to Silver machine code. 5 | 6 | [x64](x64): 7 | Compile the examples via in-logic evaluation to x86 machine code. 8 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/proofs/README.md: -------------------------------------------------------------------------------- 1 | The directory contains end-to-end correctness theorems for the 2 | OpenTheory article checker. 3 | 4 | [readerProgProofScript.sml](readerProgProofScript.sml): 5 | End-to-end correctness theorems for the OpenTheory article checker. 6 | -------------------------------------------------------------------------------- /examples/sat_encodings/demo/unsatSudokuExample.lisp: -------------------------------------------------------------------------------- 1 | ((5 3 5 0 7 0 0 0 0) 2 | (6 0 0 1 9 5 0 0 0) 3 | (0 9 8 0 0 0 0 6 0) 4 | (8 0 0 0 6 0 0 0 3) 5 | (4 0 0 8 0 3 0 0 1) 6 | (7 0 0 0 2 0 0 0 6) 7 | (0 6 0 0 0 0 2 8 0) 8 | (0 0 0 4 1 9 0 0 5) 9 | (0 0 0 0 8 0 0 7 9)) 10 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/backend_x64Script.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Define x64 specialised backend functions. 3 | *) 4 | Theory backend_x64 5 | Ancestors 6 | x64_target 7 | Libs 8 | preamble backend_asmLib 9 | 10 | 11 | val _ = define_target_specific_backend x64_config_def; 12 | 13 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/backend_ag32Script.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Define ag32 specialised backend functions. 3 | *) 4 | Theory backend_ag32 5 | Ancestors 6 | ag32_target 7 | Libs 8 | preamble backend_asmLib 9 | 10 | 11 | val _ = define_target_specific_backend ag32_config_def; 12 | 13 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/backend_arm7Script.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Define arm7 specialised backend functions. 3 | *) 4 | Theory backend_arm7 5 | Ancestors 6 | arm7_target 7 | Libs 8 | preamble backend_asmLib 9 | 10 | 11 | val _ = define_target_specific_backend arm7_config_def; 12 | 13 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/backend_arm8Script.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Define arm8 specialised backend functions. 3 | *) 4 | Theory backend_arm8 5 | Ancestors 6 | arm8_target 7 | Libs 8 | preamble backend_asmLib 9 | 10 | 11 | val _ = define_target_specific_backend arm8_config_def; 12 | 13 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/backend_mipsScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Define mips specialised backend functions. 3 | *) 4 | Theory backend_mips 5 | Ancestors 6 | mips_target 7 | Libs 8 | preamble backend_asmLib 9 | 10 | 11 | val _ = define_target_specific_backend mips_config_def; 12 | 13 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | ( cd "$(dirname "$0")" 6 | 7 | ( cd ocaml 8 | make 9 | ) 10 | 11 | ( cd cakeml 12 | make 13 | ) 14 | 15 | ( cd sml 16 | make 17 | ) 18 | 19 | python benchmark.py 20 | ) 21 | -------------------------------------------------------------------------------- /compiler/dafny/examples/function_call.dfy: -------------------------------------------------------------------------------- 1 | // Adapted from Dafny (MIT License): https://github.com/dafny-lang/dafny 2 | 3 | function F(x: int, y: bool): int { 4 | x + if y then 2 else 3 5 | } 6 | 7 | method Main() { 8 | var w; 9 | w := F(2, false); 10 | print w, "\n"; 11 | } 12 | -------------------------------------------------------------------------------- /examples/template/example_funsScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Define a simple program as functions in HOL 3 | *) 4 | Theory example_funs 5 | Ancestors 6 | misc mlstring 7 | 8 | Definition main_function_def: 9 | main_function (s:mlstring) = 10 | implode (REVERSE (explode s)) 11 | End 12 | -------------------------------------------------------------------------------- /pancake/static_checker/README.md: -------------------------------------------------------------------------------- 1 | Support files for Pancake static checker 2 | 3 | [panStaticExamplesScript.sml](panStaticExamplesScript.sml): 4 | * Some simple static checking examples/unit tests/sanity checks for Pancake 5 | * Inspect interactive output manually for more detailed checking 6 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/backend_riscvScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Define riscv specialised backend functions. 3 | *) 4 | Theory backend_riscv 5 | Ancestors 6 | riscv_target 7 | Libs 8 | preamble backend_asmLib 9 | 10 | 11 | val _ = define_target_specific_backend riscv_config_def; 12 | 13 | -------------------------------------------------------------------------------- /profiler/README.md: -------------------------------------------------------------------------------- 1 | Basic profiling facilities for theories and proofs. 2 | 3 | Supports data export to a format that is understood by 4 | [FlameGraph](https://github.com/brendangregg/FlameGraph). 5 | 6 | [profiler_testScript.sml](profiler_testScript.sml): 7 | Simple theory to test the profiler. 8 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/tests/boyer-patch.sed: -------------------------------------------------------------------------------- 1 | # The definition of `lemmas` doesn't typecheck because of the value 2 | # restriction. 3 | # CakeML has no type annotations, so I see no better way to fix this. 4 | 5 | s/\(val lemmas = \)Pervasives.oc_ref \[\];/\1ref (List.tl [MkHead ("", ref [])]);/ 6 | -------------------------------------------------------------------------------- /examples/vipr/compilation/viprCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile cake_vipr 3 | *) 4 | Theory viprCompile 5 | Ancestors 6 | viprProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem vipr_encoder_compiled = 11 | eval_cake_compile_x64 "" vipr_prog_def "cake_vipr.S"; 12 | 13 | -------------------------------------------------------------------------------- /unverified/front-end/cake_stub.sml: -------------------------------------------------------------------------------- 1 | (* SML source file required by code produced by CakeML -> SML translation *) 2 | structure Cake_stub = struct 3 | type 'a ref = 'a ref 4 | type exn = exn 5 | type unit = unit 6 | val op := = op := 7 | val ! = ! 8 | fun my_eq x y = x = y 9 | end 10 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/32/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the end-to-end correctness theorem for the 2 | 32-bit version of the CakeML compiler. 3 | 4 | [x64BootstrapProofScript.sml](x64BootstrapProofScript.sml): 5 | Proves an end-to-end correctness theorem for the bootstrapped compiler. 6 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/ag32/32/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the end-to-end correctness theorem for the 2 | 32-bit version of the CakeML compiler. 3 | 4 | [ag32BootstrapProofScript.sml](ag32BootstrapProofScript.sml): 5 | Proves an end-to-end correctness theorem for the bootstrapped compiler. 6 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/64/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the end-to-end correctness theorem for the 2 | 64-bit version of the CakeML compiler. 3 | 4 | [arm8BootstrapProofScript.sml](arm8BootstrapProofScript.sml): 5 | Proves an end-to-end correctness theorem for the bootstrapped compiler. 6 | -------------------------------------------------------------------------------- /compiler/dafny/translation/cakeml_astProgScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Translates CakeML's AST types, extending basisProg. 3 | *) 4 | Theory cakeml_astProg 5 | Ancestors 6 | basisProg 7 | Libs 8 | preamble basis 9 | 10 | 11 | val _ = translation_extends "basisProg"; 12 | 13 | val _ = register_type “:dec”; 14 | -------------------------------------------------------------------------------- /semantics/ffi/README.md: -------------------------------------------------------------------------------- 1 | Definition of CakeML's observational semantics, in particular traces of calls 2 | over the Foreign-Function Interface (FFI). 3 | 4 | [ffiScript.sml](ffiScript.sml): 5 | Definition of the FFI type 6 | 7 | [simpleIOScript.sml](simpleIOScript.sml): 8 | A simple instantiation of the ffi type. 9 | -------------------------------------------------------------------------------- /semantics/readmePrefix: -------------------------------------------------------------------------------- 1 | The definition of the CakeML language. 2 | The directory includes definitions of: 3 | - the concrete syntax, 4 | - the abstract syntax, 5 | - big step semantics (both functional and relational), 6 | - a small step semantics, 7 | - the semantics of FFI calls, and, 8 | - the type system. 9 | -------------------------------------------------------------------------------- /compiler/backend/source_to_sourceScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | This phase collects all source-to-source transformations. 3 | *) 4 | Theory source_to_source 5 | Ancestors 6 | source_let misc[qualified] 7 | Libs 8 | preamble 9 | 10 | 11 | Definition compile_def: 12 | compile = source_let$compile_decs 13 | End 14 | 15 | -------------------------------------------------------------------------------- /compiler/encoders/tests/README.md: -------------------------------------------------------------------------------- 1 | This directory brings together all of the encoder definitions and 2 | provides a Lib that can be used to test the encoders. 3 | 4 | [encodeLib.sml](encodeLib.sml): 5 | Automation that shows how asm instructions are encoded for the 6 | different archs. See examples at the end of the file. 7 | -------------------------------------------------------------------------------- /compiler/scheme/translation/README.md: -------------------------------------------------------------------------------- 1 | CakeML translation of Scheme-to-CakeML compiler 2 | 3 | [scheme_compilerProgScript.sml](scheme_compilerProgScript.sml): 4 | Build a CakeML program implementing Scheme-to-Cake compiler 5 | 6 | [to_sexpProgScript.sml](to_sexpProgScript.sml): 7 | Translation of printing to CakeML sexp 8 | -------------------------------------------------------------------------------- /examples/scpog_checker/array/compilation/README.md: -------------------------------------------------------------------------------- 1 | An SCPOG checker built on CakeML with arrays 2 | 3 | [proofs](proofs): 4 | Prove end-to-end correctness theorem for SCPOG checker with arrays 5 | 6 | [scpogCompileScript.sml](scpogCompileScript.sml): 7 | Compiles the scpog example by evaluation inside the logic of HOL 8 | -------------------------------------------------------------------------------- /examples/xlrup_checker/array/compilation/README.md: -------------------------------------------------------------------------------- 1 | An XLRUP checker built on CakeML with arrays 2 | 3 | [proofs](proofs): 4 | Prove end-to-end correctness theorem for xlrup checker with arrays 5 | 6 | [xlrupCompileScript.sml](xlrupCompileScript.sml): 7 | Compiles the xlrup example by evaluation inside the logic of HOL 8 | -------------------------------------------------------------------------------- /basis/basis_ffiLib.sig: -------------------------------------------------------------------------------- 1 | signature basis_ffiLib = sig 2 | 3 | include Abbrev 4 | 5 | (* Set the optional store precondition *) 6 | val add_user_heap_thm : thm -> unit 7 | 8 | val whole_prog_spec_def : thm 9 | 10 | val whole_prog_thm : ml_progLib.ml_prog_state -> string -> thm -> thm * term 11 | 12 | end 13 | -------------------------------------------------------------------------------- /compiler/dafny/translation/dafny_astProgScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Translates Dafny's AST types. 3 | *) 4 | Theory dafny_astProg 5 | Ancestors 6 | cakeml_astProg dafny_ast 7 | Libs 8 | preamble ml_translatorLib 9 | 10 | 11 | val _ = translation_extends "cakeml_astProg"; 12 | 13 | val _ = register_type “:program”; 14 | 15 | -------------------------------------------------------------------------------- /examples/compilation/x64/catCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the cat example by evaluation inside the logic of HOL 3 | *) 4 | Theory catCompile 5 | Ancestors 6 | catProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem cat_compiled = 11 | eval_cake_compile_x64 "" cat_prog_def "cat.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/compilation/x64/diffCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the diff example by evaluation inside the logic of HOL 3 | *) 4 | Theory diffCompile 5 | Ancestors 6 | diffProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem diff_compiled = 11 | eval_cake_compile_x64 "" diff_prog_def "diff.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/compilation/x64/echoCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the echo example by evaluation inside the logic of HOL 3 | *) 4 | Theory echoCompile 5 | Ancestors 6 | echoProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem echo_compiled = 11 | eval_cake_compile_x64 "" echo_prog_def "echo.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/compilation/x64/grepCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the grep example by evaluation inside the logic of HOL 3 | *) 4 | Theory grepCompile 5 | Ancestors 6 | grepProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem grep_compiled = 11 | eval_cake_compile_x64 "" grep_prog_def "grep.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/compilation/x64/sortCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the sort example by evaluation inside the logic of HOL 3 | *) 4 | Theory sortCompile 5 | Ancestors 6 | sortProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem sort_compiled = 11 | eval_cake_compile_x64 "" sort_prog_def "sort.S"; 12 | 13 | -------------------------------------------------------------------------------- /compiler/encoders/arm8_asl/README.md: -------------------------------------------------------------------------------- 1 | Definition of the compiler configureation for ASL-derived ARMv8. 2 | 3 | [arm8_asl_targetScript.sml](arm8_asl_targetScript.sml): 4 | Define the target compiler configuration for ASL-derived ARMv8. 5 | 6 | [proofs](proofs): 7 | Proof that the compiler configuration for ASL-derived ARMv8 is valid. 8 | -------------------------------------------------------------------------------- /examples/compilation/ag32/sortCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the sort example by evaluation inside the logic of HOL 3 | *) 4 | Theory sortCompile 5 | Ancestors 6 | sortProg 7 | Libs 8 | preamble eval_cake_compile_ag32Lib 9 | 10 | Theorem sort_compiled = 11 | eval_cake_compile_ag32 "" sort_prog_def "sort.S"; 12 | 13 | -------------------------------------------------------------------------------- /semantics/proofs/semanticsComputeLib.sig: -------------------------------------------------------------------------------- 1 | signature semanticsComputeLib = 2 | sig 3 | 4 | val add_ast_compset : computeLib.compset -> unit 5 | val add_namespace_compset : computeLib.compset -> unit 6 | val add_lexparse_compset : computeLib.compset -> unit 7 | val add_semantics_compset : computeLib.compset -> unit 8 | 9 | end 10 | -------------------------------------------------------------------------------- /examples/compilation/ag32/helloCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the hello example by evaluation inside the logic of HOL 3 | *) 4 | Theory helloCompile 5 | Ancestors 6 | helloProg 7 | Libs 8 | preamble eval_cake_compile_ag32Lib 9 | 10 | Theorem hello_compiled = 11 | eval_cake_compile_ag32 "" hello_prog_def "hello.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/compilation/x64/helloCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the hello example by evaluation inside the logic of HOL 3 | *) 4 | Theory helloCompile 5 | Ancestors 6 | helloProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem hello_compiled = 11 | eval_cake_compile_x64 "" hello_prog_def "hello.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/compilation/x64/patchCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the patch example by evaluation inside the logic of HOL 3 | *) 4 | Theory patchCompile 5 | Ancestors 6 | patchProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem patch_compiled = 11 | eval_cake_compile_x64 "" patch_prog_def "patch.S"; 12 | 13 | -------------------------------------------------------------------------------- /translator/other-examples/example_91Script.sml: -------------------------------------------------------------------------------- 1 | (* 2 | This is a simple example of applying the translator to 3 | the 91 function. 4 | *) 5 | Theory example_91 6 | Ancestors 7 | ninetyOne arithmetic list sorting regexpMatch 8 | Libs 9 | ml_translatorLib 10 | 11 | (* 91 -- easy *) 12 | 13 | val res = translate N_def 14 | 15 | -------------------------------------------------------------------------------- /compiler/backend/arm8_asl/README.md: -------------------------------------------------------------------------------- 1 | This directory contains proofs for the ASL-derived ARMv8-specific part of the 2 | compiler backend. 3 | 4 | [arm8_asl_configProofScript.sml](arm8_asl_configProofScript.sml): 5 | For ASL-derived ARMv8, prove that the compiler configuration is well formed, 6 | and instantiate the compiler correctness theorem. 7 | -------------------------------------------------------------------------------- /cv_translator/backend_x64_evalScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Experiments with evaluating the compiler using cv_compute 3 | *) 4 | Theory backend_x64_eval 5 | Libs 6 | preamble eval_cake_compile_x64Lib 7 | 8 | Definition prog_def: 9 | prog = [] : ast$dec list 10 | End 11 | 12 | val res = eval_cake_compile_x64 "" prog_def "empty_prog.S"; 13 | 14 | -------------------------------------------------------------------------------- /compiler/bootstrap/translation/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory applies the translator to the compiler in order to 2 | produce a deep embedding of the entire shallowly embedded compiler. 3 | The translator is proof-producing. This means that each deep embedding 4 | comes with a certificate theorem that relates the deep embedding to 5 | the original shallow embedding. 6 | -------------------------------------------------------------------------------- /compiler/encoders/arm8/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a theorem stating that the compiler 2 | configuration for the ARMv8 target is OK. 3 | 4 | [arm8_targetProofLib.sml](arm8_targetProofLib.sml): 5 | Various ML tools used in arm8_targetProofTheory. 6 | 7 | [arm8_targetProofScript.sml](arm8_targetProofScript.sml): 8 | Prove `encoder_correct` for ARMv8 9 | -------------------------------------------------------------------------------- /examples/compilation/x64/helloErrCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the helloErr example by evaluation inside the logic of HOL 3 | *) 4 | Theory helloErrCompile 5 | Ancestors 6 | helloErrProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem helloErr_compiled = 11 | eval_cake_compile_x64 "" helloErr_prog_def "helloErr.S"; 12 | 13 | -------------------------------------------------------------------------------- /compiler/inference/tests/README.md: -------------------------------------------------------------------------------- 1 | This directory contains tests that evaluate the type inferencer inside 2 | the logic of HOL. 3 | 4 | [basisTypeCheckScript.sml](basisTypeCheckScript.sml): 5 | This file checks that the CakeML standard basis library passes the 6 | type inferencer. This file also acts as a test of cv_compute 7 | evaluation of the type inferencer. 8 | -------------------------------------------------------------------------------- /examples/deflate/translation/compilation/compressionCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the simple compression schema 3 | *) 4 | Theory compressionCompile 5 | Ancestors 6 | compressionProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem compression_compiled = 11 | eval_cake_compile_x64 "" compression_prog_def "compression.S"; 12 | 13 | -------------------------------------------------------------------------------- /characteristic/xcf.sig: -------------------------------------------------------------------------------- 1 | (* 2 | Implementation of the xcf and xcfs tactics. 3 | *) 4 | signature xcf = 5 | sig 6 | include Abbrev 7 | val xcf_with_def : thm -> tactic 8 | val xcf_with_defs : thm list -> tactic 9 | val xcf : string -> ml_progLib.ml_prog_state -> tactic 10 | val xcfs : string list -> ml_progLib.ml_prog_state -> tactic 11 | end (* sig *) 12 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/ocaml/foldl.ml: -------------------------------------------------------------------------------- 1 | let rec foldl f e xs = 2 | match xs with [] -> e 3 | | (x::xs) -> foldl f (f e x) xs;; 4 | 5 | let rec repeat x n = 6 | if (n = 0) 7 | then [] 8 | else (x::(repeat x (n - 1)));; 9 | 10 | let test = foldl (fun x -> fun y -> x + (foldl (fun x -> fun y -> x+y) 0 y)) 0 (repeat (repeat 1 40000) 40000);; 11 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/32/x64BootstrapScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Evaluateof the 32-bit version of the compiler into x64 machine code. 3 | *) 4 | Theory x64Bootstrap 5 | Ancestors 6 | compiler32Prog 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem compiler32_compiled = 11 | eval_cake_compile_x64 "" compiler32_prog_def "cake.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/flover/Infra/FloverCompLib.sml: -------------------------------------------------------------------------------- 1 | (** 2 | Small changes to computeLib for FloVer 3 | **) 4 | structure FloverCompLib = 5 | struct 6 | open computeLib; 7 | 8 | val _ = computeLib.del_funs [sptreeTheory.subspt_def]; 9 | 10 | val _ = computeLib.add_funs [realTheory.REAL_INV_1OVER]; 11 | val _ = computeLib.add_funs [sptreeTheory.subspt_eq]; 12 | 13 | end 14 | -------------------------------------------------------------------------------- /examples/scpog_checker/array/compilation/proofs/README.md: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for SCPOG checker with arrays 2 | 3 | [scpogProofScript.sml](scpogProofScript.sml): 4 | Compose the semantics theorem and the compiler correctness 5 | theorem with the compiler evaluation theorem to produce end-to-end 6 | correctness theorem that reaches final machine code. 7 | -------------------------------------------------------------------------------- /examples/xlrup_checker/array/compilation/proofs/README.md: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for xlrup checker with arrays 2 | 3 | [xlrupProofScript.sml](xlrupProofScript.sml): 4 | Compose the semantics theorem and the compiler correctness 5 | theorem with the compiler evaluation theorem to produce end-to-end 6 | correctness theorem that reaches final machine code. 7 | -------------------------------------------------------------------------------- /tutorial/wordfreqCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile the wordfreq program to machine code by evaluation of the compiler in 3 | the logic. 4 | *) 5 | Theory wordfreqCompile 6 | Ancestors 7 | wordfreqProg 8 | Libs 9 | preamble eval_cake_compile_x64Lib 10 | 11 | Theorem wordfreq_compiled = 12 | eval_cake_compile_x64 "" wordfreq_prog_def "wordfreq.S"; 13 | 14 | -------------------------------------------------------------------------------- /characteristic/cfNormaliseLib.sig: -------------------------------------------------------------------------------- 1 | signature cfNormaliseLib = 2 | sig 3 | include Abbrev 4 | 5 | val strip_annot_exp : term -> term 6 | val strip_annot_decl : term -> term 7 | val strip_annot_prog : term -> term 8 | 9 | val normalise_exp : term -> term 10 | val normalise_decl : term -> term 11 | val normalise_prog : term -> term 12 | 13 | end 14 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/arm8/64/arm8BootstrapScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Evaluateof the 64-bit version of the compiler into arm8 machine code. 3 | *) 4 | Theory arm8Bootstrap 5 | Ancestors 6 | compiler64Prog 7 | Libs 8 | preamble eval_cake_compile_arm8Lib 9 | 10 | Theorem compiler64_compiled = 11 | eval_cake_compile_arm8 "" compiler64_prog_def "cake.S"; 12 | 13 | -------------------------------------------------------------------------------- /compiler/dafny/compilation/dafny_compilerCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the Dafny to CakeML compiler. 3 | *) 4 | Theory dafny_compilerCompile 5 | Ancestors 6 | dafny_compilerProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | 11 | Theorem dafny_compiler_compiled = 12 | eval_cake_compile_x64 "" dafny_compiler_prog_def "dafny_compiler.S"; 13 | 14 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/ag32/readerCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | In-logic compilation of the OPenTHeory article checker to the 3 | Silver ISA. 4 | *) 5 | Theory readerCompile 6 | Ancestors 7 | readerProg 8 | Libs 9 | preamble eval_cake_compile_ag32Lib 10 | 11 | Theorem reader_compiled = 12 | eval_cake_compile_ag32 "" reader_prog_def "reader.S"; 13 | 14 | -------------------------------------------------------------------------------- /characteristic/cfLib.sml: -------------------------------------------------------------------------------- 1 | (* 2 | This library collects all CF-related libraries and theories 3 | into a single import for convenience. 4 | *) 5 | structure cfLib = struct 6 | open 7 | cfHeapsBaseTheory cfHeapsTheory 8 | cfTacticsBaseLib cfTacticsLib 9 | cfLetAutoTheory cfLetAutoLib 10 | cfNormaliseLib 11 | cfMainTheory 12 | cfDivLib 13 | end 14 | -------------------------------------------------------------------------------- /examples/deflate/translation/compilation/decompressionCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the simple decompression schema 3 | *) 4 | Theory decompressionCompile 5 | Ancestors 6 | decompressionProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem decompression_compiled = 11 | eval_cake_compile_x64 "" decompression_prog_def "decompression.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/deflate/translation/compilation/deflateDecodeCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the binary for the Deflate decoder 3 | *) 4 | Theory deflateDecodeCompile 5 | Ancestors 6 | deflateDecodeProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem deflateDecode_compiled = 11 | eval_cake_compile_x64 "" deflateDecode_prog_def "deflateDecode.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/deflate/translation/compilation/deflateEncodeCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the binary for the Deflate Encoder 3 | *) 4 | Theory deflateEncodeCompile 5 | Ancestors 6 | deflateEncodeProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem deflateEncode_compiled = 11 | eval_cake_compile_x64 "" deflateEncode_prog_def "deflateEncode.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/xlrup_checker/array/compilation/xlrupCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the xlrup example by evaluation inside the logic of HOL 3 | *) 4 | Theory xlrupCompile 5 | Ancestors 6 | xlrup_arrayFullProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem xlrup_array_compiled = 11 | eval_cake_compile_x64 "" check_unsat_prog_def "cake_xlrup.S"; 12 | 13 | -------------------------------------------------------------------------------- /compiler/benchmarks/README.md: -------------------------------------------------------------------------------- 1 | Two benchmark suites for the CakeML compiler. 2 | 3 | [cakeml_benchmarks](cakeml_benchmarks): 4 | This directory contains benchmark programs that we use to measure the 5 | performance of the generated CakeML programs. 6 | 7 | [mlton_benchmarks](mlton_benchmarks): 8 | This directory contains benchmark programs from the MLton benchmark 9 | suite. 10 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/proofsARM8/README.md: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for PB checker with arrays 2 | 3 | [npbc_fullProofARM8Script.sml](npbc_fullProofARM8Script.sml): 4 | Compose the semantics theorem and the compiler correctness 5 | theorem with the compiler evaluation theorem to produce end-to-end 6 | correctness theorem that reaches final machine code. 7 | -------------------------------------------------------------------------------- /tutorial/wordcountCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile the wordcount program to machine code by evaluation of the compiler 3 | in the logic. 4 | *) 5 | Theory wordcountCompile 6 | Ancestors 7 | wordcountProg 8 | Libs 9 | preamble eval_cake_compile_x64Lib 10 | 11 | 12 | Theorem wordcount_compiled = 13 | eval_cake_compile_x64 "" wordcount_prog_def "wordcount.S"; 14 | 15 | -------------------------------------------------------------------------------- /compiler/printing/test/README.md: -------------------------------------------------------------------------------- 1 | Tests for the pretty-printer apparatus. 2 | 3 | [printingTestScript.sml](printingTestScript.sml): 4 | This file creates some sample declarations and runs the pretty 5 | printer adjustments over them, confirms that the adjusted decs 6 | still type check, and exports the s-expressions so that the 7 | printed strings can be checked with the binary compiler. 8 | -------------------------------------------------------------------------------- /compiler/backend/reg_alloc/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the proofs of the register allocator and 2 | parallel-move algorithms. 3 | 4 | [linear_scanProofScript.sml](linear_scanProofScript.sml): 5 | Proves correctness of the linear-scan register allocator. 6 | 7 | [reg_allocProofScript.sml](reg_allocProofScript.sml): 8 | Proves correctness of the graph-colouring register allocator. 9 | -------------------------------------------------------------------------------- /examples/compilation/ag32/wordcountCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile the wordcount program to machine code by evaluation of the compiler 3 | in the logic. 4 | *) 5 | Theory wordcountCompile 6 | Ancestors 7 | wordcountProg 8 | Libs 9 | preamble eval_cake_compile_ag32Lib 10 | 11 | Theorem wordcount_compiled = 12 | eval_cake_compile_ag32 "" wordcount_prog_def "wordcount.S"; 13 | 14 | -------------------------------------------------------------------------------- /examples/flover/Infra/Holmakefile: -------------------------------------------------------------------------------- 1 | OPTIONS = QUIT_ON_FAILURE 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 9 | -------------------------------------------------------------------------------- /examples/lpr_checker/array/compilation/lpr_arrayCompileARM8Script.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the lpr example by evaluation inside the logic of HOL 3 | *) 4 | Theory lpr_arrayCompileARM8 5 | Ancestors 6 | lpr_arrayFullProg 7 | Libs 8 | preamble eval_cake_compile_arm8Lib 9 | 10 | Theorem lpr_array_compiled = 11 | eval_cake_compile_arm8 "" check_unsat_prog_def "cake_lpr_arm8.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/lpr_checker/array/compilation/lpr_arrayPackingCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the packing example by evaluation inside the logic of HOL 3 | *) 4 | Theory lpr_arrayPackingCompile 5 | Ancestors 6 | lpr_arrayPackingProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem lpr_packing_compiled = 11 | eval_cake_compile_x64 "" main_prog_def "cake_direct.S"; 12 | 13 | -------------------------------------------------------------------------------- /examples/lpr_checker/array/compilation/lpr_arrayRamseyCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the lpr example by evaluation inside the logic of HOL 3 | *) 4 | Theory lpr_arrayRamseyCompile 5 | Ancestors 6 | lpr_arrayRamseyProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem lpr_ramsey_compiled = 11 | eval_cake_compile_x64 "" check_unsat_prog_def "cake_lpr_ramsey.S"; 12 | 13 | -------------------------------------------------------------------------------- /candle/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /developers/artefacts: -------------------------------------------------------------------------------- 1 | compiler/bootstrap/compilation/x64/64/cake-x64-64.tar.gz 2 | compiler/bootstrap/compilation/x64/32/cake-x64-32.tar.gz 3 | compiler/bootstrap/compilation/arm8/64/cake-arm8-64.tar.gz 4 | unverified/sexpr-bootstrap/x64/64/cake-unverified-x64-64.tar.gz 5 | unverified/sexpr-bootstrap/x64/32/cake-unverified-x64-32.tar.gz 6 | compiler/bootstrap/translation/compiler64Prog_translate_timing.txt 7 | -------------------------------------------------------------------------------- /examples/lpr_checker/array/compilation/proofsARM8/README.md: -------------------------------------------------------------------------------- 1 | Prove end-to-end correctness theorem for LPR checker with arrays 2 | against ARM8 model 3 | 4 | [lpr_arrayProofARM8Script.sml](lpr_arrayProofARM8Script.sml): 5 | Compose the semantics theorem and the compiler correctness 6 | theorem with the compiler evaluation theorem to produce end-to-end 7 | correctness theorem that reaches final machine code. 8 | -------------------------------------------------------------------------------- /candle/standard/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/x64/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the x64-specific part of the compiler backend. 2 | 3 | [export_x64Script.sml](export_x64Script.sml): 4 | Define the format of the compiler-generated .S file for x64 5 | 6 | [proofs](proofs): 7 | This directory contains the x64-specific proofs. 8 | 9 | [x64_configScript.sml](x64_configScript.sml): 10 | Define the compiler configuration for x64 11 | -------------------------------------------------------------------------------- /compiler/dafny/examples/plus_one.dfy: -------------------------------------------------------------------------------- 1 | method PlusOne(n: int) returns (r: int) 2 | ensures n < r 3 | { 4 | return n + 1; 5 | } 6 | 7 | method TestPlusOne(n: int) { 8 | var r := PlusOne(n); 9 | print "PlusOne(", n, ") = ", r, "\n"; 10 | } 11 | 12 | method Main() { 13 | TestPlusOne(0); 14 | TestPlusOne(1); 15 | TestPlusOne(-5); 16 | TestPlusOne(100); 17 | TestPlusOne(999999); 18 | } 19 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/ag32/proofs/README.md: -------------------------------------------------------------------------------- 1 | End-to-end correctness proofs that relate the OpenTheory article 2 | checker to the behaviour of the Silver machine code. 3 | 4 | [readerProgProofScript.sml](readerProgProofScript.sml): 5 | End-to-end correctness theorem for the OpenTheory article 6 | checker. The theorem reaches the next-state function of the 7 | verified hardware platform called Silver. 8 | -------------------------------------------------------------------------------- /candle/overloading/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/compilation/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/ag32/README.md: -------------------------------------------------------------------------------- 1 | Compilation of the OpenTheory article checker to the Silver ISA. 2 | 3 | [proofs](proofs): 4 | End-to-end correctness proofs that relate the OpenTheory article 5 | checker to the behaviour of the Silver machine code. 6 | 7 | [readerCompileScript.sml](readerCompileScript.sml): 8 | In-logic compilation of the OPenTHeory article checker to the 9 | Silver ISA. 10 | -------------------------------------------------------------------------------- /compiler/backend/mips/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the mips-specific part of the compiler backend. 2 | 3 | [export_mipsScript.sml](export_mipsScript.sml): 4 | Define the format of the compiler-generated .S file for MIPS 5 | 6 | [mips_configScript.sml](mips_configScript.sml): 7 | Define the compiler configuration for MIPS 8 | 9 | [proofs](proofs): 10 | This directory contains the mips-specific proofs. 11 | -------------------------------------------------------------------------------- /examples/sat_encodings/translation/compilation/sudokuEncoderCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile the encoder for the sudoku puzzle 3 | *) 4 | Theory sudokuEncoderCompile 5 | Ancestors 6 | sudokuEncoderProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem sudoku_encoder_compiled = 11 | eval_cake_compile_x64 "" sudoku_encoder_prog_def 12 | "sudoku_encoder.S"; 13 | 14 | -------------------------------------------------------------------------------- /profiler/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/characteristic 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/arm7/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the ARMv7-specific part of the compiler backend. 2 | 3 | [arm7_configScript.sml](arm7_configScript.sml): 4 | Define the compiler configuration for ARMv7 5 | 6 | [export_arm7Script.sml](export_arm7Script.sml): 7 | Define the format of the compiler-generated .S file for ARMv7 8 | 9 | [proofs](proofs): 10 | This directory contains the ARMv7-specific proofs. 11 | -------------------------------------------------------------------------------- /compiler/backend/arm8/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the ARMv8-specific part of the compiler backend. 2 | 3 | [arm8_configScript.sml](arm8_configScript.sml): 4 | Define the compiler configuration for ARMv8 5 | 6 | [export_arm8Script.sml](export_arm8Script.sml): 7 | Define the format of the compiler-generated .S file for ARMv8 8 | 9 | [proofs](proofs): 10 | This directory contains the ARMv8-specific proofs. 11 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/ag32/32/ag32BootstrapScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Evaluate the final part of the 32-bit version of the compiler 3 | into machine code for ag32, i.e. the Silver ISA. 4 | *) 5 | Theory ag32Bootstrap 6 | Ancestors 7 | compiler32Prog 8 | Libs 9 | preamble eval_cake_compile_ag32Lib 10 | 11 | Theorem compiler32_compiled = 12 | eval_cake_compile_ag32 "" compiler32_prog_def "cake.S"; 13 | 14 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/32/x64SexprScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Produces an sexp print-out of the bootstrap translated compiler 3 | definition for the 32-bit version of the compiler. 4 | *) 5 | Theory x64Sexpr 6 | Ancestors 7 | compiler32Prog 8 | Libs 9 | preamble astToSexprLib 10 | 11 | val filename = "cake-sexpr-x64-32" 12 | 13 | val _ = ((write_ast_to_file filename) o rhs o concl) compiler32_prog_def; 14 | 15 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/64/x64SexprScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Produces an sexp print-out of the bootstrap translated compiler 3 | definition for the 64-bit version of the compiler. 4 | *) 5 | Theory x64Sexpr 6 | Ancestors 7 | compiler64Prog 8 | Libs 9 | preamble astToSexprLib 10 | 11 | val filename = "cake-sexpr-x64-64" 12 | 13 | val _ = ((write_ast_to_file filename) o rhs o concl) compiler64_prog_def; 14 | 15 | -------------------------------------------------------------------------------- /candle/set-theory/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /characteristic/examples/README.md: -------------------------------------------------------------------------------- 1 | This directory contains examples of how the CF tactics can be used. 2 | 3 | [cf_examplesScript.sml](cf_examplesScript.sml): 4 | A collection of small examples that show (and test) what can be done 5 | in CF proofs. 6 | 7 | [cf_tutorialScript.sml](cf_tutorialScript.sml): 8 | A small tutorial on how to do proofs in CF using the tools provided 9 | by CakeML's support for CF reasoning. 10 | -------------------------------------------------------------------------------- /compiler/backend/riscv/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the RISC-V-specific part of the compiler backend. 2 | 3 | [export_riscvScript.sml](export_riscvScript.sml): 4 | Define the format of the compiler-generated .S file for RISC-V 5 | 6 | [proofs](proofs): 7 | This directory contains the RISC-V-specific proofs. 8 | 9 | [riscv_configScript.sml](riscv_configScript.sml): 10 | Define the compiler configuration for RISC-V 11 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/proofs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the end-to-end correctness theorem for the 2 | 64-bit version of the CakeML compiler. 3 | 4 | [replProofScript.sml](replProofScript.sml): 5 | Verification of the function (called repl) that implements the REPL 6 | 7 | [x64BootstrapProofScript.sml](x64BootstrapProofScript.sml): 8 | Proves an end-to-end correctness theorem for the bootstrapped compiler. 9 | -------------------------------------------------------------------------------- /examples/flover/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = Infra semantics 2 | OPTIONS = QUIT_ON_FAILURE 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/sat_encodings/translation/compilation/nQueensEncoderCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile the encoder for the n-queens problem 3 | *) 4 | Theory nQueensEncoderCompile 5 | Ancestors 6 | nQueensEncoderProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem nQueens_encoder_compiled = 11 | eval_cake_compile_x64 "" nQueens_encoder_prog_def 12 | "nQueens_encoder.S"; 13 | 14 | -------------------------------------------------------------------------------- /translator/other-examples/auxiliary/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /unverified/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/developers 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%README.md,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/gc/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc .. 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/inference/tests/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis .. 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 9 | -------------------------------------------------------------------------------- /examples/flover/semantics/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = ../Infra 2 | OPTIONS = QUIT_ON_FAILURE 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/ag32/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = .. ../../asm 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/monadic_enc/README.md: -------------------------------------------------------------------------------- 1 | Monadic implementation of encoder. 2 | 3 | [monadic_enc32Script.sml](monadic_enc32Script.sml): 4 | Implement and prove correct monadic version of encoder 5 | 6 | [monadic_enc64Script.sml](monadic_enc64Script.sml): 7 | Implement and prove correct monadic version of encoder 8 | 9 | [monadic_encScript.sml](monadic_encScript.sml): 10 | Implement and prove correct monadic version of encoder 11 | -------------------------------------------------------------------------------- /compiler/scheme/compilation/scheme_compilerCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | In-logic compilation of the Scheme-to-CakeML compiler 3 | *) 4 | Theory scheme_compilerCompile 5 | Ancestors 6 | scheme_compilerProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | 11 | Theorem scheme_compiler_compiled = 12 | eval_cake_compile_x64 "" scheme_compiler_prog_def 13 | "scheme_compiler.S"; 14 | 15 | -------------------------------------------------------------------------------- /semantics/ffi/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = ../../misc 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) $(wildcard *.lem) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = developers examples/compilation/x64/proofs 2 | 3 | all: $(DEFAULT_TARGETS) README.md examples/compilation/x64/proofs/helloProofTheory.sig 4 | .PHONY: all 5 | 6 | README_SOURCES = LICENSE developers examples build-instructions.sh how-to.md 7 | DIRS = $(wildcard */) 8 | README.md: developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | developers/readme_gen $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /candle/standard/ml_kernel/lisp/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/ocaml/reverse.ml: -------------------------------------------------------------------------------- 1 | let rec reverse xs = 2 | let rec append xs ys = 3 | match xs with [] -> ys 4 | | (x::xs) -> x :: append xs ys in 5 | let rec rev xs = 6 | match xs with [] -> xs 7 | | (x::xs) -> append (rev xs) [x] in 8 | rev xs;; 9 | let rec mk_list n = 10 | if (n = 0) 11 | then [] 12 | else (n::(mk_list (n - 1)));; 13 | let test = reverse (mk_list 50000);; 14 | 15 | 16 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/sml/fib.sml: -------------------------------------------------------------------------------- 1 | fun main ()= 2 | let 3 | fun fib n = 4 | if (n < 2) 5 | then n 6 | else ((fib (n - 1)) + (fib (n - 2))); 7 | fun use_fib n = 8 | (((((fib n) + (fib n)) + (fib n)) + (fib n)) + (fib n)) + (fib n); 9 | val test = use_fib 40; 10 | in () end; 11 | 12 | val _ = main(); 13 | (* Quit out correctly for interacive SMLs *) 14 | val _ = OS.Process.exit(OS.Process.success); 15 | -------------------------------------------------------------------------------- /compiler/bootstrap/compilation/x64/64/sexprBootstrap32Script.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Produces an sexp print-out of the bootstrap translated compiler 3 | definition for the 32-bit version of the compiler. 4 | *) 5 | Theory sexprBootstrap32 6 | Ancestors 7 | compiler32Prog 8 | Libs 9 | preamble astToSexprLib 10 | 11 | val filename = "cake-sexpr-32" 12 | 13 | val _ = ((write_ast_to_file filename) o rhs o concl) compiler32_prog_def; 14 | 15 | -------------------------------------------------------------------------------- /compiler/parsing/tests/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/semantics .. 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /developers/build-excludes: -------------------------------------------------------------------------------- 1 | # tutorial is not supposed to build until one solves the exercises 2 | tutorial 3 | 4 | # Broken, see #1104 5 | compiler/backend/San 6 | 7 | unverified 8 | 9 | # Unmaintained + exampleLib does unholy things like calling set_grammar_ancestry 10 | 11 | examples/flover 12 | examples/flover/Infra 13 | examples/flover/semantics 14 | 15 | unverified/sexpr-bootstrap/x64/64 16 | unverified/sexpr-bootstrap/x64/32 17 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/ocaml/Makefile: -------------------------------------------------------------------------------- 1 | OCAMLC = ocamlc 2 | OCAMLOPT = ocamlopt 3 | 4 | SRCS = $(wildcard *.ml) 5 | 6 | PROGSC = $(patsubst %.ml,ocamlc_%,$(SRCS)) 7 | PROGSO = $(patsubst %.ml,ocamlopt_%,$(SRCS)) 8 | 9 | all: $(PROGSC) $(PROGSO) 10 | 11 | ocamlc_% : %.ml 12 | - $(OCAMLC) -o $@ $< 13 | 14 | ocamlopt_% : %.ml 15 | - $(OCAMLOPT) -o $@ $< 16 | 17 | clean: 18 | $(RM) $(PROGSC) $(PROGSO) *.cmo *.cmx *.cmi *.o 19 | -------------------------------------------------------------------------------- /candle/overloading/syntax/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc ../../syntax-lib 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /candle/standard/syntax/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc ../../syntax-lib 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /candle/syntax-lib/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/reg_alloc/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/translator/monadic .. 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 9 | -------------------------------------------------------------------------------- /compiler/parsing/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/semantics/proofs .. 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/cnfCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the CNF + PB checker 3 | *) 4 | Theory cnfCompile 5 | Ancestors 6 | cnfProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib eval_cake_compile_arm8Lib 9 | 10 | Theorem cnf_compiled = 11 | eval_cake_compile_x64 "" main_prog_def "cake_pb_cnf.S"; 12 | 13 | Theorem cnf_compiled_arm8 = 14 | eval_cake_compile_arm8 "arm8_" main_prog_def "cake_pb_cnf_arm8.S"; 15 | 16 | -------------------------------------------------------------------------------- /examples/sat_encodings/case_studies/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/examples/sat_encodings 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 9 | -------------------------------------------------------------------------------- /examples/template/README.md: -------------------------------------------------------------------------------- 1 | A simple example of how a standalone CakeML program can be produced from 2 | a functional program defined as functions in HOL. 3 | 4 | [compilation](compilation): 5 | Compilation scripts for simple example functions. 6 | 7 | [example_funsScript.sml](example_funsScript.sml): 8 | Define a simple program as functions in HOL 9 | 10 | [translation](translation): 11 | Translation of HOL functions into CakeML programs. 12 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/mcisCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the MCIS + PB checker 3 | *) 4 | Theory mcisCompile 5 | Ancestors 6 | mcisProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib eval_cake_compile_arm8Lib 9 | 10 | Theorem mcis_compiled = 11 | eval_cake_compile_x64 "" main_prog_def "cake_pb_mcis.S"; 12 | 13 | Theorem mcis_compiled_arm8 = 14 | eval_cake_compile_arm8 "arm8_" main_prog_def "cake_pb_mcis_arm8.S"; 15 | 16 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/wcnfCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the WCNF + PB checker 3 | *) 4 | Theory wcnfCompile 5 | Ancestors 6 | wcnfProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib eval_cake_compile_arm8Lib 9 | 10 | Theorem wcnf_compiled = 11 | eval_cake_compile_x64 "" main_prog_def "cake_pb_wcnf.S"; 12 | 13 | Theorem wcnf_compiled_arm8 = 14 | eval_cake_compile_arm8 "arm8_" main_prog_def "cake_pb_wcnf_arm8.S"; 15 | 16 | -------------------------------------------------------------------------------- /examples/sat_encodings/translation/compilation/killerSudokuEncoderCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile the encoder for the killer sudoku puzzle 3 | *) 4 | Theory killerSudokuEncoderCompile 5 | Ancestors 6 | killerSudokuEncoderProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem killerSudoku_encoder_compiled = 11 | eval_cake_compile_x64 "" killerSudoku_encoder_prog_def 12 | "killerSudoku_encoder.S"; 13 | 14 | -------------------------------------------------------------------------------- /compiler/benchmarks/mlton_benchmarks/cakeml/tak.cml: -------------------------------------------------------------------------------- 1 | (* 2 | A short benchmark program 3 | *) 4 | fun tak x y z = 5 | if not (y < x) 6 | then z 7 | else tak (tak (x - 1) y z) 8 | (tak (y - 1) z x) 9 | (tak (z - 1) x y) 10 | 11 | fun f n = case n of 12 | 0 => () 13 | | n => (tak 33 22 11; f (n-1)) 14 | 15 | structure Main = 16 | struct 17 | val doit = f 18 | end 19 | 20 | val foo = Main.doit 4; 21 | -------------------------------------------------------------------------------- /examples/sat_encodings/translation/compilation/numBoolRangeEncoderCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile the encoder for the numBoolRange datatype 3 | *) 4 | Theory numBoolRangeEncoderCompile 5 | Ancestors 6 | numBoolRangeEncoderProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem numBoolRange_encoder_compiled = 11 | eval_cake_compile_x64 "" numBoolRange_encoder_prog_def 12 | "numBoolRange_encoder.S"; 13 | 14 | -------------------------------------------------------------------------------- /examples/scpog_checker/README.md: -------------------------------------------------------------------------------- 1 | A checker for SCPOG format in CakeML 2 | 3 | [array](array): 4 | Improving the SCPOG checker with arrays (manually) 5 | 6 | [cnf_scpogSemScript.sml](cnf_scpogSemScript.sml): 7 | Defines the syntax and semantics of CNF / SCPOG 8 | 9 | [scpogScript.sml](scpogScript.sml): 10 | Defines the proof checker for SCPOG 11 | 12 | [scpog_parsingScript.sml](scpog_parsingScript.sml): 13 | Parsing interface for CNF and SCPOG files 14 | -------------------------------------------------------------------------------- /examples/xlrup_checker/README.md: -------------------------------------------------------------------------------- 1 | An XLRUP checker built on CakeML 2 | 3 | [array](array): 4 | Improving the XLRUP checker with arrays (manually) 5 | 6 | [cnf_extScript.sml](cnf_extScript.sml): 7 | Syntax and semantics of CNF extended with theories 8 | 9 | [xlrupScript.sml](xlrupScript.sml): 10 | Basic specification of an xlrup checker (minimal optimization) 11 | 12 | [xlrup_parsingScript.sml](xlrup_parsingScript.sml): 13 | Parsing interface for XLRUP 14 | -------------------------------------------------------------------------------- /translator/monadic/monad_base/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/semantics 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/pattern_matching/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/semantics 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/ag32/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/common ../asm 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/mccisCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the MCCIS + PB checker 3 | *) 4 | Theory mccisCompile 5 | Ancestors 6 | mccisProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib eval_cake_compile_arm8Lib 9 | 10 | Theorem mccis_compiled = 11 | eval_cake_compile_x64 "" main_prog_def "cake_pb_mccis.S"; 12 | 13 | Theorem mccis_compiled_arm8 = 14 | eval_cake_compile_arm8 "arm8_" main_prog_def "cake_pb_mccis_arm8.S"; 15 | 16 | -------------------------------------------------------------------------------- /examples/sat_encodings/translation/compilation/graphColoringEncoderCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the encoder for the graph coloring problem 3 | *) 4 | Theory graphColoringEncoderCompile 5 | Ancestors 6 | graphColoringEncoderProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem graphColoring_encoder_compiled = 11 | eval_cake_compile_x64 "" graphColoring_encoder_prog_def 12 | "graphColoring_encoder.S"; 13 | 14 | -------------------------------------------------------------------------------- /translator/other-examples/example_qsortScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | This is a simple example of applying the translator to a 3 | functional version of quick sort. 4 | *) 5 | Theory example_qsort 6 | Ancestors 7 | ninetyOne arithmetic list sorting regexpMatch 8 | Libs 9 | ml_translatorLib 10 | 11 | (* qsort *) 12 | 13 | val res = translate APPEND; 14 | val res = translate PART_DEF; 15 | val res = translate PARTITION_DEF; 16 | val res = translate QSORT_DEF; 17 | 18 | -------------------------------------------------------------------------------- /compiler/backend/ag32/proofs/ag32_decompilerLib.sig: -------------------------------------------------------------------------------- 1 | signature ag32_decompilerLib = 2 | sig 3 | 4 | include Abbrev 5 | 6 | val derive_spec : string -> (thm * int * int option) * 7 | (thm * int * int option) option 8 | 9 | val FUNPOW_Next_from_SPEC : thm -> thm -> thm 10 | 11 | val ag32_ffi_return_SPEC : thm 12 | 13 | val ag32_decompile : thm -> thm * thm 14 | 15 | val SPEC_COMPOSE_RULE : thm list -> thm 16 | 17 | end 18 | -------------------------------------------------------------------------------- /compiler/backend/x64/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure .. ../../encoders/x64 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/cliqueCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the max clique + PB checker 3 | *) 4 | Theory cliqueCompile 5 | Ancestors 6 | cliqueProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib eval_cake_compile_arm8Lib 9 | 10 | Theorem clique_compiled = 11 | eval_cake_compile_x64 "" main_prog_def "cake_pb_clique.S"; 12 | 13 | Theorem clique_compiled_arm8 = 14 | eval_cake_compile_arm8 "arm8_" main_prog_def "cake_pb_clique_arm8.S"; 15 | 16 | -------------------------------------------------------------------------------- /compiler/backend/arm7/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure .. ../../encoders/arm7 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/arm8/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure .. ../../encoders/arm8 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/mips/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure .. ../../encoders/mips 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/riscv/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure .. ../../encoders/riscv 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/serialiser/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc .. ../../../translator ../../encoders/asm 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/arm7/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/arm/prog .. ../../asm 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/arm8/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/arm8/prog .. ../../asm 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/mips/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/mips/prog .. ../../asm 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/riscv/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/riscv/prog ../ ../../asm 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/x64/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/x64/prog ../ ../../asm 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/subgraph_isoCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the encoder 3 | *) 4 | Theory subgraph_isoCompile 5 | Ancestors 6 | subgraph_isoProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib eval_cake_compile_arm8Lib 9 | 10 | Theorem subgraph_iso_compiled = 11 | eval_cake_compile_x64 "" main_prog_def "cake_pb_iso.S"; 12 | 13 | Theorem subgraph_iso_compiled_arm8 = 14 | eval_cake_compile_arm8 "arm8_" main_prog_def "cake_pb_iso_arm8.S"; 15 | 16 | -------------------------------------------------------------------------------- /compiler/inference/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/semantics $(CAKEMLDIR)/semantics/proofs .. 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the script that does in-logic compilation of 2 | the OpenTheory article checker. 3 | 4 | [ag32](ag32): 5 | Compilation of the OpenTheory article checker to the Silver ISA. 6 | 7 | [proofs](proofs): 8 | The directory contains end-to-end correctness theorems for the 9 | OpenTheory article checker. 10 | 11 | [readerCompileScript.sml](readerCompileScript.sml): 12 | Compiles the OpenTheory article checker in the logic. 13 | -------------------------------------------------------------------------------- /compiler/encoders/asm/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/common $(CAKEMLDIR)/misc $(CAKEMLDIR)/semantics 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/encoders/monadic_enc/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = ../../backend $(CAKEMLDIR)/misc $(CAKEMLDIR)/translator/monadic/monad_base 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/pseudo_bool/graph_encoding/README.md: -------------------------------------------------------------------------------- 1 | Encoders for various graph problems 2 | 3 | [cliqueScript.sml](cliqueScript.sml): 4 | Formalization of the max clique problem 5 | 6 | [graph_basicScript.sml](graph_basicScript.sml): 7 | Basic graph notions 8 | 9 | [mcisScript.sml](mcisScript.sml): 10 | Formalization of the maximum common induced subgraph problem 11 | 12 | [subgraph_isoScript.sml](subgraph_isoScript.sml): 13 | Formalization of the subgraph isomorphism encoder (non-induced) 14 | -------------------------------------------------------------------------------- /unverified/sexpr-bootstrap/x64/32/README.md: -------------------------------------------------------------------------------- 1 | This directory contains files that create an unverified bootstrap of 2 | the 32-bit compiler. 3 | 4 | [basis_ffi.c](basis_ffi.c): 5 | Implements the foreign function interface (FFI) used in the CakeML basis 6 | library, as a thin wrapper around the relevant system calls. 7 | 8 | [x64SexprScript.sml](x64SexprScript.sml): 9 | Produces an sexp print-out of the bootstrap translated compiler 10 | definition for the 32-bit version of the compiler. 11 | -------------------------------------------------------------------------------- /compiler/backend/arm7/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc .. ../../../encoders/arm7/proofs ../../semantics ../../proofs 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/arm8/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc .. ../../../encoders/arm8/proofs ../../semantics ../../proofs 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/mips/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc .. ../../../encoders/mips/proofs ../../semantics ../../proofs 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/riscv/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc .. ../../../encoders/riscv/proofs ../../semantics ../../proofs 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/backend/x64/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc .. ../../../encoders/x64/proofs ../../semantics ../../proofs 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/dafny/vcg/README.md: -------------------------------------------------------------------------------- 1 | Verification condition generation (VCG) for Dafny. 2 | 3 | [dafny_vcgProofScript.sml](dafny_vcgProofScript.sml): 4 | Proves that the VCG is an implementation of the wp-calculus. 5 | 6 | [dafny_vcgScript.sml](dafny_vcgScript.sml): 7 | Verification Condition Generator for Dafny. 8 | 9 | [dafny_wp_calcScript.sml](dafny_wp_calcScript.sml): 10 | Calculus for VCG for Dafny 11 | 12 | [examples](examples): 13 | Examples of proving and using VCs generated by the VCG. 14 | -------------------------------------------------------------------------------- /pancake/static_checker/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc\ 2 | $(CAKEMLDIR)/pancake\ 3 | $(CAKEMLDIR)/pancake/parser\ 4 | $(CAKEMLDIR)/compiler/ 5 | 6 | 7 | all: $(DEFAULT_TARGETS) README.md 8 | .PHONY: all 9 | 10 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 11 | DIRS = $(wildcard */) 12 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(README_SOURCES) 13 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 14 | -------------------------------------------------------------------------------- /translator/monadic/monad_base/README.md: -------------------------------------------------------------------------------- 1 | The state-and-exception monad that is used by the proof-producing translator 2 | for monadic HOL functions. 3 | 4 | [ml_monadBaseLib.sml](ml_monadBaseLib.sml): 5 | Proof automation for the state-and-exception monad that is supported by the 6 | proof-producing monadic translator. 7 | 8 | [ml_monadBaseScript.sml](ml_monadBaseScript.sml): 9 | Definitions for the state-and-exception monad that is supported by the 10 | proof-producing monadic translator. 11 | -------------------------------------------------------------------------------- /candle/overloading/monadic/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/translator/monadic\ 2 | ../../syntax-lib ../syntax 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | .PHONY: all 6 | 7 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 8 | DIRS = $(wildcard */) 9 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 10 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 11 | -------------------------------------------------------------------------------- /candle/standard/monadic/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/translator/monadic\ 2 | ../../syntax-lib ../syntax 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | .PHONY: all 6 | 7 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 8 | DIRS = $(wildcard */) 9 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 10 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 11 | -------------------------------------------------------------------------------- /semantics/alt_semantics/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = .. ../../misc ../ffi 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /examples/lpr_checker/array/compilation/lpr_arrayCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the lpr example by evaluation inside the logic of HOL 3 | *) 4 | Theory lpr_arrayCompile 5 | Ancestors 6 | lpr_arrayFullProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib 9 | 10 | Theorem lpr_array_compiled = 11 | eval_cake_compile_x64 "" check_unsat_prog_def "cake_lpr.S"; 12 | 13 | (* 14 | val _ = 15 | eval_cake_compile_explore_x64 "explore_" 16 | check_unsat_prog_def "cake_lpr_explore.txt"; 17 | *) 18 | 19 | -------------------------------------------------------------------------------- /examples/pseudo_bool/array/compilation/npbc_fullCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiles the PB checker example by evaluation inside the logic of HOL 3 | *) 4 | Theory npbc_fullCompile 5 | Ancestors 6 | npbc_fullProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib eval_cake_compile_arm8Lib 9 | 10 | Theorem npbc_full_compiled = 11 | eval_cake_compile_x64 "" main_prog_def "cake_pb.S"; 12 | 13 | Theorem npbc_full_compiled_arm8 = 14 | eval_cake_compile_arm8 "arm8_" main_prog_def "cake_pb_arm8.S"; 15 | 16 | -------------------------------------------------------------------------------- /candle/standard/semantics/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure\ 2 | ../../syntax-lib ../../set-theory ../syntax 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | .PHONY: all 6 | 7 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 8 | DIRS = $(wildcard */) 9 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 10 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 11 | -------------------------------------------------------------------------------- /compiler/benchmarks/mlton_benchmarks/sml/tak.sml: -------------------------------------------------------------------------------- 1 | fun tak (x,y,z) = 2 | if not (y < x) 3 | then z 4 | else tak (tak (x - 1, y, z), 5 | tak (y - 1, z, x), 6 | tak (z - 1, x, y)) 7 | 8 | val rec f = 9 | fn 0 => () 10 | | n => (tak (33,22,11); f (n-1)) 11 | 12 | structure Main = 13 | struct 14 | val doit = f 15 | end 16 | 17 | val foo = Main.doit 4; 18 | 19 | (* Quit out correctly for interacive SMLs *) 20 | val _ = OS.Process.exit(OS.Process.success); 21 | -------------------------------------------------------------------------------- /compiler/dafny/examples/abs.dfy: -------------------------------------------------------------------------------- 1 | // Extended https://dafny.org/dafny/OnlineTutorial/guide 2 | 3 | method Abs(x: int) returns (y: int) 4 | ensures 0 <= y && (y == x || y == -x) 5 | { 6 | if x < 0 { 7 | return -x; 8 | } else { 9 | return x; 10 | } 11 | } 12 | 13 | method Main() { 14 | TestAbs(-5); 15 | TestAbs(-1); 16 | TestAbs(0); 17 | TestAbs(1); 18 | TestAbs(7); 19 | } 20 | 21 | method TestAbs(x: int) 22 | { 23 | var r := Abs(x); 24 | print "Abs(", x, ") = ", r, "\n"; 25 | } 26 | -------------------------------------------------------------------------------- /compiler/encoders/mips/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for MIPS. 3 | 4 | [mips_targetLib.sml](mips_targetLib.sml): 5 | A compset for evaluating the MIPS instruction encoder and config. 6 | 7 | [mips_targetScript.sml](mips_targetScript.sml): 8 | Define the target compiler configuration for MIPS. 9 | 10 | [proofs](proofs): 11 | This directory contains a theorem stating that the compiler 12 | configuration for the MIPS target is OK. 13 | -------------------------------------------------------------------------------- /examples/deflate/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 9 | 10 | ifdef POLY 11 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 12 | endif 13 | -------------------------------------------------------------------------------- /candle/overloading/semantics/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure\ 2 | ../../syntax-lib ../../set-theory ../syntax 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | .PHONY: all 6 | 7 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 8 | DIRS = $(wildcard */) 9 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 10 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 11 | -------------------------------------------------------------------------------- /compiler/encoders/arm8/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for ARMv8. 3 | 4 | [arm8_targetLib.sml](arm8_targetLib.sml): 5 | A compset for evaluating the ARMv8 instruction encoder and config. 6 | 7 | [arm8_targetScript.sml](arm8_targetScript.sml): 8 | Define the target compiler configuration for ARMv8. 9 | 10 | [proofs](proofs): 11 | This directory contains a theorem stating that the compiler 12 | configuration for the ARMv8 target is OK. 13 | -------------------------------------------------------------------------------- /examples/template/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 9 | 10 | ifdef POLY 11 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 12 | endif 13 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/tests/fib.ml: -------------------------------------------------------------------------------- 1 | (* Translated from 2 | https://github.com/MLton/mlton/blob/master/benchmark/tests/fib.sml *) 3 | 4 | let rec fib = function 5 | | 0 -> 0 6 | | 1 -> 1 7 | | n -> fib (n - 1) + fib (n - 2) 8 | 9 | module Main = struct 10 | let rec doit n = 11 | if n = 0 then 12 | () 13 | else 14 | let _ = if 165580141 <> fib 41 then failwith "bug" else () in 15 | doit (n - 1) 16 | end 17 | 18 | let x = "Start" 19 | let x = Main.doit 1 20 | let x = "Stop" 21 | -------------------------------------------------------------------------------- /compiler/encoders/riscv/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for RISC-V. 3 | 4 | [proofs](proofs): 5 | This directory contains a theorem stating that the compiler 6 | configuration for the RISC-V target is OK. 7 | 8 | [riscv_targetLib.sml](riscv_targetLib.sml): 9 | A compset for evaluating the RISC-V instruction encoder and config. 10 | 11 | [riscv_targetScript.sml](riscv_targetScript.sml): 12 | Define the target compiler configuration for RISC-V. 13 | -------------------------------------------------------------------------------- /examples/sat_encodings/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 9 | 10 | ifdef POLY 11 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 12 | endif 13 | -------------------------------------------------------------------------------- /translator/other-examples/example_regexp_matcherScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | This is a simple example of applying the translator to a 3 | matcher for regular expressions. 4 | *) 5 | Theory example_regexp_matcher 6 | Ancestors 7 | arithmetic list sorting regexpMatch ml_translator 8 | Libs 9 | ml_translatorLib 10 | 11 | (* matcher -- recursion over a datatype *) 12 | 13 | val _ = register_type ``:'a # 'b``; 14 | 15 | val res = translate MEMBER_def 16 | val res = translate (match_def |> REWRITE_RULE [MEMBER_INTRO]) 17 | 18 | -------------------------------------------------------------------------------- /candle/standard/ml_kernel/lisp/README.md: -------------------------------------------------------------------------------- 1 | Parsing and pretty printing of simple s-expressions 2 | 3 | [lisp_parsingScript.sml](lisp_parsingScript.sml): 4 | Parsing of Lisp s-expressions 5 | 6 | [lisp_parsing_proofsScript.sml](lisp_parsing_proofsScript.sml): 7 | Proof that pretty printong then parsing returns the same 8 | 9 | [lisp_printingScript.sml](lisp_printingScript.sml): 10 | Pretty printing for Lisp s-expressions 11 | 12 | [lisp_valuesScript.sml](lisp_valuesScript.sml): 13 | Definition of simple Lisp s-expressions 14 | -------------------------------------------------------------------------------- /compiler/backend/ag32/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure $(CAKEMLDIR)/basis\ 2 | .. ../../encoders/ag32 ../../encoders/asm 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | .PHONY: all 6 | 7 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 8 | DIRS = $(wildcard */) 9 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 10 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 11 | -------------------------------------------------------------------------------- /compiler/dafny/dafny_miscScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Various definitions that are used by multiple files, but don't quite fit in 3 | any of them. 4 | *) 5 | Theory dafny_misc 6 | Libs 7 | preamble 8 | 9 | Theorem OPT_MMAP_LENGTH: 10 | ∀xs ys. OPT_MMAP f xs = SOME ys ⇒ LENGTH ys = LENGTH xs 11 | Proof 12 | Induct \\ simp [] 13 | \\ gen_tac \\ Cases \\ simp [] 14 | QED 15 | 16 | Theorem MEM_MAP_FST: 17 | ∀xs. MEM (x,y) xs ⇒ MEM x (MAP FST xs) 18 | Proof 19 | Induct \\ gvs [] 20 | \\ rpt strip_tac \\ gvs [] 21 | QED 22 | -------------------------------------------------------------------------------- /compiler/dafny/examples/add_one_n_times.dfy: -------------------------------------------------------------------------------- 1 | method AddOneNTimes(n: int) returns (r: int) 2 | requires n >= 0 3 | ensures r == n 4 | ensures n >= 0 5 | { 6 | r := 0; 7 | 8 | while r < n 9 | invariant 0 <= r <= n 10 | { 11 | r := r + 1; 12 | } 13 | } 14 | 15 | method Main() { 16 | TestAddOneNTimes(0); 17 | TestAddOneNTimes(1); 18 | TestAddOneNTimes(5); 19 | } 20 | 21 | method TestAddOneNTimes(n: int) 22 | { 23 | var r := AddOneNTimes(n); 24 | print "AddOneNTimes(", n, ") = ", r, "\n"; 25 | } 26 | -------------------------------------------------------------------------------- /compiler/printing/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/semantics \ 2 | $(CAKEMLDIR)/basis/pure \ 3 | $(CAKEMLDIR)/compiler/inference 4 | 5 | all: $(DEFAULT_TARGETS) README.md 6 | .PHONY: all 7 | 8 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 9 | DIRS = $(wildcard */) 10 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 11 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 12 | -------------------------------------------------------------------------------- /translator/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = ../developers ../misc ../semantics ../semantics/proofs ../basis/pure 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: ../developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect ../developers/readme_gen) $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /compiler/backend/reg_alloc/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/unverified/reg_alloc $(CAKEMLDIR)/translator/monadic/monad_base $(CAKEMLDIR)/basis/pure 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /examples/xlrup_checker/array/README.md: -------------------------------------------------------------------------------- 1 | Improving the XLRUP checker with arrays (manually) 2 | 3 | [compilation](compilation): 4 | An XLRUP checker built on CakeML with arrays 5 | 6 | [xlrup_arrayFullProgScript.sml](xlrup_arrayFullProgScript.sml): 7 | This builds the cake_xlrup proof checker 8 | 9 | [xlrup_arrayProgScript.sml](xlrup_arrayProgScript.sml): 10 | This refines xlrup_list to use arrays 11 | 12 | [xlrup_listScript.sml](xlrup_listScript.sml): 13 | This refines the checker to a fixed-size, list-based implementation 14 | -------------------------------------------------------------------------------- /pancake/pan_to_wordScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compiler from pan to word 3 | *) 4 | Theory pan_to_word 5 | Ancestors 6 | pan_simp pan_globals pan_to_crep crep_to_loop loop_to_word 7 | Libs 8 | preamble 9 | 10 | Definition compile_prog_def: 11 | compile_prog arch prog = 12 | let prog = pan_simp$compile_prog prog; 13 | prog = pan_globals$compile_top prog «main»; 14 | prog = pan_to_crep$compile_prog prog; 15 | prog = crep_to_loop$compile_prog arch prog in 16 | loop_to_word$compile prog 17 | End 18 | 19 | 20 | -------------------------------------------------------------------------------- /translator/okasaki-examples/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis .. 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /examples/scpog_checker/array/README.md: -------------------------------------------------------------------------------- 1 | Improving the SCPOG checker with arrays (manually) 2 | 3 | [compilation](compilation): 4 | An SCPOG checker built on CakeML with arrays 5 | 6 | [scpog_arrayFullProgScript.sml](scpog_arrayFullProgScript.sml): 7 | This builds the cake_scpog proof checker 8 | 9 | [scpog_arrayProgScript.sml](scpog_arrayProgScript.sml): 10 | This refines scpog_list to use arrays 11 | 12 | [scpog_listScript.sml](scpog_listScript.sml): 13 | This refines the SCPOG checker to a fixed-size, list-based implementation. 14 | -------------------------------------------------------------------------------- /examples/template/translation/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = .. $(CAKEMLDIR)/misc $(CAKEMLDIR)/translator 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 9 | 10 | ifdef POLY 11 | HOLHEAP = $(CAKEMLDIR)/basis/basis-heap 12 | endif 13 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/Makefile: -------------------------------------------------------------------------------- 1 | FILES = formatted 2 | INTERFACES = patternZipper.mli preprocessor.mli 3 | 4 | all: $(FILES) 5 | 6 | clean: 7 | rm -f *.cmi *.cmx *.o $(FILES) 8 | 9 | formatted: preprocessor.ml formatDecl.ml formatted.ml 10 | ocamlfind c -c -package compiler-libs.common -package batteries -linkpkg $(INTERFACES) 11 | ocamlfind opt -o formatted -package compiler-libs.common -package batteries -linkpkg patternZipper.ml preprocessor.ml formatDecl.ml formatted.ml 12 | touch ocaml2cakeml 13 | 14 | .PHONY: all clean 15 | -------------------------------------------------------------------------------- /compiler/dafny/examples/is_even.dfy: -------------------------------------------------------------------------------- 1 | method IsEven(n: int) returns (b: bool) 2 | requires n >= 0 3 | ensures b == (n % 2 == 0) 4 | { 5 | if n == 0 { 6 | b := true; 7 | } else if n == 1 { 8 | b := false; 9 | } else { 10 | b := IsEven(n-2); 11 | } 12 | } 13 | 14 | method Main() { 15 | TestIsEven(0); 16 | TestIsEven(1); 17 | TestIsEven(2); 18 | TestIsEven(5); 19 | TestIsEven(10); 20 | } 21 | 22 | method TestIsEven(n: int) 23 | { 24 | var r := IsEven(n); 25 | print "IsEven(", n, ") = ", r, "\n"; 26 | } 27 | -------------------------------------------------------------------------------- /compiler/dafny/translation/dafny_remove_assertProgScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Translates definitions for removing assert. 3 | *) 4 | Theory dafny_remove_assertProg 5 | Ancestors 6 | dafny_freshenProg dafny_remove_assert 7 | Libs 8 | preamble ml_translatorLib 9 | 10 | 11 | val _ = translation_extends "dafny_freshenProg"; 12 | 13 | val r = translate dafny_remove_assertTheory.remove_assert_stmt_def; 14 | val r = translate dafny_remove_assertTheory.remove_assert_member_def; 15 | val r = translate dafny_remove_assertTheory.remove_assert_def; 16 | -------------------------------------------------------------------------------- /examples/flover/Infra/ResultsLib.sml: -------------------------------------------------------------------------------- 1 | (** 2 | A monad for results used by FlOVer 3 | **) 4 | structure ResultsLib = 5 | struct 6 | 7 | open monadsyntax; 8 | open ResultsTheory; 9 | 10 | val res_monad = declare_monad ("Results", 11 | {bind = ``result_bind``, 12 | ignorebind = SOME ``result_ignore_bind``, 13 | unit = ``result_return``, 14 | fail = NONE, choice = NONE, guard = NONE}); 15 | 16 | val _ = monadsyntax.enable_monadsyntax(); 17 | val _ = List.app monadsyntax.enable_monad ["option", "Results"]; 18 | 19 | end 20 | -------------------------------------------------------------------------------- /examples/vipr/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/developers $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /compiler/backend/serialiser/README.md: -------------------------------------------------------------------------------- 1 | Proofs and automation for serialising HOL values. 2 | 3 | [backend_enc_decScript.sml](backend_enc_decScript.sml): 4 | Encoders and decoders to/from configuration types in backend. 5 | 6 | [num_list_enc_decScript.sml](num_list_enc_decScript.sml): 7 | Encoders and decoders to/from types represented as prefixes of lists 8 | of natural numbers. 9 | 10 | [num_tree_enc_decScript.sml](num_tree_enc_decScript.sml): 11 | Encoders and decoders to/from types represented as trees 12 | consisting of natural numbers. 13 | -------------------------------------------------------------------------------- /semantics/alt_semantics/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc .. ../.. ../../proofs ../../ffi 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /basis/basis.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Convenience structure that re-exports all the libraries and theories of the 3 | CakeML basis library. 4 | *) 5 | structure basis = struct open 6 | 7 | ml_translatorTheory ml_progLib ml_translatorLib cfLib 8 | std_preludeTheory 9 | 10 | clFFITheory 11 | fsFFITheory fsFFIPropsTheory 12 | 13 | mlstringTheory 14 | 15 | ListProofTheory 16 | Word8ArrayProofTheory 17 | ArrayProofTheory 18 | CommandLineProofTheory 19 | TextIOProgTheory TextIOProofTheory 20 | 21 | basisProgTheory basisFunctionsLib basis_ffiLib 22 | 23 | end 24 | -------------------------------------------------------------------------------- /compiler/backend/cv_compute/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = .. ../serialiser ../../encoders/x64 ../../encoders/ag32 ../../encoders/arm7 ../../encoders/arm8 ../../encoders/mips ../../encoders/riscv 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/sml/foldl.sml: -------------------------------------------------------------------------------- 1 | fun main ()= 2 | let 3 | fun foldl f e xs = 4 | case xs of [] => e 5 | | (x::xs) => foldl f (f e x) xs; 6 | 7 | fun repeat x n = 8 | if (n = 0) 9 | then [] 10 | else (x::(repeat x (n - 1))); 11 | 12 | val test = foldl (fn x => fn y => x + (foldl (fn x => fn y => x+y) 0 y)) 0 13 | (repeat (repeat 1 40000) 40000); 14 | in () end; 15 | 16 | val _ = main(); 17 | (* Quit out correctly for interacive SMLs *) 18 | val _ = OS.Process.exit(OS.Process.success); 19 | -------------------------------------------------------------------------------- /compiler/dafny/semantics/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis/pure $(CAKEMLDIR)/compiler/dafny 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /compiler/dafny/translation/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/compiler/dafny $(CAKEMLDIR)/translator $(CAKEMLDIR)/basis 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /compiler/parsing/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/formal-languages/context-free\ 2 | $(CAKEMLDIR)/misc $(CAKEMLDIR)/semantics \ 3 | $(CAKEMLDIR)/semantics/proofs 4 | 5 | all: $(DEFAULT_TARGETS) README.md 6 | .PHONY: all 7 | 8 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 9 | DIRS = $(wildcard */) 10 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 11 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 12 | -------------------------------------------------------------------------------- /compiler/printing/test/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis .. $(CAKEMLDIR)/compiler/inference/tests \ 2 | $(CAKEMLDIR)/compiler/parsing $(CAKEMLDIR)/unverified/sexpr-bootstrap 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | -------------------------------------------------------------------------------- /compiler/scheme/translation/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/compiler/scheme $(CAKEMLDIR)/translator # $(CAKEMLDIR)/basis 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/basis/basis-heap 13 | endif 14 | -------------------------------------------------------------------------------- /examples/sat_encodings/demo/killerSudokuExample.lisp: -------------------------------------------------------------------------------- 1 | ((20 (0 1 2)) 2 | (19 (3 13 14 24)) 3 | (26 (4 5 6 15 16)) 4 | (19 (7 8 17 18)) 5 | (11 (10 20 30)) 6 | (6 (11 12)) 7 | (19 (21 31 41 51)) 8 | (12 (22 23)) 9 | (25 (25 26 35 36)) 10 | (29 (27 28 37 38 48)) 11 | (28 (32 33 34 44 45 55 65)) 12 | (25 (40 50 60 61)) 13 | (22 (42 52 62 63 64)) 14 | (17 (43 53 54)) 15 | (12 (46 47 57 58)) 16 | (15 (56 66)) 17 | (7 (67 77)) 18 | (24 (68 78 88)) 19 | (22 (70 71 80 81)) 20 | (26 (72 82 83 84)) 21 | (13 (73 74 75 76)) 22 | (8 (85 86 87))) 23 | -------------------------------------------------------------------------------- /compiler/backend/ag32/export_ag32Script.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Define the format of the compiler-generated output file for ag32 3 | *) 4 | Theory export_ag32 5 | Ancestors 6 | export mlstring 7 | Libs 8 | preamble 9 | 10 | Definition ag32_export_def: 11 | ag32_export (ffi_names:string list) bytes (data:word32 list) 12 | (syms: (mlstring # num # num) list) exp ret pk = 13 | SmartAppend 14 | (split16 (words_line (strlit".data_word ") word_to_string) data) 15 | (split16 (words_line (strlit".code_byte ") byte_to_string) bytes) 16 | End 17 | 18 | -------------------------------------------------------------------------------- /developers/bin/README.md: -------------------------------------------------------------------------------- 1 | This directory represents a stage in the build sequence where the latest 2 | available cake binary is downloaded to perform testing and bootstrapping. 3 | 4 | [basis_ffi.c](basis_ffi.c): 5 | Implements the foreign function interface (FFI) used in the CakeML basis 6 | library, as a thin wrapper around the relevant system calls. 7 | 8 | [hello.cml](hello.cml): 9 | A simple hello world program in CakeML 10 | 11 | [repl_boot.cml](repl_boot.cml): 12 | This file gives the CakeML REPL multi-line input and file loading 13 | capabilities. 14 | -------------------------------------------------------------------------------- /compiler/dafny/vcg/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/compiler/dafny $(CAKEMLDIR)/compiler/dafny/semantics $(HOLDIR)/examples/algorithms 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /compiler/dafny/vcg/examples/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/compiler/dafny/vcg $(CAKEMLDIR)/compiler/dafny/proofs $(CAKEMLDIR)/translator 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 7 | DIRS = $(wildcard */) 8 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 10 | 11 | ifdef POLY 12 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 13 | endif 14 | -------------------------------------------------------------------------------- /compiler/backend/presLangLib.sig: -------------------------------------------------------------------------------- 1 | signature presLangLib = 2 | sig 3 | 4 | include Abbrev 5 | 6 | val flat_to_strs : term (* prog *) -> string list 7 | val clos_to_strs : term (* prog *) -> string list 8 | val bvl_to_strs : term (* names *) -> term (* prog *) -> string list 9 | val bvi_to_strs : term (* names *) -> term (* prog *) -> string list 10 | val data_to_strs : term (* names *) -> term (* prog *) -> string list 11 | 12 | val print_strs : string list -> unit 13 | 14 | val write_strs_to_file : string -> string list -> unit 15 | 16 | end 17 | -------------------------------------------------------------------------------- /compiler/dafny/examples/mccarthy.dfy: -------------------------------------------------------------------------------- 1 | // Adapted from Dafny (MIT License): https://github.com/dafny-lang/dafny 2 | 3 | method M(n: int) returns (r: int) 4 | ensures r == if n <= 100 then 91 else n - 10 5 | decreases 111 - n 6 | { 7 | if n <= 100 { 8 | var tmp := M(n + 11); 9 | r := M(tmp); 10 | } else { 11 | r := n - 10; 12 | } 13 | } 14 | 15 | 16 | method TestM(n: int) { 17 | var m := M(n); 18 | print "M(", n, ") = ", m, "\n"; 19 | } 20 | 21 | method Main() { 22 | TestM(3); 23 | TestM(99); 24 | TestM(100); 25 | TestM(101); 26 | TestM(1013); 27 | } -------------------------------------------------------------------------------- /examples/template/compilation/example_funsCompileScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Compile the encoder for the sudoku puzzle 3 | *) 4 | Theory example_funsCompile 5 | Ancestors 6 | example_funsProg 7 | Libs 8 | preamble eval_cake_compile_x64Lib eval_cake_compile_arm8Lib 9 | 10 | Theorem example_funs_compiled_x64 = 11 | eval_cake_compile_x64 "x64_" example_funs_prog_def 12 | "example_funs_x64.S"; 13 | 14 | Theorem example_funs_compiled_arm8 = 15 | eval_cake_compile_arm8 "arm8_" example_funs_prog_def 16 | "example_funs_arm8.S"; 17 | -------------------------------------------------------------------------------- /examples/flover/Infra/README.md: -------------------------------------------------------------------------------- 1 | Infrastructural lemmas and formalizations for FloVer 2 | 3 | [FloverCompLib.sml](FloverCompLib.sml): 4 | Small changes to computeLib for FloVer 5 | 6 | [MachineTypeScript.sml](MachineTypeScript.sml): 7 | f machine-precision as a datatype for mixed-precision computations 8 | 9 | [RealSimpsScript.sml](RealSimpsScript.sml): 10 | Real-number simplification theorems 11 | 12 | [ResultsLib.sml](ResultsLib.sml): 13 | A monad for results used by FlOVer 14 | 15 | [ResultsScript.sml](ResultsScript.sml): 16 | A simple Result datatype to ease some implementations 17 | -------------------------------------------------------------------------------- /compiler/dafny/translation/result_monadProgScript.sml: -------------------------------------------------------------------------------- 1 | (* 2 | Translates the definitions for the result monad. 3 | *) 4 | Theory result_monadProg 5 | Ancestors 6 | dafny_astProg result_monad 7 | Libs 8 | preamble ml_translatorLib 9 | 10 | 11 | val _ = translation_extends "dafny_astProg"; 12 | 13 | val r = translate result_monadTheory.bind_def; 14 | val r = translate result_monadTheory.result_mmap_def; 15 | val r = translate result_monadTheory.result_mmap2_def; 16 | val r = translate result_monadTheory.prefix_error_def; 17 | val r = translate result_monadTheory.extend_path_def; 18 | 19 | -------------------------------------------------------------------------------- /compiler/encoders/x64/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/common\ 2 | $(HOLDIR)/examples/l3-machine-code/x64/model\ 3 | $(HOLDIR)/examples/l3-machine-code/x64/step\ 4 | ../asm 5 | 6 | all: $(DEFAULT_TARGETS) README.md 7 | .PHONY: all 8 | 9 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 10 | DIRS = $(wildcard */) 11 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 12 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 13 | -------------------------------------------------------------------------------- /semantics/proofs/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/formal-languages/context-free\ 2 | $(CAKEMLDIR)/developers $(CAKEMLDIR)/misc\ 3 | .. ../ffi 4 | 5 | all: $(DEFAULT_TARGETS) README.md 6 | .PHONY: all 7 | 8 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 9 | DIRS = $(wildcard */) 10 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 11 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 12 | 13 | ifdef POLY 14 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 15 | endif 16 | -------------------------------------------------------------------------------- /compiler/encoders/arm7/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/common\ 2 | $(HOLDIR)/examples/l3-machine-code/arm/model\ 3 | $(HOLDIR)/examples/l3-machine-code/arm/step\ 4 | ../asm 5 | 6 | all: $(DEFAULT_TARGETS) README.md 7 | .PHONY: all 8 | 9 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 10 | DIRS = $(wildcard */) 11 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 12 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 13 | -------------------------------------------------------------------------------- /compiler/encoders/arm8/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/common\ 2 | $(HOLDIR)/examples/l3-machine-code/arm8/model\ 3 | $(HOLDIR)/examples/l3-machine-code/arm8/step\ 4 | ../asm 5 | 6 | all: $(DEFAULT_TARGETS) README.md 7 | .PHONY: all 8 | 9 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 10 | DIRS = $(wildcard */) 11 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 12 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 13 | -------------------------------------------------------------------------------- /compiler/encoders/mips/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/common\ 2 | $(HOLDIR)/examples/l3-machine-code/mips/model\ 3 | $(HOLDIR)/examples/l3-machine-code/mips/step\ 4 | ../asm 5 | 6 | all: $(DEFAULT_TARGETS) README.md 7 | .PHONY: all 8 | 9 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 10 | DIRS = $(wildcard */) 11 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 12 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 13 | -------------------------------------------------------------------------------- /developers/readmePrefix: -------------------------------------------------------------------------------- 1 | This directory contains scripts for automating routine tasks, e.g., for 2 | generating README.md files. 3 | 4 | [rebuild-excludes](rebuild-excludes): 5 | A list of glob patterns that should be omitted when packaging up a (partially) 6 | built working directory for examination/rebuilding elsewhere (using HOL's 7 | relocbuild facility). 8 | 9 | [artefacts](artefacts): 10 | A list of paths to files that are considered to be the (non-theory) outputs of 11 | a successful build. As with rebuild-excludes and build-sequence, these are 12 | paths relative to the root directory. 13 | -------------------------------------------------------------------------------- /compiler/backend/San/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/semantics $(CAKEMLDIR)/semantics/proofs \ 2 | .. ../../encoders/asm ../reg_alloc ../../encoders/riscv ../semantics \ 3 | ../../encoders/riscv/proofs 4 | 5 | all: $(DEFAULT_TARGETS) README.md 6 | .PHONY: all 7 | 8 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 9 | DIRS = $(wildcard */) 10 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 11 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 12 | -------------------------------------------------------------------------------- /compiler/encoders/riscv/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/l3-machine-code/common\ 2 | $(HOLDIR)/examples/l3-machine-code/riscv/model\ 3 | $(HOLDIR)/examples/l3-machine-code/riscv/step\ 4 | ../asm 5 | 6 | all: $(DEFAULT_TARGETS) README.md 7 | .PHONY: all 8 | 9 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 10 | DIRS = $(wildcard */) 11 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 12 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 13 | -------------------------------------------------------------------------------- /examples/deflate/translation/README.md: -------------------------------------------------------------------------------- 1 | Translation scripts for Defalte. 2 | 3 | [compilation](compilation): 4 | Scripts for compilation of Deflate 5 | 6 | [compressionProgScript.sml](compressionProgScript.sml): 7 | Encoding program for simple compression 8 | 9 | [decompressionProgScript.sml](decompressionProgScript.sml): 10 | Encoding program for simple decompression 11 | 12 | [deflateDecodeProgScript.sml](deflateDecodeProgScript.sml): 13 | Encoding program for the Deflate Decoder 14 | 15 | [deflateEncodeProgScript.sml](deflateEncodeProgScript.sml): 16 | Encoding program for the Deflate Encoder 17 | -------------------------------------------------------------------------------- /basis/pure/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(HOLDIR)/examples/formal-languages/regular \ 2 | $(HOLDIR)/examples/data-structures/balanced_bst $(CAKEMLDIR)/semantics 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | .PHONY: all 6 | 7 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 8 | DIRS = $(wildcard */) 9 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 10 | $(CAKEMLDIR)/developers/readme_gen $(README_SOURCES) 11 | 12 | ifdef POLY 13 | HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap 14 | endif 15 | -------------------------------------------------------------------------------- /compiler/dafny/examples/sum_to_n.dfy: -------------------------------------------------------------------------------- 1 | method SumToN(n: int) returns (sum: int) 2 | requires n >= 0 3 | ensures sum == n * (n + 1) / 2 4 | ensures n >= 0 5 | { 6 | var i := 1; 7 | sum := 0; 8 | 9 | while i <= n 10 | invariant 1 <= i <= n + 1 11 | invariant sum == (i - 1) * i / 2 12 | { 13 | sum := sum + i; 14 | i := i + 1; 15 | } 16 | } 17 | 18 | method Main() { 19 | TestSumToN(0); 20 | TestSumToN(1); 21 | TestSumToN(5); 22 | TestSumToN(10); 23 | } 24 | 25 | method TestSumToN(n: int) 26 | { 27 | var r := SumToN(n); 28 | print "SumToN(", n, ") = ", r, "\n"; 29 | } 30 | -------------------------------------------------------------------------------- /examples/pseudo_bool/graph_encoding/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/developers $(CAKEMLDIR)/misc\ 2 | $(CAKEMLDIR)/semantics $(CAKEMLDIR)/basis/pure $(CAKEMLDIR)/basis\ 3 | $(CAKEMLDIR)/translator $(CAKEMLDIR)/characteristic .. 4 | 5 | all: $(DEFAULT_TARGETS) README.md 6 | .PHONY: all 7 | 8 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 9 | DIRS = $(wildcard */) 10 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 11 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 12 | -------------------------------------------------------------------------------- /unverified/ocaml-syntax/tests/Makefile: -------------------------------------------------------------------------------- 1 | FILES = $(basename $(wildcard *.ml)) 2 | 3 | all: $(FILES) 4 | 5 | $(FILES): ../ocaml2cakeml $(addsuffix .ml, $(FILES)) 6 | ocamlfind opt -o $@ $@.ml 7 | ../ocaml2cakeml $@.ml > $@.cml 8 | [ -f $@-patch ] && ./$@-patch || : 9 | ! grep -E "^Error:" $@.cml 10 | 11 | clean: 12 | rm -f *.cmi *.cmx *.o *.cml *.out $(FILES) 13 | 14 | TESTS = $(addsuffix .out, $(FILES)) 15 | CAKE = ~/cakeml-v1-beta/cake 16 | 17 | %.out: %.cml % $(CAKE) 18 | cat $< | $(CAKE) > $@ 19 | grep "error>" $@ || echo "Success" 20 | 21 | test: $(TESTS) all 22 | 23 | .PHONY: all clean test 24 | -------------------------------------------------------------------------------- /compiler/benchmarks/cakeml_benchmarks/cakeml/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(dprot $(CAKEMLDIR)/unverified/sexpr-bootstrap/x64/64) 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) $(wildcard *.cml) 7 | DIRS = $(wildcard */) 8 | README.md: $(dprot $(CAKEMLDIR)/developers/readme_gen) readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | 11 | cake.S: $(dprot $(CAKEMLDIR)/unverified/sexpr-bootstrap/x64/64/cake.S) 12 | $(CP) $< $@ 13 | -------------------------------------------------------------------------------- /compiler/benchmarks/mlton_benchmarks/cakeml/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(dprot $(CAKEMLDIR)/unverified/sexpr-bootstrap/x64/64) 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | 6 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) $(wildcard *.cml) 7 | DIRS = $(wildcard */) 8 | README.md: $(dprot $(CAKEMLDIR)/developers/readme_gen) readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 9 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 10 | 11 | cake.S: $(dprot $(CAKEMLDIR)/unverified/sexpr-bootstrap/x64/64/cake.S) 12 | $(CP) $< $@ 13 | -------------------------------------------------------------------------------- /compiler/encoders/x64/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for x64. 3 | 4 | [proofs](proofs): 5 | This directory contains a theorem stating that the compiler 6 | configuration for the x64 target is OK. 7 | 8 | [x64_eval_encodeScript.sml](x64_eval_encodeScript.sml): 9 | Pre-evaluate encoder (to help speed up EVAL) 10 | 11 | [x64_targetLib.sml](x64_targetLib.sml): 12 | A compset for evaluating the x64 instruction encoder and config. 13 | 14 | [x64_targetScript.sml](x64_targetScript.sml): 15 | Define the target compiler configuration for x64. 16 | -------------------------------------------------------------------------------- /compiler/parsing/ocaml/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(HOLDIR)/examples/formal-languages/context-free\ 2 | $(CAKEMLDIR)/misc\ 3 | $(CAKEMLDIR)/semantics\ 4 | $(CAKEMLDIR)/semantics/proofs\ 5 | $(CAKEMLDIR)/basis/pure\ 6 | .. 7 | 8 | all: $(DEFAULT_TARGETS) README.md 9 | .PHONY: all 10 | 11 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 12 | DIRS = $(wildcard */) 13 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 14 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 15 | -------------------------------------------------------------------------------- /compiler/parsing/ocaml/README.md: -------------------------------------------------------------------------------- 1 | OCaml lexer and parser frontend for the Candle theorem prover. 2 | 3 | [camlPEGScript.sml](camlPEGScript.sml): 4 | Definition of a PEG for (a subset of) OCaml. 5 | 6 | [camlPtreeConversionScript.sml](camlPtreeConversionScript.sml): 7 | A theory for converting OCaml parse trees to abstract syntax. 8 | 9 | [camlTestsScript.sml](camlTestsScript.sml): 10 | Some tests for the OCaml parser. 11 | 12 | [caml_lexScript.sml](caml_lexScript.sml): 13 | Lexer for the OCaml frontend. 14 | 15 | [caml_parserScript.sml](caml_parserScript.sml): 16 | Parser entry-point for the OCaml parser. 17 | -------------------------------------------------------------------------------- /developers/wc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ## A script that counts non-blank lines. 3 | 4 | find . -name '*Script.sml' -o -name '*Lib.sml' | 5 | grep -E -v 'hollogs|candle|flame|lem_lib|examples|tests|unverified|_demo' | 6 | xargs cat | 7 | sed '/(\*/{: a ; /\*)/b b ; N ; b a ; : b ; d}' | # delete comments 8 | sed '/^\s*$/d' | # delete blank lines 9 | wc -l 10 | 11 | # semantics 3942 12 | # metatheory 8420 13 | # parsing 5064 14 | # inference 5484 15 | # bytecode 1637 16 | # compiler 22086 17 | # repl 3021 18 | # bootstrap 1568 19 | # x86-64 14747 20 | # translator 5116 21 | # misc 1348 22 | -------------------------------------------------------------------------------- /compiler/backend/pattern_matching/README.md: -------------------------------------------------------------------------------- 1 | The CakeML pattern matching expressions compiler 2 | 3 | [pattern_commonScript.sml](pattern_commonScript.sml): 4 | Types common to some different parts of the pattern match compiler. 5 | 6 | [pattern_compScript.sml](pattern_compScript.sml): 7 | A simple pattern compiler that moves constant patterns upwards, 8 | checks for exhaustiveness, and then converts the pattern rows into 9 | an if-then-else decision tree. 10 | 11 | [pattern_semanticsScript.sml](pattern_semanticsScript.sml): 12 | The syntax and semantics of the input and output to the 13 | pattern-match compiler. 14 | -------------------------------------------------------------------------------- /compiler/encoders/ag32/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the definition of the instruction encoder and 2 | compiler configuration for Silver. 3 | 4 | [ag32Script.sml](ag32Script.sml): 5 | An instruction set model generated from Anthony Fox's L3 tool. 6 | [ag32_targetLib.sml](ag32_targetLib.sml): 7 | A compset for evaluating the ag32 instruction encoder and config. 8 | 9 | [ag32_targetScript.sml](ag32_targetScript.sml): 10 | Define the target compiler configuration for ag32. 11 | 12 | [proofs](proofs): 13 | This directory contains a theorem stating that the compiler 14 | configuration for the Silver target is OK. 15 | -------------------------------------------------------------------------------- /compiler/scheme/compilation/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/compiler/scheme/translation $(CAKEMLDIR)/compiler $(CAKEMLDIR)/cv_translator $(CAKEMLDIR)/developers/bin 2 | 3 | all: $(DEFAULT_TARGETS) README.md 4 | .PHONY: all 5 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 6 | DIRS = $(wildcard */) 7 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 8 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 9 | 10 | ifdef POLY 11 | HOLHEAP = $(CAKEMLDIR)/cv_translator/cake_compile_heap 12 | endif 13 | -------------------------------------------------------------------------------- /examples/compilation/ag32/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis $(CAKEMLDIR)/compiler $(CAKEMLDIR)/cv_translator ../.. 2 | CLINE_OPTIONS = -j1 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | .PHONY: all 6 | 7 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 8 | DIRS = $(wildcard */) 9 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 10 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 11 | 12 | ifdef POLY 13 | HOLHEAP = $(CAKEMLDIR)/cv_translator/cake_compile_heap 14 | endif 15 | -------------------------------------------------------------------------------- /examples/lpr_checker/README.md: -------------------------------------------------------------------------------- 1 | An LPR checker built on CakeML 2 | 3 | [array](array): 4 | Improving the LRAT checker with arrays (manually) 5 | 6 | [lprScript.sml](lprScript.sml): 7 | Basic specification of an LPR checker (minimal optimization) 8 | 9 | [lpr_parsingScript.sml](lpr_parsingScript.sml): 10 | Parsing interface for DIMACS and LPR 11 | 12 | [packingScript.sml](packingScript.sml): 13 | Packing chromatic number 14 | 15 | [ramseyScript.sml](ramseyScript.sml): 16 | Defining the Ramsey number and SAT encoding 17 | 18 | [satSemScript.sml](satSemScript.sml): 19 | Semantics of CNFs and general clausal proofs 20 | -------------------------------------------------------------------------------- /examples/opentheory/compilation/ag32/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES = $(CAKEMLDIR)/misc $(CAKEMLDIR)/basis $(CAKEMLDIR)/cv_translator $(CAKEMLDIR)/compiler\ 2 | ../.. 3 | 4 | all: $(DEFAULT_TARGETS) README.md 5 | .PHONY: all 6 | 7 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 8 | DIRS = $(wildcard */) 9 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 10 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 11 | 12 | ifdef POLY 13 | HOLHEAP = $(CAKEMLDIR)/cv_translator/cake_compile_heap 14 | endif 15 | -------------------------------------------------------------------------------- /pancake/parser/README.md: -------------------------------------------------------------------------------- 1 | The Pancake parser. 2 | 3 | [panConcreteExamplesScript.sml](panConcreteExamplesScript.sml): 4 | * Pancake concrete syntax examples 5 | * 9th May 2023: Updated with function declarations 6 | * March 2024: Updated with shared memory instructions 7 | 8 | [panLexerScript.sml](panLexerScript.sml): 9 | * A lexer for the Pancake language. 10 | 11 | [panPEGScript.sml](panPEGScript.sml): 12 | * The beginnings of a PEG parser for the Pancake language. 13 | 14 | [panPtreeConversionScript.sml](panPtreeConversionScript.sml): 15 | * Theory for translating the Pancake parse tree into the Pancake AST. 16 | -------------------------------------------------------------------------------- /translator/other-examples/Holmakefile: -------------------------------------------------------------------------------- 1 | INCLUDES= $(HOLDIR)/examples/Crypto/AES\ 2 | $(HOLDIR)/examples/Crypto/RC6\ 3 | $(HOLDIR)/examples/Crypto/TEA\ 4 | $(HOLDIR)/examples/miller/miller\ 5 | $(CAKEMLDIR)/basis\ 6 | .. auxiliary 7 | 8 | all: $(DEFAULT_TARGETS) README.md 9 | .PHONY: all 10 | 11 | README_SOURCES = $(wildcard *Script.sml) $(wildcard *Lib.sml) $(wildcard *Syntax.sml) 12 | DIRS = $(wildcard */) 13 | README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmePrefix,$(DIRS)) $(README_SOURCES) 14 | $(protect $(CAKEMLDIR)/developers/readme_gen) $(README_SOURCES) 15 | --------------------------------------------------------------------------------