Skip to content

Simd models #404

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ package-lock.json
# already existing elements were commented out

#/target
testable-simd-models/target
17 changes: 17 additions & 0 deletions testable-simd-models/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "core-models"
version = "0.0.2"
authors = ["Cryspen"]
license = "Apache-2.0"
homepage = "https://github.com/cryspen-ext/core-models"
edition = "2021"
repository = "https://github.com/cryspen-ext/core-models"
readme = "README.md"

[dependencies]
rand = "0.9"
hax-lib = { git = "https://github.com/cryspen/hax/" }
pastey = "0.1.0"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(hax)'] }
2 changes: 2 additions & 0 deletions testable-simd-models/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# core-models
Rust models for the Core Library (extending work from libcrux/minicore)
91 changes: 91 additions & 0 deletions testable-simd-models/hax.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/env bash
set -e

function extract_all() {
go_to "./"
cargo hax into fstar --z3rlimit 80
}

function prove() {
case "$1" in
--admit)
shift 1
export OTHERFLAGS="--admit_smt_queries true";;
*);;
esac
go_to "./"
JOBS="${JOBS:-$(nproc --all)}"
JOBS="${JOBS:-4}"
make -C proofs/fstar/extraction -j $JOBS "$@"
}

function init_vars() {
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
SCRIPT_PATH="${SCRIPT_DIR}/${SCRIPT_NAME}"

if [ -t 1 ]; then
BLUE='\033[34m'
GREEN='\033[32m'
BOLD='\033[1m'
RESET='\033[0m'
else
BLUE=''
GREEN=''
BOLD=''
RESET=''
fi
}

function go_to() {
ROOT="$SCRIPT_DIR"
cd "$ROOT"
cd "$1"
}

function msg() {
echo -e "$1[$SCRIPT_NAME]$RESET $2"
}

function help() {
echo "Libcrux script to extract Rust to F* via hax."
echo ""
echo "Usage: $0 [COMMAND]"
echo ""
echo "Comands:"
echo ""
grep '[#]>' "$SCRIPT_PATH" | sed 's/[)] #[>]/\t/g'
echo ""
}

function cli() {
if [ -z "$1" ]; then
help
exit 1
fi
# Check if an argument was provided

case "$1" in
--help) #> Show help message
help;;
extract) #> Extract the F* code for the proofs.
extract_all
msg "$GREEN" "done"
;;
prove) #> Run F*. This typechecks the extracted code. To lax-typecheck use --admit.
shift 1
prove "$@";;
extract+prove) #> Equivalent to extracting and proving.
shift 1
extract_all
prove "$@";;
*)
echo "Invalid option: $1"
help
exit 1;;
esac
}

init_vars

cli "$@"
4,007 changes: 4,007 additions & 0 deletions testable-simd-models/proofs/fstar/extraction/.depend

Large diffs are not rendered by default.

Loading
Loading