Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libmGen, a simple generator for mathematical functions #911

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3ba2fd4
First hacked version of libm generator, lots of hardcoding and some c…
HeikoBecker May 25, 2022
bdca48e
Improve libmGen library with a general theorem
HeikoBecker Jun 2, 2022
aa5d381
Merge branch 'master' into libm_gen
HeikoBecker Jun 2, 2022
df2eed7
Fix a small typo to use the correct function name
HeikoBecker Jun 13, 2022
e050091
Add a second example file
HeikoBecker Jun 13, 2022
443a5b3
Merge branch 'master' into libm_gen
HeikoBecker Jun 13, 2022
70f8bca
Merge branch 'master' into libm_gen
HeikoBecker Jun 27, 2022
0888631
Working version of libmGen
HeikoBecker Jun 30, 2022
1a9f3a6
Simplify some proofs
HeikoBecker Jun 30, 2022
0dd1cd4
Remove dandelion subrepo
HeikoBecker Jul 6, 2022
e7661e0
Minor changes to libm generation, add dandelion proper
HeikoBecker Jul 12, 2022
3d6ef52
Merge branch 'master' into libm_gen
HeikoBecker Jul 15, 2022
9d26d77
Merge branch 'master' into libm_gen
HeikoBecker Sep 28, 2022
0e96452
Make libmGen compatible with latest changes in HOL4
HeikoBecker Oct 5, 2022
5bd7688
Add libmGen to build sequence
HeikoBecker Oct 5, 2022
c266120
Add readme to tools folder
HeikoBecker Oct 5, 2022
22d8877
Fix more errors related to README.gen
HeikoBecker Oct 5, 2022
9f02fb9
Fix canle permsScript
HeikoBecker Oct 7, 2022
e63dc62
Fix some repl proofs
HeikoBecker Oct 7, 2022
b264b82
Fix missing case in inferScript for RealFromIntProd
HeikoBecker Oct 12, 2022
2d85a9f
Fix alt_semantics missing a case
HeikoBecker Oct 14, 2022
1661429
Fix do_app_ok proof
HeikoBecker Nov 9, 2022
7c856c8
Fix build-sequence, move fp related tools to separate folder
HeikoBecker Nov 11, 2022
fd0b08a
Fix do_app_thm in pull_words
HeikoBecker Nov 15, 2022
c4c296d
Add sollya as a tool to the floating-point implementation for regress…
HeikoBecker Nov 23, 2022
4dafbea
Fix sollya build
HeikoBecker Nov 23, 2022
f27e832
Fix errors in Holmakefile preventing README.md build
HeikoBecker Nov 23, 2022
40e9400
Fix a bug related to README.md generation
HeikoBecker Nov 23, 2022
b1f0888
Fix another bug related to readme_gen
HeikoBecker Nov 23, 2022
eab9fb4
Fix a minor annoyance in Holmakefile
HeikoBecker Nov 30, 2022
30067de
Tweak Holmakefile more to build proper README's
HeikoBecker Dec 5, 2022
29121bf
Merge branch 'master' into libm_gen
HeikoBecker Dec 6, 2022
623518e
Fix some bugs in build process, move build earlier in sequence
HeikoBecker Dec 8, 2022
a6e95b1
Add missing README files, forgotten in last commit
HeikoBecker Dec 8, 2022
05e6061
Delete readmePrefix
HeikoBecker Dec 8, 2022
5204c4c
Update .hol_preexec to not copy Holmakefile
HeikoBecker Dec 8, 2022
b5b4694
Next try fixing readme_gen
HeikoBecker Dec 8, 2022
0bce440
Remove readmePrefix dependency for subdirs in dandelion
HeikoBecker Dec 8, 2022
f801abc
Fix missing dependency in Holmakefile
HeikoBecker Dec 9, 2022
66344cb
Merge branch 'libm_gen' of github.com:CakeML/cakeml into libm_gen
HeikoBecker Dec 9, 2022
b7c5b46
Fix realZeroLib not using proper directories
HeikoBecker Dec 9, 2022
c35a9f2
Fix bug with realZeroLib not picking up sollya
HeikoBecker Dec 10, 2022
d9f19ac
Fix typo in sollya filepath
HeikoBecker Dec 10, 2022
00c06db
Reenable Sollya build
HeikoBecker Dec 10, 2022
d37da9f
Minor update to README of Dandelion
HeikoBecker Dec 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ compiler/benchmarks/*.dat
compiler/benchmarks/*.eps

#sexp files generated by Icing
icing/examples/output/*/*.sexp.cml
icing/examples/*_data_prog.txt
floatingPoint/icing/examples/output/*/*.sexp.cml
floatingPoint/icing/examples/*_data_prog.txt
.DS_Store

#Sollya build files for floating-point tools
floatingPoint/tools/dandelion/sollya-8.0/*

5 changes: 5 additions & 0 deletions candle/prover/candle_prover_evaluateScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ Proof
\\ first_assum (irule_at Any)
\\ simp [v_ok_def])
\\ Cases_on ‘op = RealFromFP’ \\ gs[]
>- (
rw[do_app_cases] \\ gs [SF SFY_ss]
\\ first_assum (irule_at Any)
\\ simp [v_ok_def])
\\ Cases_on ‘op = RealFromIntProd’ \\ gs[]
>- (
rw[do_app_cases] \\ gs [SF SFY_ss]
\\ first_assum (irule_at Any)
Expand Down
4 changes: 4 additions & 0 deletions candle/prover/permsScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ Proof
rw [do_app_cases] \\ gs[]
\\ rw [perms_ok_def])
\\ Cases_on ‘op = RealFromFP’ \\ gs[]
>- (
rw [do_app_cases] \\ gs[]
\\ rw [perms_ok_def])
\\ Cases_on ‘op = RealFromIntProd’ \\ gs[]
>- (
rw [do_app_cases] \\ gs[]
\\ rw [perms_ok_def])
Expand Down
2 changes: 2 additions & 0 deletions compiler/inference/inferScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ val op_to_string_def = Define `
(op_to_string (Real_uop _) = (implode "Real_uop", 1)) ∧
(op_to_string (Real_cmp _) = (implode "Real_cmp", 2)) ∧
(op_to_string (RealFromFP) = (implode "RealFromFP", 1)) ∧
(op_to_string (RealFromIntProd) = (implode "RealFromIntProd", 1)) ∧
(op_to_string (Shift _ _ _) = (implode "Shift", 1)) ∧
(op_to_string Equality = (implode "Equality", 2)) ∧
(op_to_string Opapp = (implode "Opapp", 2)) ∧
Expand Down Expand Up @@ -556,6 +557,7 @@ constrain_op l op ts =
| (Real_bop _, _) => failwith l (implode "Reals do not have a type")
| (Real_cmp _, _) => failwith l (implode "Reals do not have a type")
| (RealFromFP, _) => failwith l (implode "Reals do not have a type")
| (RealFromIntProd, _) => failwith l (implode "Reals do not have a type")
| (AallocFixed, _) => failwith l (implode "Unsafe ops do not have a type") (* not actually unsafe *)
| (Eval, _) => failwith l (implode "Unsafe ops do not have a type")
| (Env_id, _) => failwith l (implode "Unsafe ops do not have a type")
Expand Down
2 changes: 2 additions & 0 deletions compiler/parsing/fromSexpScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ val sexpop_def = Define`
if s = "RealbopRealMul" then SOME (Real_bop realOps$Real_Mul) else
if s = "RealbopRealDiv" then SOME (Real_bop realOps$Real_Div) else
if s = "RealFromFP" then SOME (RealFromFP) else
if s = "RealFromIntProd" then SOME (RealFromIntProd) else
if s = "Opapp" then SOME Opapp else
if s = "Opassign" then SOME Opassign else
if s = "Opref" then SOME Opref else
Expand Down Expand Up @@ -1335,6 +1336,7 @@ val opsexp_def = Define`
(opsexp (Real_bop realOps$Real_Mul) = SX_SYM "RealbopRealMul") ∧
(opsexp (Real_bop realOps$Real_Div) = SX_SYM "RealbopRealDiv") ∧
(opsexp (RealFromFP) = SX_SYM "RealFromFP") ∧
(opsexp (RealFromIntProd) = SX_SYM "RealFromIntProd") ∧
(opsexp Opapp = SX_SYM "Opapp") ∧
(opsexp Opassign = SX_SYM "Opassign") ∧
(opsexp Opref = SX_SYM "Opref") ∧
Expand Down
5 changes: 5 additions & 0 deletions compiler/repl/evaluate_initScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,11 @@ Proof
\\ ‘s with <| refs := s.refs; ffi := s.ffi |> = s’ suffices_by gs[]
\\ gs[state_component_equality])
\\ Cases_on ‘op = RealFromFP’ \\ gs[]
>- (
gvs[do_app_cases, v_ok_thm]
\\ ‘s with <| refs := s.refs; ffi := s.ffi |> = s’ suffices_by gs[]
\\ gs[state_component_equality])
\\ Cases_on ‘op = RealFromIntProd’ \\ gs[]
>- (
gvs[do_app_cases, v_ok_thm]
\\ ‘s with <| refs := s.refs; ffi := s.ffi |> = s’ suffices_by gs[]
Expand Down
7 changes: 7 additions & 0 deletions compiler/repl/evaluate_skipScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,13 @@ Proof
\\ rpt (irule_at Any SUBMAP_REFL) \\ gs []
\\ first_assum (irule_at Any) \\ gs [])
\\ Cases_on ‘op = RealFromFP’ \\ gs[]
>- (
Cases_on ‘res’ \\ gvs [do_app_def, v_rel_def, OPTREL_def,
CaseEqs ["list", "v", "option", "prod", "lit",
"store_v", "v"]]
\\ rpt (irule_at Any SUBMAP_REFL) \\ gs []
\\ first_assum (irule_at Any) \\ gs [])
\\ Cases_on ‘op = RealFromIntProd’ \\ gs[]
>- (
Cases_on ‘res’ \\ gvs [do_app_def, v_rel_def, OPTREL_def,
CaseEqs ["list", "v", "option", "prod", "lit",
Expand Down
13 changes: 8 additions & 5 deletions developers/build-sequence
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
developers
developers/bin

# Floating-Point optimizer & codegen
floatingPoint/tools/dandelion
floatingPoint/icing/
floatingPoint/icing/examples

# Floating-Point codegen
floatingPoint/libmGen/

# build many things in parallel at the start
compiler/proofs
compiler/bootstrap/translation
Expand Down Expand Up @@ -127,11 +135,6 @@ compiler/parsing/tests
compiler/inference/tests
compiler/printing/test

# Floating-Point optimizer
icing/flover
icing/
icing/examples

# compiler translation
compiler/repl

Expand Down
5 changes: 5 additions & 0 deletions floatingPoint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Floating-point related tooling for CakeML

This directory contains tools for implementation of elementary functions (`libmGen`),
and to optimize floating-point arithmetic (`icing`).
The `tools` directory contains dependencies used in both implementations.
2 changes: 1 addition & 1 deletion icing/Holmakefile → floatingPoint/icing/Holmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ INCLUDES = $(HOLDIR)/examples/formal-languages/context-free\
$(CAKEMLDIR)/semantics $(CAKEMLDIR)/characteristic\
$(CAKEMLDIR)/compiler $(CAKEMLDIR)/compiler/inference\
$(CAKEMLDIR)/compiler/backend/proofs\
$(CAKEMLDIR)/icing/flover
$(CAKEMLDIR)/floatingPoint/tools/flover

all: $(DEFAULT_TARGETS) README.md
.PHONY: all
Expand Down
3 changes: 0 additions & 3 deletions icing/README.md → floatingPoint/icing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ theorems.
Translation from CakeML floating-point computations to
CakeML real-number computations.

[flover](flover):
# FloVer - A Certificate Checker for Roundoff Error Bounds

[icingTacticsLib.sml](icingTacticsLib.sml):
Tactic library for PrincessCake development

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ INCLUDES = $(HOLDIR)/examples/formal-languages/context-free\
$(CAKEMLDIR)/semantics $(CAKEMLDIR)/characteristic\
$(CAKEMLDIR)/compiler $(CAKEMLDIR)/compiler/inference\
$(CAKEMLDIR)/compiler/backend/semantics\
$(CAKEMLDIR)/icing $(CAKEMLDIR)/icing/flover
$(CAKEMLDIR)/floatingPoint/icing $(CAKEMLDIR)/floatingPoint/tools/flover

#Explicitly without $(DEFAULT_TARGETS) to reduce compilation time
DEFAULT_TARGETS = dopplerProgCompTheory.uo
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,7 @@ Proof
>- trivial_tac
>- trivial_tac
>- trivial_tac
>- trivial_tac
>- (
rpt strip_tac
>> ‘LENGTH a1 = LENGTH a2’ by (irule LIST_REL_LENGTH >> asm_exists_tac >> gs[])
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading