diff --git a/.github/workflows/type_check.yml b/.github/workflows/check_encoding.yml similarity index 78% rename from .github/workflows/type_check.yml rename to .github/workflows/check_encoding.yml index 229d5253c6f48190c9977164733962047d96fa9c..d07d053c5aa058f3094a1d20091f4afc520d8dc9 100644 --- a/.github/workflows/type_check.yml +++ b/.github/workflows/check_encoding.yml @@ -1,6 +1,6 @@ # This is a basic workflow to help you get started with Actions -name: check_files +name: check_encoding # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch @@ -34,15 +34,20 @@ jobs: with: ocaml-version: 4.11.1 + - name: get lambdapi + uses: actions/checkout@v2 + with: + repository: https://github.com/gabrielhdt/lambdapi.git + branch: refiner + path: lambdapi + # Runs a set of commands using the runners shell - - name: install lambdapi + - name: install lambdapi and deps run: | sudo apt install --yes bmake - git clone https://github.com/gabrielhdt/lambdapi.git lambdapi - (cd lambdapi || exit 1 - git checkout 5c703a98cc85 - opam pin add lambdapi .) - opam install lambdapi + (cd "${GITHUB_WORKSPACE}/lambdapi/" || exit 1 + opam install . --deps-only + make install) eval $(opam env) why3 config detect @@ -50,9 +55,3 @@ jobs: run: | eval $(opam env) bmake encoding - - - name: other tests - run: | - eval $(opam env) - bmake install - bmake tests diff --git a/tests/coercions.lp b/encoding/tests/coercions.lp similarity index 100% rename from tests/coercions.lp rename to encoding/tests/coercions.lp diff --git a/sandbox/numbers.lp b/sandbox/numbers.lp deleted file mode 100644 index 3f5986d1abed43c6de673de771ccc8e159c046d3..0000000000000000000000000000000000000000 --- a/sandbox/numbers.lp +++ /dev/null @@ -1,172 +0,0 @@ -require open personoj.encodings.lhol -require open personoj.encodings.pvs_cert -require open personoj.encodings.prop_hol -require open personoj.encodings.prenex -require open personoj.prelude.logic -require open personoj.encodings.builtins -require open personoj.encodings.subtype_poly - -// -// Theory numbers -// -constant symbol number: θ {|set|} -rule El (μ number) ↪ El number - -// -// Theory number_fields -// -constant symbol field_pred: El (PRED number) -definition number_field ≔ psub field_pred -// number_field is an uninterpreted subtype -definition numfield ≔ number_field - -symbol insertnum: El {|!Number!|} → El numfield - -symbol {|+|}: El (numfield ~> numfield ~> numfield) -set infix left 6 "+" ≔ {|+|} -symbol {|-|}: El (numfield ~> numfield ~> numfield) -set infix 6 "-" ≔ {|-|} - -// Other way to extend type of functions, -// symbol ty_plus: Term uType → Term uType → Term uType -// symbol polyplus {T: Term uType} {U: Term uType} -// : Term T → Term U → Term (ty_plus T U) -// // plus is defined on numfield -// rule ty_plus numfield numfield ↪ numfield - -constant -symbol commutative_add : Prf (∀ (λx, ∀ (λy, x + y = y + x))) -constant -symbol associative_add - : Prf (∀ (λx, ∀ (λy, ∀ (λz, x + (y + z) = (x + y) + z)))) -// FIXME add a cast on zero? -// symbol identity_add (x: Term numfield): Term (x + zero = x) - - -// -// reals -// -constant symbol real_pred: El (pred numfield) -definition real ≔ psub real_pred - -symbol Num_real: Prf (∀ (λx: El {|!Number!|}, real_pred (insertnum x))) - -// Built in the PVS typechecker - -// TODO: metavariables left -// definition nonzero_real ≔ -// psub {real} -// (λx: El real, -// neq {_} x (cast {_} {real} (λx, x) (insertnum 0) _)) - -// symbol closed_plus_real: Π(x y: Term real), -// let pr ≔ S.restr numfield real_pred in -// let xnf ≔ ↑ numfield pr x in -// let ynf ≔ ↑ numfield pr y in -// Term (real_pred (xnf + ynf)) - -// // hint Term $x ≡ Univ Type ↪ $x ≡ uType - -// // With polymorphic plus -// rule ty_plus real real ↪ real - -// symbol lt (x y: Term real): Term prop -// set infix 6 "<" ≔ lt -// definition leq (x y: Term real) ≔ (lt x y) ∨ (eq {real} x y) -// set infix 6 "<=" ≔ leq -// definition gt (x y: Term real) ≔ y < x -// set infix 7 ">" ≔ gt -// definition geq (x y: Term real) ≔ leq y x -// set infix 7 ">=" ≔ geq - - -// // -// // real_axioms -// // - -// // ... - -// // -// // rationals -// // -// symbol rational_pred: Term (pred real) -// definition rational ≔ Psub rational_pred -// definition rat ≔ rational -// theorem rational_not_empty: Term (∃ rational_pred) -// proof admit - -// // Typically a TCC -// theorem rat_is_real: Term (rational ⊑ real) -// proof -// refine S.restr real rational_pred -// qed - -// // hint Psub $x ⊑ $y ≡ rational ⊑ real ↪ $x ≡ rational_pred, $y ≡ real -// theorem rat_is_real_auto: Term (rational ⊑ real) -// proof -// apply S.restr _ _ -// qed - -// definition nonzero_rational_pred (x: Term rational): Term prop ≔ -// neq zero (↑ real rat_is_real x) -// definition nonzero_rational ≔ Psub nonzero_rational_pred -// definition nzrat ≔ nonzero_rational - -// symbol closed_plus_rat (x y: Term rat): -// let xreal ≔ ↑ real rat_is_real x in -// let yreal ≔ ↑ real rat_is_real y in -// let xnf ≔ ↑ numfield (S.restr numfield real_pred) xreal in -// let ynf ≔ ↑ numfield (S.restr numfield real_pred) yreal in -// let sum ≔ xnf + ynf in -// Term (rational_pred (↓ real_pred sum (closed_plus_real xreal yreal))) -// rule ty_plus rat rat ↪ rat - -// definition nonneg_rat_pred (x: Term rational) ≔ (↑ real rat_is_real x) >= zero -// definition nonneg_rat ≔ Psub nonneg_rat_pred - -// theorem nonneg_rat_is_real: Term (nonneg_rat ⊑ real) -// proof -// refine S.trans nonneg_rat rational real ?nnr_is_r ?r_is_r -// focus 1 -// apply rat_is_real -// apply S.restr rational nonneg_rat_pred -// qed - -// definition posrat_pred (x: Term nonneg_rat) ≔ (↑ real nonneg_rat_is_real x) > zero -// definition posrat ≔ Psub posrat_pred - -// symbol div: Term real → Term nonzero_real → Term real -// set infix left 8 "/" ≔ div - -// /// NOTE: any expression of the type below would generate a TCC to prove -// // that posrat is a nzrat -// type λ (r: Term real) (q: Term posrat), r / (↑ nzreal _ q) -// theorem posrat_is_nzreal: Term (posrat ⊑ nzreal) -// proof -// admit -// // but PVS prefers to state that posrat is nzrat -// theorem posrat_is_nzrat: Term (posrat ⊑ nzrat) -// proof -// refine S.sub nonzero_rational_pred posrat ?R ?P1 ?Fa -// print -// refine λx, x // Trivial proof that rational and posrat have the same root -// refine S.trans posrat nonneg_rat rat ?R1 ?R2 -// apply S.restr nonneg_rat posrat_pred -// apply S.restr rational nonneg_rat_pred -// assume x -// // TODO finish this proof -// admit -// type λ (r: Term real) (q: Term posrat), r / -// (↑ nzreal _ (↑ nzrat posrat_is_nzrat q)) -// /// - -// // -// // integers -// // -// symbol integer_pred: Term (pred rational) -// definition integer ≔ Psub integer_pred -// // Proof of existence because NONEMPTY_TYPE -// theorem integer_not_empty: Term (∃ integer_pred) -// proof -// admit -// definition int ≔ integer diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 662be101673b8ba37faebd7cd9ff0ad3cd56462e..0000000000000000000000000000000000000000 --- a/tests/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -LP_SRC != find . -type f -name "*.lp" - -.include "../lambdapi.mk" diff --git a/tests/lambdapi.pkg b/tests/lambdapi.pkg deleted file mode 100644 index f9dcc3c4d5732c21d18fae1a42a53438b6b71ef7..0000000000000000000000000000000000000000 --- a/tests/lambdapi.pkg +++ /dev/null @@ -1,2 +0,0 @@ -package_name = personoj_tests -root_path = personoj.tests