pax_global_header00006660000000000000000000000064147451304310014514gustar00rootroot0000000000000052 comment=6cc023dbb4cb2560683b0d64e2da235e1f62075e hierarchy-builder-1.8.1/000077500000000000000000000000001474513043100151255ustar00rootroot00000000000000hierarchy-builder-1.8.1/.gitattributes000066400000000000000000000000401474513043100200120ustar00rootroot00000000000000*.elpi linguist-language=prolog hierarchy-builder-1.8.1/.github/000077500000000000000000000000001474513043100164655ustar00rootroot00000000000000hierarchy-builder-1.8.1/.github/workflows/000077500000000000000000000000001474513043100205225ustar00rootroot00000000000000hierarchy-builder-1.8.1/.github/workflows/main.yml000066400000000000000000000053111474513043100221710ustar00rootroot00000000000000# This is a basic workflow to help you get started with Actions name: docker CI # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: push: branches: [ master ] tags: [ "v*.*.*" ] pull_request: branches: [ master ] jobs: opam: runs-on: ubuntu-latest strategy: fail-fast: false matrix: coq_version: - '8.18' - '8.19' - '8.20' steps: - uses: actions/checkout@v2 - uses: coq-community/docker-coq-action@v1 with: opam_file: './coq-hierarchy-builder.opam' coq_version: ${{ matrix.coq_version }} export: 'OPAMWITHTEST' # space-separated list of variables env: OPAMWITHTEST: 'true' release: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') needs: [opam] steps: - name: Checkout uses: actions/checkout@v3 - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v4 - name: Create archive run: | VERSION="${GITHUB_REF_NAME_SLUG#v}" git archive -o hierarchy-builder-$VERSION.tar.gz --prefix=hierarchy-builder-$VERSION/ $GITHUB_SHA . - name: Release uses: softprops/action-gh-release@v1 with: files: hierarchy-builder-*.tar.gz fail_on_unmatched_files: true prerelease: true generate_release_notes: true name: Hierarchy Builder ${{ github.ref }} - name: Use OCaml 4.14.x uses: avsm/setup-ocaml@v2 with: ocaml-compiler: 4.14.x opam-local-packages: | !coq-hierarchy-builder*.opam - name: Write PAT env: OPAM_PUBLISH_TOKEN: ${{ secrets.OPAM_PUBLISH_TOKEN }} run: | mkdir -p ~/.opam/plugins/opam-publish printf "$OPAM_PUBLISH_TOKEN" > ~/.opam/plugins/opam-publish/coqelpibot.token - name: Setup SSH uses: webfactory/ssh-agent@v0.8.0 with: ssh-private-key: ${{ secrets.BOT_SSH_KEY }} - name: Install opam-publish # 2.0.3 because more recent versions do not respect OPAMYES run: opam install -y -j 2 opam-publish=2.0.3 - name: Publish run: | eval $(opam env) git config --global user.name coqelpibot git config --global user.email coqelpibot@inria.fr OPAM_SUITE=released TAG=`git tag --sort=-v:refname|head -1` opam-publish --tag=$TAG --packages-directory=$OPAM_SUITE/packages --repo=coq/opam --no-browser -v ${TAG##v} https://github.com/math-comp/hierarchy-builder/releases/download/$TAG/hierarchy-builder-${TAG##v}.tar.gz hierarchy-builder-1.8.1/.github/workflows/nix-action-coq-8.18.yml000066400000000000000000002766761474513043100245220ustar00rootroot00000000000000jobs: QuickChick: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target QuickChick run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"QuickChick\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: ExtLib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "ExtLib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: simple-io' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "simple-io" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "QuickChick" Verdi: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target Verdi run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"Verdi\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: Cheerios' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "Cheerios" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: InfSeqExt' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "InfSeqExt" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "Verdi" addition-chains: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-fingroup runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target addition-chains run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"addition-chains\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: paramcoq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "paramcoq" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "addition-chains" async-test: needs: - coq - QuickChick runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target async-test run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"async-test\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: itree-io' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "itree-io" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: json' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "json" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: QuickChick' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "QuickChick" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "async-test" autosubst: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target autosubst run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"autosubst\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "autosubst" coq: needs: [] runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"coq\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" coq-bits: needs: - coq - mathcomp-algebra runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq-bits run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"coq-bits\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq-bits" coqeal: needs: - coq - mathcomp-algebra - multinomials - mathcomp-real-closed runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coqeal run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"coqeal\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: bignums' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "bignums" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: paramcoq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "paramcoq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: multinomials' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "multinomials" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-real-closed' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-real-closed" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coqeal" coquelicot: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coquelicot run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"coquelicot\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coquelicot" deriving: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target deriving run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"deriving\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "deriving" fourcolor: needs: - coq - mathcomp-algebra - mathcomp-ssreflect - mathcomp-fingroup runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target fourcolor run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"fourcolor\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "fourcolor" hierarchy-builder: needs: - coq runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target hierarchy-builder run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"hierarchy-builder\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq-elpi' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq-elpi" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" http: needs: - coq - QuickChick - async-test runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target http run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"http\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: QuickChick' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "QuickChick" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: async-test' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "async-test" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "http" interval: needs: - coq - coquelicot - mathcomp-ssreflect - mathcomp-fingroup runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target interval run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"interval\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: bignums' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "bignums" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coquelicot' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coquelicot" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: flocq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "flocq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "interval" mathcomp: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - mathcomp-character - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-character' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-character" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp" mathcomp-algebra: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-algebra run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-algebra\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" mathcomp-bigenough: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-bigenough run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-bigenough\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-bigenough" mathcomp-character: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-character run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-character\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-character" mathcomp-field: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-field run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-field\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-field" mathcomp-fingroup: needs: - coq - mathcomp-ssreflect - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-fingroup run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-fingroup\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" mathcomp-finmap: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-finmap run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-finmap\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-finmap" mathcomp-real-closed: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-field - mathcomp-fingroup - mathcomp-solvable - mathcomp-bigenough runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-real-closed run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-real-closed\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-real-closed" mathcomp-single: needs: - coq - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-single run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-single\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-single" mathcomp-solvable: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-solvable run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-solvable\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-solvable" mathcomp-ssreflect: needs: - coq - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-ssreflect run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"mathcomp-ssreflect\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" multinomials: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-finmap - mathcomp-fingroup - mathcomp-bigenough runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target multinomials run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"multinomials\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-finmap' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-finmap" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "multinomials" odd-order: needs: - coq - mathcomp-character - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - mathcomp runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target odd-order run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"odd-order\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-character' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-character" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "odd-order" reglang: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target reglang run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"reglang\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "reglang" relation-algebra: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target relation-algebra run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.18\" --argstr job \"relation-algebra\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: aac-tactics' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "aac-tactics" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.18" --argstr job "relation-algebra" name: Nix CI for bundle coq-8.18 on: pull_request: paths: - .github/workflows/nix-action-coq-8.18.yml pull_request_target: paths-ignore: - .github/workflows/nix-action-coq-8.18.yml types: - opened - synchronize - reopened push: branches: - master hierarchy-builder-1.8.1/.github/workflows/nix-action-coq-8.19.yml000066400000000000000000003372111474513043100245020ustar00rootroot00000000000000jobs: QuickChick: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target QuickChick run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"QuickChick\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: ExtLib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "ExtLib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: simple-io' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "simple-io" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "QuickChick" async-test: needs: - coq - QuickChick runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target async-test run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"async-test\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: itree-io' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "itree-io" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: json' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "json" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: QuickChick' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "QuickChick" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "async-test" autosubst: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target autosubst run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"autosubst\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "autosubst" coq: needs: [] runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"coq\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" coq-bits: needs: - coq - mathcomp-algebra runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq-bits run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"coq-bits\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq-bits" coqeal: needs: - coq - mathcomp-algebra - multinomials - mathcomp-real-closed runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coqeal run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"coqeal\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: bignums' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "bignums" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: paramcoq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "paramcoq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: multinomials' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "multinomials" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-real-closed' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-real-closed" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coqeal" coquelicot: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coquelicot run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"coquelicot\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coquelicot" deriving: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target deriving run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"deriving\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "deriving" fourcolor: needs: - coq - mathcomp-algebra - mathcomp-ssreflect - mathcomp-fingroup runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target fourcolor run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"fourcolor\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "fourcolor" hierarchy-builder: needs: - coq runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target hierarchy-builder run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"hierarchy-builder\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq-elpi' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq-elpi" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" http: needs: - coq - QuickChick - async-test runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target http run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"http\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: QuickChick' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "QuickChick" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: async-test' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "async-test" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "http" interval: needs: - coq - coquelicot - mathcomp-ssreflect - mathcomp-fingroup runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target interval run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"interval\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: bignums' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "bignums" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coquelicot' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coquelicot" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: flocq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "flocq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "interval" mathcomp: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - mathcomp-character - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-character' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-character" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp" mathcomp-algebra: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-algebra run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-algebra\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" mathcomp-analysis: needs: - coq - mathcomp-reals - mathcomp-field - mathcomp-bigenough - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-analysis run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-analysis\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-analysis" mathcomp-analysis-stdlib: needs: - coq - mathcomp-analysis - mathcomp-reals-stdlib - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-analysis-stdlib run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-analysis-stdlib\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-analysis' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-analysis" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals-stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-reals-stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-analysis-stdlib" mathcomp-bigenough: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-bigenough run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-bigenough\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-bigenough" mathcomp-character: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-character run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-character\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-character" mathcomp-classical: needs: - coq - mathcomp-algebra - mathcomp-finmap - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-classical run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-classical\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-finmap' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-finmap" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-classical" mathcomp-experimental-reals: needs: - coq - mathcomp-reals - mathcomp-bigenough - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-experimental-reals run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-experimental-reals\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-experimental-reals" mathcomp-field: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-field run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-field\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-field" mathcomp-fingroup: needs: - coq - mathcomp-ssreflect - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-fingroup run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-fingroup\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" mathcomp-finmap: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-finmap run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-finmap\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-finmap" mathcomp-real-closed: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-field - mathcomp-fingroup - mathcomp-solvable - mathcomp-bigenough runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-real-closed run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-real-closed\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-real-closed" mathcomp-reals: needs: - coq - mathcomp-classical - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-reals run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-reals\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-classical' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-classical" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-reals" mathcomp-reals-stdlib: needs: - coq - mathcomp-reals - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-reals-stdlib run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-reals-stdlib\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-reals-stdlib" mathcomp-single: needs: - coq - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-single run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-single\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-single" mathcomp-solvable: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-solvable run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-solvable\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-solvable" mathcomp-ssreflect: needs: - coq - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-ssreflect run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"mathcomp-ssreflect\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" multinomials: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-finmap - mathcomp-fingroup - mathcomp-bigenough runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target multinomials run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"multinomials\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-finmap' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-finmap" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "multinomials" odd-order: needs: - coq - mathcomp-character - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - mathcomp runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target odd-order run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"odd-order\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-character' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-character" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "odd-order" reglang: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target reglang run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"reglang\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "reglang" relation-algebra: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target relation-algebra run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"relation-algebra\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: aac-tactics' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "aac-tactics" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "relation-algebra" vcfloat: needs: - coq - interval runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target vcfloat run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.19\" --argstr job \"vcfloat\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: interval' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "interval" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: compcert' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "compcert" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: flocq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "flocq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: bignums' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "bignums" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.19" --argstr job "vcfloat" name: Nix CI for bundle coq-8.19 on: pull_request: paths: - .github/workflows/nix-action-coq-8.19.yml pull_request_target: paths-ignore: - .github/workflows/nix-action-coq-8.19.yml types: - opened - synchronize - reopened push: branches: - master hierarchy-builder-1.8.1/.github/workflows/nix-action-coq-8.20.yml000066400000000000000000003143051474513043100244710ustar00rootroot00000000000000jobs: QuickChick: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target QuickChick run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"QuickChick\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: ExtLib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "ExtLib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: simple-io' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "simple-io" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "QuickChick" autosubst: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target autosubst run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"autosubst\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "autosubst" coq: needs: [] runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"coq\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" coq-bits: needs: - coq - mathcomp-algebra runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq-bits run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"coq-bits\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq-bits" coqeal: needs: - coq - mathcomp-algebra - multinomials - mathcomp-real-closed runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coqeal run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"coqeal\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: bignums' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "bignums" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: paramcoq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "paramcoq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: multinomials' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "multinomials" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-real-closed' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-real-closed" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coqeal" coquelicot: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coquelicot run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"coquelicot\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coquelicot" deriving: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target deriving run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"deriving\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "deriving" fourcolor: needs: - coq - mathcomp-algebra - mathcomp-ssreflect - mathcomp-fingroup runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target fourcolor run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"fourcolor\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "fourcolor" hierarchy-builder: needs: - coq runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target hierarchy-builder run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"hierarchy-builder\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq-elpi' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq-elpi" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" interval: needs: - coq - coquelicot - mathcomp-ssreflect - mathcomp-fingroup runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target interval run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"interval\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: bignums' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "bignums" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coquelicot' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coquelicot" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: flocq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "flocq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "interval" mathcomp: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - mathcomp-character - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-character' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-character" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp" mathcomp-algebra: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-algebra run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-algebra\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" mathcomp-analysis: needs: - coq - mathcomp-reals - mathcomp-field - mathcomp-bigenough - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-analysis run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-analysis\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-analysis" mathcomp-analysis-stdlib: needs: - coq - mathcomp-analysis - mathcomp-reals-stdlib - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-analysis-stdlib run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-analysis-stdlib\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-analysis' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-analysis" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals-stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-reals-stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-analysis-stdlib" mathcomp-bigenough: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-bigenough run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-bigenough\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-bigenough" mathcomp-character: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-character run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-character\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-character" mathcomp-classical: needs: - coq - mathcomp-algebra - mathcomp-finmap - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-classical run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-classical\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-finmap' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-finmap" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-classical" mathcomp-experimental-reals: needs: - coq - mathcomp-reals - mathcomp-bigenough - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-experimental-reals run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-experimental-reals\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-experimental-reals" mathcomp-field: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-field run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-field\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-field" mathcomp-fingroup: needs: - coq - mathcomp-ssreflect - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-fingroup run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-fingroup\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" mathcomp-finmap: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-finmap run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-finmap\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-finmap" mathcomp-real-closed: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-field - mathcomp-fingroup - mathcomp-solvable - mathcomp-bigenough runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-real-closed run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-real-closed\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-real-closed" mathcomp-reals: needs: - coq - mathcomp-classical - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-reals run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-reals\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-classical' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-classical" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-reals" mathcomp-reals-stdlib: needs: - coq - mathcomp-reals - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-reals-stdlib run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-reals-stdlib\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-reals-stdlib" mathcomp-single: needs: - coq - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-single run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-single\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-single" mathcomp-solvable: needs: - coq - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-solvable run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-solvable\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-solvable" mathcomp-ssreflect: needs: - coq - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-ssreflect run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"mathcomp-ssreflect\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" multinomials: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-finmap - mathcomp-fingroup - mathcomp-bigenough runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target multinomials run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"multinomials\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-finmap' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-finmap" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "multinomials" odd-order: needs: - coq - mathcomp-character - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - mathcomp runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target odd-order run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"odd-order\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-character' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-character" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "odd-order" reglang: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target reglang run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"reglang\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "reglang" relation-algebra: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target relation-algebra run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-8.20\" --argstr job \"relation-algebra\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: aac-tactics' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "aac-tactics" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-8.20" --argstr job "relation-algebra" name: Nix CI for bundle coq-8.20 on: pull_request: paths: - .github/workflows/nix-action-coq-8.20.yml pull_request_target: paths-ignore: - .github/workflows/nix-action-coq-8.20.yml types: - opened - synchronize - reopened push: branches: - master hierarchy-builder-1.8.1/.github/workflows/nix-action-coq-master.yml000066400000000000000000002723001474513043100253730ustar00rootroot00000000000000jobs: bignums: needs: - coq - stdlib runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target bignums run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"bignums\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "bignums" coq: needs: [] runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"coq\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" coq-bits: needs: - coq - mathcomp-algebra runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq-bits run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"coq-bits\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq-bits" coq-elpi: needs: - coq - stdlib runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target coq-elpi run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"coq-elpi\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq-elpi" deriving: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target deriving run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"deriving\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "deriving" fourcolor: needs: - coq - mathcomp-algebra - mathcomp-ssreflect - mathcomp-fingroup runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target fourcolor run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"fourcolor\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "fourcolor" hierarchy-builder: needs: - coq - coq-elpi runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target hierarchy-builder run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"hierarchy-builder\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq-elpi' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq-elpi" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" mathcomp: needs: - coq - stdlib - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - mathcomp-character - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-character' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-character" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp" mathcomp-algebra: needs: - coq - stdlib - mathcomp-ssreflect - mathcomp-fingroup - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-algebra run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-algebra\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" mathcomp-analysis: needs: - coq - mathcomp-reals - mathcomp-field - mathcomp-bigenough - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-analysis run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-analysis\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-analysis" mathcomp-analysis-stdlib: needs: - coq - mathcomp-analysis - mathcomp-reals-stdlib - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-analysis-stdlib run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-analysis-stdlib\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-analysis' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-analysis" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals-stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-reals-stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-analysis-stdlib" mathcomp-bigenough: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-bigenough run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-bigenough\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-bigenough" mathcomp-character: needs: - coq - stdlib - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-character run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-character\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-character" mathcomp-classical: needs: - coq - mathcomp-algebra - mathcomp-finmap - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-classical run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-classical\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-finmap' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-finmap" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-classical" mathcomp-experimental-reals: needs: - coq - mathcomp-reals - mathcomp-bigenough - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-experimental-reals run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-experimental-reals\" \\\n \ \ --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-experimental-reals" mathcomp-field: needs: - coq - stdlib - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-field run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-field\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-field" mathcomp-fingroup: needs: - coq - stdlib - mathcomp-ssreflect - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-fingroup run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-fingroup\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" mathcomp-finmap: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-finmap run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-finmap\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-finmap" mathcomp-real-closed: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-field - mathcomp-fingroup - mathcomp-solvable - mathcomp-bigenough runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-real-closed run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-real-closed\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-real-closed" mathcomp-reals: needs: - coq - mathcomp-classical - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-reals run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-reals\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-classical' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-classical" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-reals" mathcomp-reals-stdlib: needs: - coq - mathcomp-reals - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-reals-stdlib run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-reals-stdlib\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-reals' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-reals" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-reals-stdlib" mathcomp-single: needs: [] runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-single run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-single\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-single" mathcomp-solvable: needs: - coq - stdlib - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-solvable run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-solvable\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-solvable" mathcomp-ssreflect: needs: - coq - stdlib - hierarchy-builder runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target mathcomp-ssreflect run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"mathcomp-ssreflect\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: stdlib' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: hierarchy-builder' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "hierarchy-builder" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" multinomials: needs: - coq - mathcomp-ssreflect - mathcomp-algebra - mathcomp-finmap - mathcomp-fingroup - mathcomp-bigenough runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target multinomials run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"multinomials\" \\\n --dry-run 2>&1 > /dev/null)\necho $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\"\ \ | sed \"s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-finmap' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-finmap" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-bigenough' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-bigenough" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "multinomials" odd-order: needs: - coq - mathcomp-character - mathcomp-ssreflect - mathcomp-fingroup - mathcomp-algebra - mathcomp-solvable - mathcomp-field - mathcomp runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target odd-order run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"odd-order\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-character' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-character" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-fingroup' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-fingroup" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-algebra' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-algebra" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-solvable' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-solvable" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-field' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-field" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "odd-order" paramcoq: needs: - coq runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target paramcoq run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"paramcoq\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "paramcoq" reglang: needs: - coq - mathcomp-ssreflect runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target reglang run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"reglang\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: mathcomp-ssreflect' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "mathcomp-ssreflect" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "reglang" stdlib: needs: - coq runs-on: ubuntu-latest steps: - name: Determine which commit to initially checkout run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"target_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n echo \"target_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.target_commit }} - name: Determine which commit to test run: "if [ ${{ github.event_name }} = \"push\" ]; then\n echo \"tested_commit=${{ github.sha }}\" >> $GITHUB_ENV\nelse\n merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1)\n mergeable=$(git merge --no-commit --no-ff ${{ github.event.pull_request.base.sha }} > /dev/null 2>&1; echo $?; git merge --abort > /dev/null 2>&1 || true)\n if [ -z \"$merge_commit\"\ \ -o \"x$mergeable\" != \"x0\" ]; then\n echo \"tested_commit=${{ github.event.pull_request.head.sha }}\" >> $GITHUB_ENV\n else\n echo \"tested_commit=$merge_commit\" >> $GITHUB_ENV\n\ \ fi\nfi\n" - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ env.tested_commit }} - name: Cachix install uses: cachix/install-nix-action@v30 with: nix_path: nixpkgs=channel:nixpkgs-unstable - name: Cachix setup math-comp uses: cachix/cachix-action@v15 with: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} extraPullNames: coq, coq-community name: math-comp - id: stepCheck name: Checking presence of CI target stdlib run: "nb_dry_run=$(NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link \\\n --argstr bundle \"coq-master\" --argstr job \"stdlib\" \\\n --dry-run 2>&1 > /dev/null)\n echo $nb_dry_run\necho status=$(echo $nb_dry_run | grep \"built:\" | sed \"\ s/.*/built/\") >> $GITHUB_OUTPUT\n" - if: steps.stepCheck.outputs.status == 'built' name: 'Building/fetching previous CI target: coq' run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "coq" - if: steps.stepCheck.outputs.status == 'built' name: Building/fetching current CI target run: NIXPKGS_ALLOW_UNFREE=1 nix-build --no-out-link --argstr bundle "coq-master" --argstr job "stdlib" name: Nix CI for bundle coq-master on: pull_request: paths: - .github/workflows/nix-action-coq-master.yml pull_request_target: paths-ignore: - .github/workflows/nix-action-coq-master.yml types: - opened - synchronize - reopened push: branches: - master hierarchy-builder-1.8.1/.gitignore000066400000000000000000000010501474513043100171110ustar00rootroot00000000000000.*.aux *.a *.cma *.cmi *.cmo *.cmx *.cmxa *.cmxs *.glob *.ml.d *.ml4.d *.mli.d *.mllib.d *.mlpack.d *.native *.coq.d *.o *.v.d *.vio *.vos *.vok *.vo .coq-native/ .csdp.cache .lia.cache .nia.cache .nlia.cache .nra.cache csdp.cache lia.cache nia.cache nlia.cache nra.cache Makefile.coq Makefile.coq.conf .coqdeps.d Makefile.test-suite.coq Makefile.test-suite.coq.conf .coqdeps.test-suite *.v.hb *.v.hb.old coq.hb HB/common/log.compat.elpi _minted-* *.aux *.log *.out !*.v.out *.synctex.gz *.toc *.vrb *.fls *.nav *.bbl *.blg *.fdb_latexmk *.vtc *.dot hierarchy-builder-1.8.1/.nix/000077500000000000000000000000001474513043100160015ustar00rootroot00000000000000hierarchy-builder-1.8.1/.nix/config.nix000066400000000000000000000034661474513043100177770ustar00rootroot00000000000000{ format = "1.0.0"; attribute = "hierarchy-builder"; default-bundle = "coq-8.20"; bundles = let mcHBcommon = { mathcomp.override.version = "master"; mathcomp.job = true; mathcomp-single.job = true; graph-theory.job = false; fourcolor.override.version = "master"; odd-order.override.version = "master"; mathcomp-finmap.override.version = "master"; mathcomp-classical.override.version = "master"; mathcomp-analysis.override.version = "master"; reglang.override.version = "master"; coq-bits.override.version = "master"; deriving.override.version = "master"; mathcomp-bigenough.override.version = "master"; multinomials.override.version = "master"; mathcomp-real-closed.override.version = "master"; coqeal.override.version = "master"; }; in { "coq-master".coqPackages = mcHBcommon // { coq.override.version = "master"; stdlib.override.version = "master"; coq-elpi.override.version = "master"; coq-elpi.override.elpi-version = "2.0.7"; bignums.override.version = "master"; paramcoq.override.version = "master"; coqeal.job = false; # broken in master, c.f. https://github.com/coq/coq/pull/19228 }; "coq-8.20".coqPackages = mcHBcommon // { coq.override.version = "8.20"; coq-elpi.override.version = "v2.4.0"; coq-elpi.override.elpi-version = "2.0.7"; }; "coq-8.19".coqPackages = mcHBcommon // { coq.override.version = "8.19"; }; "coq-8.18".coqPackages = mcHBcommon // { coq.override.version = "8.18"; mathcomp-classical.job = false; # Analysis master dropped suppor for 8.18 mathcomp-analysis.job = false; }; }; cachix.coq = {}; cachix.coq-community = {}; cachix.math-comp.authToken = "CACHIX_AUTH_TOKEN"; } hierarchy-builder-1.8.1/.nix/coq-nix-toolbox.nix000066400000000000000000000000531474513043100215610ustar00rootroot00000000000000"82da08ded8f5b913ab813ab079a698eff6ab70e2" hierarchy-builder-1.8.1/.nix/coq-overlays/000077500000000000000000000000001474513043100204255ustar00rootroot00000000000000hierarchy-builder-1.8.1/.nix/coq-overlays/mathcomp-single/000077500000000000000000000000001474513043100235145ustar00rootroot00000000000000hierarchy-builder-1.8.1/.nix/coq-overlays/mathcomp-single/default.nix000066400000000000000000000001221474513043100256530ustar00rootroot00000000000000{ mathcomp, version ? null }: mathcomp.override {single = true; inherit version;} hierarchy-builder-1.8.1/.vscode/000077500000000000000000000000001474513043100164665ustar00rootroot00000000000000hierarchy-builder-1.8.1/.vscode/settings.json000066400000000000000000000074441474513043100212320ustar00rootroot00000000000000{ "spellright.language": [], "spellright.documentTypes": [ "markdown", "plaintext" ], "search.exclude": { ".*.aux": true, "*.a": true, "*.cma": true, "*.cmi": true, "*.cmo": true, "*.cmx": true, "*.cmxa": true, "*.cmxs": true, "*.glob": true, "*.ml.d": true, "*.ml4.d": true, "*.mli.d": true, "*.mllib.d": true, "*.mlpack.d": true, "*.native": true, "*.o": true, "*.v.d": true, "*.vio": true, "*.vo": true, ".coq-native/": true, ".csdp.cache": true, ".lia.cache": true, ".nia.cache": true, ".nlia.cache": true, ".nra.cache": true, "csdp.cache": true, "lia.cache": true, "nia.cache": true, "nlia.cache": true, "nra.cache": true, "Makefile.coq": true, "Makefile.coq.conf": true, ".coqdeps.d": true, "**/_minted-*": true, "**/*.aux": true, "**/*.log": true, // "**/*.out": true, // .v.out is used for expected test output "**/*.synctex.gz": true, "**/*.toc": true, "**/*.vrb": true, "**/*.fls": true, "**/*.nav": true, "**/*.bbl": true, "**/*.blg": true, "**/*.fdb_latexmk": true, "**/*.vtc": true }, "files.exclude": { ".*.aux": true, "*.a": true, "*.cma": true, "*.cmi": true, "*.cmo": true, "*.cmx": true, "*.cmxa": true, "*.cmxs": true, "*.glob": true, "*.ml.d": true, "*.ml4.d": true, "*.mli.d": true, "*.mllib.d": true, "*.mlpack.d": true, "*.native": true, "*.o": true, "*.v.d": true, "*.vio": true, "*.vo": true, ".coq-native/": true, ".csdp.cache": true, ".lia.cache": true, ".nia.cache": true, ".nlia.cache": true, ".nra.cache": true, "csdp.cache": true, "lia.cache": true, "nia.cache": true, "nlia.cache": true, "nra.cache": true, "Makefile.coq": true, "Makefile.coq.conf": true, ".coqdeps.d": true, "**/_minted-*": true, "**/*.aux": true, "**/*.log": true, // "**/*.out": true, // .v.out is used for expected test output "**/*.synctex.gz": true, "**/*.toc": true, "**/*.vrb": true, "**/*.fls": true, "**/*.nav": true, "**/*.bbl": true, "**/*.blg": true, "**/*.fdb_latexmk": true, "**/*.vtc": true, "**/.*.aux": true, "**/*.a": true, "**/*.cma": true, "**/*.cmi": true, "**/*.cmo": true, "**/*.cmx": true, "**/*.cmxa": true, "**/*.cmxs": true, "**/*.glob": true, "**/*.ml.d": true, "**/*.ml4.d": true, "**/*.mli.d": true, "**/*.mllib.d": true, "**/*.mlpack.d": true, "**/*.native": true, "**/*.coq.d": true, "**/*.o": true, "**/*.v.d": true, "**/*.vio": true, "**/*.vos": true, "**/*.vok": true, "**/*.vo": true, "**/.coq-native/": true, "**/.csdp.cache": true, "**/.lia.cache": true, "**/.nia.cache": true, "**/.nlia.cache": true, "**/.nra.cache": true, "**/csdp.cache": true, "**/lia.cache": true, "**/nia.cache": true, "**/nlia.cache": true, "**/nra.cache": true, "**/Makefile.coq": true, "**/Makefile.coq.conf": true, "**/.coqdeps.d": true, "**/Makefile.test-suite.coq": true, "**/Makefile.test-suite.coq.conf": true, "**/.coqdeps.test-suite": true, "**/*.dot": true } }hierarchy-builder-1.8.1/AUTHORS.md000066400000000000000000000002761474513043100166010ustar00rootroot00000000000000Copyright (C) 2020 - Cyril Cohen (Inria) - Kazuhiko Sakaguchi (University of Tsukuba) - Enrico Tassi (Inria) This software is released under the terms of the MIT license, see LICENSE file.hierarchy-builder-1.8.1/Changelog.md000066400000000000000000000225251474513043100173440ustar00rootroot00000000000000# Changelog ## [1.8.1] - 2025-01-25 Compatible with - Coq 8.18 with Coq-Elpi 2.0.0 - Coq 8.19 with Coq-Elpi 2.0.1 - Coq 8.20 with Coq-Elpi 2.4.x - Rocq 9.0 with Coq-Elpi 2.4.x ## [1.8.0] - 2024-12-14 Compatible with - Coq 8.18 with Coq-Elpi 2.0.0 - Coq 8.19 with Coq-Elpi 2.0.1 - Coq 8.20 with Coq-Elpi 2.2.x and 2.3.x ### General - **Bugfixes** several error messages have been fixed to display more faithful error messages. - **New warning** in case no instance is created. - **Bugfixes** the regression which forbad dependent functions to be instances has been fixed. ## [1.7.1] - 2024-12-06 Compatible with - Coq 8.18 with Coq-Elpi 2.0.0 - Coq 8.19 with Coq-Elpi 2.0.1 - Coq 8.20 with Coq-Elpi 2.2.x and 2.3.x ### General - **Speedup** `HB.instance` does not try to infer classes that inherit from a class that is known to have no instance (for the given type) - **Speedup** `toposort` on `gref` uses OCaml's maps and sets rather than lists ## [1.7.0] - 2024-01-10 Compatible with - Coq 8.18 with Coq-Elpi 2.0.0 - Coq 8.19 with Coq-Elpi 2.0.1 - **Removed** the `#[primitive_class]` attribute, making it the default. - **New** `HB.saturate` to saturate instances w.r.t. the current hierarchy - **Removed** the `#[infer]` attribute made obsolete by reverse coercions since Coq 8.16 ## [1.6.0] - 2023-09-20 Compatible with - Coq 8.16 with Coq-Elpi 1.15.x and 1.16.x - Coq 8.17 with Coq-Elpi 1.17.x and 1.18.x - Coq 8.18 with Coq-Elpi 1.19.x This version is required if Elpi is >= 1.17.0 ### General - **Speedup** speedup in coercion compression - **Speedup** accumulate clauses in batches (on Coq-Elpi >= 8.18.0) - **Change** remove generation of eta expanded instances (was unused) ## [1.5.0] - 2023-08-04 Compatible with - Coq 8.15 with Coq-Elpi 1.14.x - Coq 8.16 with Coq-Elpi 1.15.x and 1.16.x - Coq 8.17 with Coq-Elpi 1.17.x and 1.18.x - Coq 8.18 with Coq-Elpi 1.19.x This version is required if Elpi is >= 1.17.0 ### General - **Fix** spilling before predicate declaration - **Fix** unnecessary use of grafting slowing down compilation on MathComp 2.0 - **New** better "missing join" error message ## [1.4.0] - 2022-09-29 Compatible with - Coq 8.15 with Coq-Elpi 1.14.x - Coq 8.16 with Coq-Elpi 1.15.x and 1.16.x ### General - **Fix** `HB.pack` works with structures about functions, and not just types. - **Fix** `HB.about` and `HB.graph` now display shortest names. - **New** Command `HB.howto` to find all possible ways to instanciate structures. - **New** Structures now support keys which type's head is a global reference. (Only keys corresponding to the coercion classes `Sortclass` and `Funclass` were accepted). ## [1.3.0] - 2022-07-27 Compatible with - Coq 8.15 with Coq-Elpi 1.14.x - Coq 8.16 with Coq-Elpi 1.15.x ### General - **Fix** Structures can be keyd on sorts (eg `Prop`) and products (eg `T -> U`) - **New** Mixin parameters can depend on structure instances inferred using previous mixins (see [this test](tests/interleave_context.v)) ## [1.2.1] - 2022-01-10 Compatible with - Coq 8.13 or 8.14 with Coq-Elpi 1.11.x - Coq 8.15 with Coq-Elpi 1.12.x ### General - **Fix** Do not unfold let-ins in instances (speedup) - **Fix** Test suite for Coq 8.15 ## [1.2.0] - 2021-09-24 Compatible with - Coq 8.13 or 8.14 with Coq-Elpi 1.11.x ### General - **Fix** Do not impose useless universe constraints on `option` and `prod` by using custom inductive types. - **New** Check for instances which break Forgetful Inheritance, attribute `#[non_forgetful_inheritance]` to disable the check. - **New** Factory instances are canonically (key `Factory.sort`) instances of all the structures they can fulfill. This can be used inside proofs to provide canonical instances on a type. E.g. `(factoryInstance : SomeStructure.sort _)` works if `factoryInstance` can be used to build `SomeStructure` - **New** `Strategy Opaque` for named mixins, improving conversion performance on generated terms - **New** Attributes `#[primitive]` and `#[primitive_class]` for `HB.structure/mixin/factory` to generate primitive records. - **New** Attribute `#[doc="text"]` supported by all commands and used by `HB.about` - **New** Attribute `#[hnf]` supported by `HB.instance` ### Commands - **New** `HB.locate` to find where an instance comes from - **New** `HB.about` to display HB specific info attached to a HB generated constant ### Tactics - **New** Tactic in term `HB.pack` and `HB.pack_for` taking a key `K` and a bunch of factories and building a structure instance on `K`. E.g. `pose K_fooType : Foo.type := HB.pack K f1 f2 ..` works if factories `f1 f2 ..` provide all mixins needed by structure `Foo`. ## [1.1.0] - 2021-03-30 Compatible with - Coq 8.11 with Coq-Elpi 1.6.2, - Coq 8.12 with Coq-Elpi 1.8.2, - Coq 8.13 with Coq-Elpi 1.9.5. ### General - **Experimental** support for structures with a function as the carrier, for e.g. hierarchies of morphisms. - **Fix** Type inference of parameters for HB commands improved, it can now rely on the right hand side of factories and mixins - **Fix** Removed a hack that included phantom fields in mixins and factories in order to prevent erasure from section discharge. - **Cosmetic** Changed naming convention for canonical instances e.g. `T_is_a_Ring` is now renamed to `T_Ring`. This name should still not be relied upon. - **Cleanup** The elpi code has been split into several files, one for each command and a folder for common code. - **Fix** Speedup `toposort` in elpi code. - **Doc** The file `structures.v` contains a detailed documentation of each command. ### Commands - **Deprecated** `HB.instance K F` in favor of `HB.instance Definition`. - **New** `HB.export` is like `Export` except that the module is stored in a database for later rexport. - **New** `HB.reexport` reexports all the modules that have been previously flagged by `HB.export`, as well as all the `HB.instance` that have been flagged by the attribute `#[export]`. - **New** `HB.check` is like `Check` but supports logging and can be disabled on a selection of Coq versions. - **New** `HB.graph` generates the graph of structures as a dot file. (One may use `tred file.dot | xdot -` to visualize the output). - **Extended** `HB.structure` to generate methods `.on` and `.copy` (see `structures.v` for their documentation). ### Attributes - **New** `#[export]` attribute can be given to `HB.instance` in order to have instances (re)declared by `HB.reexport`. - **New** `#[compress_coercions]` attribute (off by default) to shorten coercions paths in the synthesis of instances. When instanciating structures one by one, (e.g. T is declared as a Semiring, then as a Ring, then as a Field, etc) the coercions used to pile up, we now compress these chains of application. - **New** `#[log]` and `#[log(raw)]` to print Coq commands equivalent to what HB is doing. The raw print is the only one which is reparsable. - **New** `#[key="T"]` to flag paramter `T` as the key of the mixin/factory. The definition `indexed` used to serve this purpose is deprecated and will not do anything. - **New** `#[infer(P)]` can be used to tell `HB.structure` to set things up so that parameter `P` is automatically inferred. E.g. if `P : Ring.type` then `Structure.type` will take a `t : Type` and trigger a canonical inference. to infer the `t_is_a_Ring : Ring.type` associated to `t`. If `Structure` has a function carrier, one has to write `#[infer(P = "_ -> _")]`. - **New** `#[arg_sort]` for `HB.structure` generates an intermediate sort projection called `arg_sort` which is prioritary as a coercion and which unfolds to `sort`. It is meant to be the sort of arguments of operations (see `mathcomp/fingroup/fingroup.v` for more information). - **New** `#[local]` for `HB.instance` so that they do not survive sections. ### Tooling - **New** environment variable `COQ_ELPI_ATTRIBUTES="hb(log(raw))"` to have HB commands write patch files containing Coq commands equivalent to what HB did. These patch files have extension `.v.hb` and are named after the file they apply to. - **New** `coq.hb` command line utility to patch/reset files. - **New** The CI is now testing mathcomp and plan B (using nix). ## [1.0.0] - 2020-12-16 Requires Coq-Elpi 1.6 or 1.7 or 1.8 and Coq 8.11 or 8.12 or 8.13. - Use Coq's elaborator to typecheck factories and structures (coercions are now inserted properly) - New attribute `#[mathcomp]` for `HB.structure` to synthesize backward compatibility code for the Mathematical Components library. When the mixin contains a single axiom its name can be given as `#[mathcomp(axiom="eq_axiom")]`. - `HB.instance Definition name : factory T := term` works even if term is not a known builder. In this case the type (key) is read from the factory (the type of the definition). ## [0.10.0] - 2020-08-08 - HB now supports parameters (experimental). - Port to Coq-Elpi 1.5. - Better error message in case classes are not defined in the right order. - Structure operations are not reexported by substructures. - Spurious trivial `TYPE` structure removed from demo1. ## [0.9.1] - 2020-06-03 - `HB.instance` can be applied directly to a definition as in `HB.instance Definition foo := Bar.Build T ...` - Port to Coq-Elpi version 1.4 - Operations `op` from factory `f` are not bound to `f_op` anymore, they are now bound to `op` and potentially masked operations are accessible via `Super.op`. ## [0.9.0] - 2020-03-11 First public release for Coq 8.10 and 8.11. hierarchy-builder-1.8.1/HB/000077500000000000000000000000001474513043100154165ustar00rootroot00000000000000hierarchy-builder-1.8.1/HB/README.md000066400000000000000000000030001474513043100166660ustar00rootroot00000000000000## File structure - `HB/foo.elpi` implements the main entry point for `HB.foo` (or its variants) - `HB/common/foo.elpi` provides code used by more than one command - Each file `foo.elpi` should put its public API in the namespace `foo.` and its private code in `foo.private.`, if you need to access predicates in the private space then the API needs to be reworked (don't commit code accessing private stiff, even if Elpi won't prevent you from using it). ## Naming conventions - `under-foo.do! Arg [ Code ]` enriches the context with `foo`, the runs `std.do! [ Code ]` - `under-foo.then Arg F Out` enriches the context with `foo`, the runs `F Out`, as a consequence on can use the spilling expression `{under-foo.then Arg F}` - `foo_bar` projection from foo to its field bar - `foo->bar` conversion from type foo to type bar (it can be arbitrarily complex) - `get-foo` reads foo from the Coq world - `findall-foo` reads foo from `hb.db`, the output is sorted whenever it makes sense - `declare-foo` predicate adding to the Coq environment a `foo` - `postulate-foo` predicate assuming a `foo` (e.g. declaring a Coq section variable) - `TheType`, `TheClass`, `TheFoobar` the thing the current code is working on, eg the type of the structure begin defined - `FooAlias` see `phant-abbrev`, used to talk about the non canonical name of `Foo` - when foo is the constructor of a data type with type `A1 -> .. -> AN -> t` we define `mk-foo` as: `mk-foo A1 .. AN (foo A1 .. AN)` hierarchy-builder-1.8.1/HB/about.elpi000066400000000000000000000353241474513043100174120ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace about { pred main i:string. main S :- coq.locate-all S All, std.filter All (x\sigma gr a\x = loc-gref gr ; x = loc-abbreviation a) L, if (L = []) (coq.error "HB: unable to locate" S) true, std.forall L (about.main-located S). pred main-located i:string, i:located. main-located S (loc-gref GR) :- class-def (class Class GR MLwP), !, private.main-structure S Class GR MLwP. main-located _ (loc-gref Class) :- class-def (class Class GR MLwP), !, gref->modname_short GR "." M, coq.gref->id GR St, S is M ^ "." ^ St, private.main-structure S Class GR MLwP. main-located S (loc-gref (indt I)) :- factory-constructor (indt I) _, !, private.main-factory S I. main-located S (loc-gref (const C)) :- factory-constructor (const C) _, !, private.main-factory-alias S C. main-located S (loc-gref (const C)) :- exported-op M _ C, !, private.main-operation S M C. main-located S (loc-gref GR) :- factory-alias->gref GR F ok, not (F = GR), !, main-located S (loc-gref F). main-located S (loc-abbreviation A) :- phant-abbrev GR PhB A, factory-constructor (indt F) GR, !, private.main-factory-constructor S F PhB GR. main-located S (loc-abbreviation A) :- coq.notation.abbreviation-body A NArgs _, coq.notation.abbreviation A {coq.mk-n-holes NArgs} T, coq.safe-dest-app T (global GR) _, !, main-located S (loc-gref GR). main-located S (loc-gref GR) :- from Factory Mixin GR, !, private.main-builder S Factory Mixin. main-located S (loc-gref GR) :- std.filter {coq.CS.db-for _ (cs-gref GR)} (not1 unif-hint?) LV, coq.CS.db-for GR _ LP, std.filter {coq.coercion.db} (c\c = coercion GR _ _ _) LC, if (LV = [], LP = [], LC = []) (coq.error "HB: uninteresting constant" {coq.pp->string {private.pp-loc-of GR}}) true, if (not (LV = [])) (private.main-canonical-value S LV) true, if (not (LP = [])) (private.main-canonical-projection S GR LP) true, if (not (LC = [])) (private.main-coercion S LC) true. main-located S (loc-abbreviation _) :- coq.error "HB: unknown abbreviation" S. /* things also used in paths.elpi ------------------------------------------ */ shorten coq.pp.{ v , h, hv, hov , spc , str , box , glue , brk , empty }. pred bulletize1 i:(A -> coq.pp -> prop), i:A, o:coq.pp. bulletize1 F X (glue [str "- ", M]) :- F X M. pred bulletize i:list A, i:(A -> coq.pp -> prop), o:coq.pp. bulletize [] _ empty. bulletize L F (glue [brk 0 0 | PLB]) :- std.map L (bulletize1 F) PL, std.intersperse (brk 0 0) PL PLB. % Print shortest qualified identifier of the module containing a gref pred pp-module i:gref, o:coq.pp. pp-module GR (str ID) :- gref->modname_short GR "." ID. pred unif-hint? i:cs-instance. unif-hint? (cs-instance _ (cs-gref GR) _) :- coq.CS.db-for GR _ [_|_]. pred not1 i:(A -> prop), i:A. not1 P X :- not (P X). /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { shorten coq.pp.{ v , h, hv, hov , spc , str , box , glue , brk , empty }. pred docstring-for-file i:string, o:prop. docstring-for-file Rex (docstring Loc Doc) :- docstring Loc Doc, loc.fields Loc File _ _ _ _, rex.match {calc(".*" ^ Rex)} File. pred main-canonical-value i:string, i:list cs-instance. main-canonical-value S CanonicalValues :- group-by-loc CanonicalValues CanonicalValuesL, %format PpCanonicalValues = box (v 4) [ str "HB: ", str S, str " is canonically equipped with structures:", {bulletize CanonicalValuesL pp-canonical-solution-list}], % print coq.say {coq.pp->string PpCanonicalValues}, coq.say. pred group-by-loc i:list cs-instance, o:list (pair (option loc) (list cs-instance)). group-by-loc [] []. group-by-loc [cs-instance P V GR|L] [pr (some Loc) [cs-instance P V GR|SameLoc]|Rest1] :- decl-location GR Loc, !, std.partition L (x\ sigma GR1\ x = cs-instance _ _ GR1, decl-location GR1 Loc) SameLoc Rest, group-by-loc Rest Rest1. group-by-loc [I|Rest] [pr none [I]|Rest1] :- group-by-loc Rest Rest1. pred pp-canonical-solution-list i:pair (option loc) (list cs-instance), o:coq.pp. pp-canonical-solution-list (pr none [CS]) Pp :- pp-canonical-solution CS Pp. pp-canonical-solution-list (pr (some Loc) L) Pp :- Pp = box (v 0) { std.append {std.intersperse spc {std.map L pp-canonical-solution}} [ spc, {pp-loc Loc} ] }. pred pp-canonical-solution i:cs-instance, o:coq.pp. pp-canonical-solution (cs-instance _Proj _Pat GR) Pp :- coq.env.typeof GR T, coq.prod-tgt->gref T F, if (class-def (class _ F _)) (gref->modname_short F "." ID) (coq.gref->string F ID), Pp = box (hov 0) [ str ID ]. pred main-canonical-projection i:string, i:gref, i:list cs-instance. main-canonical-projection S Proj CanonicalProjectionValues :- %format PpCanonicalProjectionOrigin = box (hov 4) [ str "HB:", spc, str S, spc, str "is a canonical projection", spc, {pp-loc-of Proj}], PpCanonicalProjectionValues = box (v 4) [ str "HB: ", str S, str " has the following canonical values:", {bulletize CanonicalProjectionValues pp-canonical-value}], % print coq.say {coq.pp->string PpCanonicalProjectionOrigin}, coq.say {coq.pp->string PpCanonicalProjectionValues}, coq.say. pred pp-canonical-value i:cs-instance, o:coq.pp. pp-canonical-value (cs-instance _Proj (cs-gref GR) _Sol) Pp :- coq.term->pp (global GR) V, Pp = box (hov 2) [ V , spc, {pp-loc-of GR} ]. pred main-coercion i:string, i:list coercion. main-coercion S [coercion GR _ Src Tgt|_] :- % format if (class-def (class _ Src _) ; class-def (class Src _ _)) (Source = str {gref->modname_short Src "."}) (coq.term->pp (global Src) Source), if2 (Tgt = grefclass TGR) (if (class-def (class _ TGR _) ; class-def (class TGR _ _)) (Target = str {gref->modname_short TGR "."}) (coq.term->pp (global TGR) Target)) (Tgt = sortclass) (Target = str "Sortclass") (Target = str "Funclass"), PpCoercionOrigin = box (hov 4) [ str "HB:", spc, str S, spc, str "is a coercion from", spc, Source, str" to ", Target, spc, {pp-loc-of GR}], % print coq.say {coq.pp->string PpCoercionOrigin}, coq.say. pred main-operation i:string, i:mixinname, i:constant. main-operation S MixinSource _ :- % fetch mixin-first-class MixinSource Class, class-def (class Class Structure _), % format PpOriginStructure = box (hov 4) [ str "HB:", spc, str S, spc, str "is an operation of structure", spc, {pp-module Structure}, spc, {pp-loc-of Structure}], PpOriginMixin = box (hov 4) [ str "HB:", spc, str S, spc, str "comes from mixin", spc, {pp-module MixinSource}, spc, {pp-loc-of MixinSource}], % print coq.say {coq.pp->string PpOriginStructure}, coq.say {coq.pp->string PpOriginMixin}, coq.say. pred main-structure i:string, i:classname, i:structure, i:mixins. main-structure S Class Structure MLwP :- % fetch list-w-params_list MLwP ML, std.map-filter ML (m\r\ sigma P O OPS\ mixin-first-class m Class, std.findall (exported-op m P O) OPS, std.map OPS (c\out\ sigma p\ c = exported-op m p out) r) OPLL, std.flatten OPLL Operations, std.map {std.findall (sub-class Class CS_ CoeS_ NS_)} (x\r\ x = sub-class Class r _ _) SubClasses, std.map {std.findall (sub-class Cs_ Class Coes_ Ns_)} (x\r\ x = sub-class r Class _ _) SuperClasses, % format PpOrigin = box (hov 4) [ str "HB: ", str S, str " is a structure", spc, {pp-loc-of Structure} ], PpOperations = box (v 4) [ str "HB: ", str S, str " characterizing operations and axioms are:", {bulletize Operations pp-const}], PpClass = box (v 4) [ str "HB: ", {pp-module Class}, str " is a factory for the following mixins:", {bulletize ML (m\r\ sigma tmp\ if (mixin-first-class m Class) (pp-module m tmp, r = glue [tmp, str " (* new, not from inheritance *)"]) (pp-module m r))}], PpSubClasses = box (v 4) [ str "HB: ", {pp-module Class}, str " inherits from:", {bulletize SubClasses pp-module}], PpSuperClasses = box (v 4) [ str "HB: ", {pp-module Class}, str " is inherited by:", {bulletize SuperClasses pp-module}], % print coq.say {coq.pp->string PpOrigin}, coq.say {coq.pp->string PpOperations}, coq.say {coq.pp->string PpClass}, coq.say {coq.pp->string PpSubClasses}, coq.say {coq.pp->string PpSuperClasses}, print-docstring Structure, coq.say. pred main-factory-constructor i:string, i:inductive, i:gref, i:gref. main-factory-constructor S F PhBuild Build :- % fetch gref-deps Build DMLwP, list-w-params_list DMLwP DML, factory-provides (indt F) PMLwP, list-w-params_list PMLwP PML, coq.env.projections F FieldsOpts, std.map-filter FieldsOpts (x\r\ x = some r) Fields, coq.arguments.implicit PhBuild [Implicits], compute-arg-type DMLwP Fields [] ParamsNames TName FieldsNames ArgsTypes, compute-field-info FieldsNames Implicits FieldsNamesInfo, std.map ParamsNames (n\r\r = str n) ParamsPp, % format PpOrigin = box (hov 4) [ str "HB: ", str S, str " is a factory constructor", spc, {pp-loc-of Build} ], PpRequires = box (v 4) [ str "HB: ", str S, str " requires its subject to be already equipped with:", {bulletize DML pp-module}], PpProvides = box (v 4) [ str "HB: ", str S, str " provides the following mixins:", {bulletize PML pp-module}], PpUsage = box (v 4) [box h {std.intersperse spc [ str "HB: arguments:", glue {std.intersperse spc [str S | ParamsPp]}, str TName, glue FieldsNamesInfo]}, {bulletize ArgsTypes pp-arg-type}], % print coq.say {coq.pp->string PpOrigin}, coq.say {coq.pp->string PpRequires}, coq.say {coq.pp->string PpProvides}, coq.say {coq.pp->string PpUsage}, print-docstring Build, coq.say. pred compute-arg-type i:list-w-params mixinname, i:list constant, i:list term, o:list id, o:id, o:list id, o:list (pair id coq.pp). compute-arg-type (w-params.cons ID Ty Rest) F Acc [ID|PN] TN FN [pr ID PPTy |Xs] :- coq.term->pp Ty PPTy, @pi-parameter ID Ty x\ compute-arg-type (Rest x) F [x|Acc] PN TN FN Xs. compute-arg-type (w-params.nil ID Ty Rest) F Acc [] ID FN [pr ID PPTy|Xs] :- coq.term->pp Ty PPTy, @pi-parameter ID Ty x\ compute-arg-type.fields F {std.length (Rest x)} {std.rev [x|Acc]} Xs FN. pred compute-arg-type.fields i:list constant, i:int, i:list term, o:list (pair id coq.pp), o:list id. compute-arg-type.fields [] _ _ [] []. compute-arg-type.fields [C|Cs] NDeps Args [pr ID PPTy|Xs] [ID|FN] :- exported-op _ C OP, !, coq.env.typeof (const OP) Ty, coq.gref->id (const OP) ID, coq.subst-prod Args Ty TyArgs, (@pplevel! 200 => coq.term->pp TyArgs PPTy), compute-arg-type.fields Cs NDeps Args Xs FN. compute-arg-type.fields [OP|Cs] NDeps Args [pr ID PPTy|Xs] [ID|FN] :- % factories don't get exported ops, so we hack their types :-/ coq.env.typeof (const OP) OrigTy, copy OrigTy Ty, coq.gref->id (const OP) ID, coq.subst-prod Args Ty TyArgs, coq.mk-n-holes NDeps Deps, coq.subst-prod Deps TyArgs TyArgsDeps, coq.subst-prod [_] TyArgsDeps TyArgsDepsRecord, ToDrop is NDeps + 2, (@pplevel! 200 => coq.term->pp TyArgsDepsRecord PPTy), @pi-parameter ID TyArgsDepsRecord op\ (pi L L1 X\ copy (app[global(const OP)|L]) X :- std.drop ToDrop L L1, coq.mk-app op L1 X) => compute-arg-type.fields Cs NDeps Args Xs FN. pred main-factory i:string, i:inductive. main-factory S Factory :- % fetch coq.env.projections Factory Ps, std.map-filter Ps (x\r\ x = some r) Fields, gref-deps (indt Factory) DMLwP, list-w-params_list DMLwP DML, factory-provides (indt Factory) PMLwP, list-w-params_list PMLwP PML, % format PpOrigin = box (hov 4) [ str "HB: ", str S, str " is a factory", spc, {pp-loc-of (indt Factory)} ], PpOperations = box (v 4) [ str "HB: ", str S, str " operations and axioms are:", {bulletize Fields pp-const}], PpRequires = box (v 4) [ str "HB: ", str S, str " requires the following mixins:", {bulletize DML pp-module}], PpProvides = box (v 4) [ str "HB: ", str S, str " provides the following mixins:", {bulletize PML pp-module}], % print coq.say {coq.pp->string PpOrigin}, coq.say {coq.pp->string PpOperations}, coq.say {coq.pp->string PpRequires}, coq.say {coq.pp->string PpProvides}, print-docstring (indt Factory), coq.say. pred main-factory-alias i:string, i:constant. main-factory-alias S _Const :- coq.say "HB: todo HB.about for factory alias" S. pred main-builder i:string, i:factoryname, i:mixinname. main-builder _S From To :- coq.say "HB: todo HB.about for builder from" {gref->modname_short From "."} "to" {gref->modname_short To "."}. pred compute-field-info.aux i:list id, i:list implicit_kind, o:list coq.pp. compute-field-info.aux [] _ []. compute-field-info.aux [Name|NS] [explicit|IS] [str Name|PS] :- compute-field-info.aux NS IS PS. compute-field-info.aux [Name|NS] [implicit|IS] [glue[str"[",str Name,str"]"]|PS] :- compute-field-info.aux NS IS PS. compute-field-info.aux [Name|NS] [maximal|IS] [glue[str"{",str Name,str"}"]|PS] :- compute-field-info.aux NS IS PS. compute-field-info.aux [Name|NS] [] [str Name|PS] :- compute-field-info.aux NS [] PS. pred compute-field-info i:list id, i:list implicit_kind, o:list coq.pp. compute-field-info Names Impls O :- compute-field-info.aux {std.rev Names} {std.rev Impls} Pp, std.intersperse spc {std.rev Pp} O. pred pp-const i:constant, o:coq.pp. pp-const F (str ID) :- coq.gref->id (const F) ID. pred pp-arg-type i:pair id coq.pp, o:coq.pp. pp-arg-type (pr ID PPTy) (box (hov 2) [str ID, str" :", spc, PPTy]). pred pp-if-verbose o:coq.pp, i:(coq.pp -> prop). pp-if-verbose V P :- get-option "verbose" tt, !, P V. pp-if-verbose empty _. pred pp-loc-of i:gref, o:coq.pp. pp-loc-of GR PP :- decl-location GR Loc, !, pp-loc Loc PP. pp-loc-of _ coq.pp.empty. pred pp-loc i:loc, o:coq.pp. pp-loc Loc (coq.pp.glue PP) :- loc.fields Loc File _ _ Line _, QFile is "\"" ^ File ^ "\", line " ^ {std.any->string Line}, PP = [str "(from ", str QFile, str")"]. pred docstring->pp i:string, o:coq.pp. docstring->pp Txt (glue Doc) :- rex.replace "\n" " " Txt PlainTxt, rex.split " " PlainTxt Words, std.filter Words (w\not (w = "")) NEWords, std.map NEWords (w\r\ r = str w) PpWords, std.intersperse spc PpWords Doc. pred docstring-of i:gref, o:option coq.pp. docstring-of GR (some Doc) :- decl-location GR Loc, docstring Loc Txt, !, docstring->pp Txt Doc. docstring-of _ none. pred pp-docstring-of i:gref, o:coq.pp. pp-docstring-of GR D :- docstring-of GR (some D), !. pp-docstring-of _ coq.pp.empty. pred print-docstring i:gref. print-docstring GR :- if (docstring-of GR (some Doc)) (coq.say {coq.pp->string (box (hov 5) [str"Doc: ",Doc])}) true. }} hierarchy-builder-1.8.1/HB/builders.elpi000066400000000000000000000141261474513043100201060ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace builders { pred begin i:context-decl. begin CtxSkel :- std.do! [ std.assert!(coq.next-synterp-action (begin-module Name)) "synterp code did not open module", if-verbose (coq.say {header} "begin module for builders"), log.coq.env.begin-module Name none, builders.private.factory CtxSkel IDF GRF, % the Super module to access operations/axioms shadowed by the ones in the factory if-verbose (coq.say {header} "begin module Super"), log.coq.env.begin-module "Super" none, if (GRF = indt FRecord) (std.do! [ std.forall {coq.env.projections FRecord} builders.private.declare-shadowed-constant, ]) true, if-verbose (coq.say {header} "ended module Super"), log.coq.env.end-module-name "Super" _, log.coq.env.begin-section Name, if-verbose (coq.say {header} "postulating factories"), builders.private.postulate-factories Name IDF CtxSkel, ]. } % "end" is a keyword, be put it in the namespace by hand pred builders.end. builders.end :- std.do! [ current-mode (builder-from _ _ _ ModName), log.coq.env.end-section-name ModName, findall-builders LFIL, std.fold LFIL [] builders.private.declare-1-builder Clauses, if (Clauses = []) (coq.error "No builders to declare, did you forget HB.instance?") true, std.findall (abbrev-to-export F_ N_ A_) ExportClauses, coq.env.current-path CurModPath, std.filter ExportClauses (export.private.abbrev-in-module CurModPath) ExportClausesFiltered, % TODO: Do we need this module? std.assert!(coq.next-synterp-action (begin-module Name)) "synterp code did not open module", log.coq.env.begin-module Name none, acc-clauses current Clauses, acc-clauses current ExportClausesFiltered, % Clauses => ExportClausesFiltered => current-mode no-builder => % instance.declare-factory-sort-factory GR, log.coq.env.end-module-name Name Exports, log.coq.env.end-module-name ModName _, export.module {calc (ModName ^ "." ^ Name)} Exports, ]. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ pred factory.cdecl->w-mixins i:context-decl, o:w-mixins context-decl. namespace builders.private { % [declare-1-builder (builder _ F M B) From MoreFrom] Given B of type FB, it % declares all the new builders F to M via B. % From holds the (from F Mi Bi) new clauses during folding. pred declare-1-builder i:builder, i:list prop, o:list prop. declare-1-builder (builder _ SrcFactory TgtMixin _) FromClauses FromClauses :- (FromClauses => from SrcFactory TgtMixin _), !, if-verbose (coq.say {header} "skipping duplicate builder from" {nice-gref->string SrcFactory} "to" {nice-gref->string TgtMixin}). declare-1-builder (builder _ SrcFactory TgtMixin B) FromClauses [from SrcFactory TgtMixin B|FromClauses] :- if-verbose (coq.say {header} "declare builder from" {nice-gref->string SrcFactory} "to" {nice-gref->string TgtMixin}). % We add breviations for all constants what will be shadowed by projections % if the factory. pred declare-shadowed-constant i:option constant. declare-shadowed-constant none. declare-shadowed-constant (some C) :- coq.gref->id (const C) Id, std.forall {coq.locate-all Id} (declare-shadowed-located Id). pred declare-shadowed-located i:string, i:located. declare-shadowed-located Id (loc-gref GR) :- @global! => log.coq.notation.add-abbreviation Id 0 (global GR) ff _. declare-shadowed-located Id (loc-abbreviation Abbrev) :- coq.notation.abbreviation-body Abbrev NArgs T, @global! => log.coq.notation.add-abbreviation Id NArgs T ff _. pred postulate-factory-abbrev i:term, i:list term, i:id, i:factoryname, o:term. postulate-factory-abbrev TheType Params Name Falias TheFactory :- std.do! [ std.assert-ok! (factory-alias->gref Falias F) "HB", phant-abbrev F _ Fabv, coq.notation.abbreviation Fabv {std.append Params [TheType]} Package, Msg is "Unable to declare factory " ^ Name, std.assert-ok! (coq.typecheck-ty Package _) Msg, log.coq.env.add-section-variable-noimplicits Name Package C, TheFactory = global (const C), ]. % Only record fields can be exported as operations. pred define-factory-operations i:term, i:list term, i:term, i:gref. define-factory-operations TheType Params TheFactory (indt I) :- !, coq.env.indt I _ NIParams _ _ _ _, NHoles is NIParams - 1 - {std.length Params}, coq.env.projections I PL, std.forall PL (define-factory-operation TheType Params TheFactory NHoles). define-factory-operations _ _ _ _. pred define-factory-operation i:term, i:list term, i:term, i:int, i:option constant. define-factory-operation _ _ _ _ none. define-factory-operation TheType Params TheFactory NHoles (some P) :- coq.mk-n-holes NHoles Holes, std.append Holes [TheFactory] Holes_Factory, std.append Params [TheType|Holes_Factory] Args, T = app[global (const P)|Args], std.assert-ok! (coq.typecheck T _) "Illtyped applied factory operation", coq.gref->id (const P) Name, @local! => log.coq.notation.add-abbreviation Name 0 T ff _. pred factory i:context-decl, o:string, o:gref. factory (context-item IDF _ T _ _\ context-end) IDF GR :- !, coq.safe-dest-app T (global GR) _. factory (context-item _ _ _ _ R) IDF GR :- !, pi x\ factory (R x) IDF GR. factory _ _ _ :- !, coq.error "the last context item is not a factory". pred postulate-factories i:id, i:string, i:context-decl. postulate-factories ModName IDF CDecl :- std.do! [ factory.cdecl->w-mixins CDecl (pr FLwP _), context.declare.params-key FLwP ParamsSection FKey FLwA, std.assert! (FLwA = [triple GRF _ _]) "HB: cannot declare builders for more than one factory at a time", gref-deps GRF DepswPRaw, context.declare.mixins FKey ParamsSection DepswPRaw _ _ _, std.map ParamsSection triple_2 FParams, postulate-factory-abbrev FKey FParams IDF GRF TheFactory, define-factory-operations FKey FParams TheFactory GRF, acc-clause current (current-mode (builder-from FKey TheFactory GRF ModName)), ]. }hierarchy-builder-1.8.1/HB/common/000077500000000000000000000000001474513043100167065ustar00rootroot00000000000000hierarchy-builder-1.8.1/HB/common/compat_acc_clauses_816.elpi000066400000000000000000000001411474513043100237630ustar00rootroot00000000000000pred acc-clauses i:scope, i:list prop. acc-clauses Scope CL :- std.forall CL (acc-clause Scope). hierarchy-builder-1.8.1/HB/common/compat_acc_clauses_all.elpi000066400000000000000000000002171474513043100242210ustar00rootroot00000000000000pred acc-clauses i:scope, i:list prop. acc-clauses Scope CL :- coq.elpi.accumulate-clauses Scope "hb.db" {std.map CL (c\r\ r = clause _ _ c)}. hierarchy-builder-1.8.1/HB/common/compat_add_secvar_18_19.elpi000066400000000000000000000006301474513043100240370ustar00rootroot00000000000000pred log.coq.env.add-section-variable-noimplicits i:id, i:term, o:constant. log.coq.env.add-section-variable-noimplicits Name Ty C :- std.do! [ if (Name = "_") (ID is "fresh_name_" ^ {std.any->string {new_int}}) (ID = Name), @local! => coq.env.add-section-variable ID Ty C, log.private.log-vernac (log.private.coq.vernac.variable ID Ty), @local! => log.coq.arguments.set-implicit (const C) [[]], ]. hierarchy-builder-1.8.1/HB/common/compat_add_secvar_all.elpi000066400000000000000000000010561474513043100240510ustar00rootroot00000000000000pred log.coq.env.add-section-variable-noimplicits i:id, i:term, o:constant. log.coq.env.add-section-variable-noimplicits Name Ty C :- std.do! [ if (Name = "_") (ID is "fresh_name_" ^ {std.any->string {new_int}}) (ID = Name), % elpi:if version coq-elpi < 2.4.0 @local! => coq.env.add-section-variable ID Ty C, % elpi:endif % elpi:if version coq-elpi >= 2.4.0 @local! => coq.env.add-section-variable ID _ Ty C, % elpi:endif log.private.log-vernac (log.private.coq.vernac.variable ID Ty), @local! => log.coq.arguments.set-implicit (const C) [[]], ]. hierarchy-builder-1.8.1/HB/common/database.elpi000066400000000000000000000410131474513043100213240ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ shorten coq.{ term->gref, subst-fun, safe-dest-app, mk-app, mk-eta, subst-prod }. %%%%%%%%% HB database %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pred from_factory i:prop, o:factoryname. from_factory (from X _ _) X. pred from_mixin i:prop, o:mixinname. from_mixin (from _ X _) X. pred from_builder i:prop, o:term. from_builder (from _ _ X) (global X). pred mixin-src_mixin i:prop, o:mixinname. mixin-src_mixin (mixin-src _ M _) M. pred mixin-src_src i:prop, o:term. mixin-src_src (mixin-src _ _ S) S. pred local-canonical-gref i:prop, o:constant. local-canonical-gref (local-canonical C) C. pred class_name i:class, o:classname. class_name (class N _ _) N. pred class_structure i:class, o:structure. class_structure (class _ S _) S. pred class-def_name i:prop, o:classname. class-def_name (class-def (class N _ _)) N. pred mixin-class_class i:prop, o:classname. mixin-class_class (mixin-class _ C) C. pred mixin-class_mixin i:prop, o:mixinname. mixin-class_mixin (mixin-class M _) M. pred classname->def i:classname, o:class. classname->def CN (class CN S ML) :- class-def (class CN S ML). pred classname->mixins i:classname, o:mixins. classname->mixins CN MLwP :- class-def (class CN _ MLwP). pred module-to-export_module i:prop, o:modpath. module-to-export_module (module-to-export _ _ M) M. pred module-to-export_module-nice i:prop, o:id. module-to-export_module-nice (module-to-export _ M _) M. pred instance-to-export_instance i:prop, o:constant. instance-to-export_instance (instance-to-export _ _ M) M. pred instance-to-export_instance-nice i:prop, o:id. instance-to-export_instance-nice (instance-to-export _ M _) M. pred abbrev-to-export_name i:prop, o:id. abbrev-to-export_name (abbrev-to-export _ N _) N. pred abbrev-to-export_body i:prop, o:term. abbrev-to-export_body (abbrev-to-export _ _ B) (global B). pred clause-to-export_clause i:prop, o:prop. clause-to-export_clause (clause-to-export _ C) C. pred extract-builder i:prop, o:builder. extract-builder (builder-decl B) B. pred leq-builder i:builder, i:builder. leq-builder (builder N _ _ _) (builder M _ _ _) :- N =< M. pred sub-class? i:class, i:class. sub-class? (class C1 _ ML1P) (class C2 _ ML2P) :- not (C1 = C2), list-w-params_list ML1P ML1, list-w-params_list ML2P ML2, std.forall ML2 (m2\ std.exists ML1 (m1\ m1 = m2)). % [factory-provides F MLwP] computes the mixins MLwP generated by F pred factory-provides i:factoryname, o:mixins. factory-provides FactoryAlias MLwP :- std.do! [ std.assert-ok! (factory-alias->gref FactoryAlias Factory) "HB", gref-deps Factory RMLwP, w-params.map RMLwP (factory-provides.base Factory) MLwP ]. pred mixin->factories i:mixinname, o:list factoryname. mixin->factories M FL :- std.do! [ std.findall (from F_ M B_) AllF, std.map AllF from_factory FL ]. pred factory-provides.base i:factoryname, i:list term, i: term, i:list (w-args mixinname), o:list (w-args mixinname). factory-provides.base Factory Params T _RMLwP MLwP :- std.do! [ std.findall (from Factory T_ F_) All, std.map All from_mixin ML, std.map All from_builder BL, std.map2 BL ML (factory-provides.one Params T) MLwP, ]. pred factory-provides.one i:list term, i:term, i:term, i:mixinname, o:w-args mixinname. factory-provides.one Params T B M (triple M PL T) :- std.do! [ std.assert-ok! (coq.typecheck B Ty) "Builder illtyped", subst-prod [T] {subst-prod Params Ty} TyParams, std.assert! (extract-conclusion-params T TyParams PL) "The conclusion of a builder is a mixin whose parameters depend on other mixins", ]. pred extract-conclusion-params i:term, i:term, o:list term. extract-conclusion-params TheType (prod _ S T) R :- !, @pi-decl _ S x\ extract-conclusion-params TheType (T x) R. extract-conclusion-params TheType (app [global GR|Args]) R :- !, std.do! [ std.assert-ok! (factory-alias->gref GR Factory) "HB", factory-nparams Factory NP, std.map Args (copy-pack-holes TheType TheType) NewArgs, std.take NP NewArgs R]. extract-conclusion-params TheType T R :- whd1 T T1, !, extract-conclusion-params TheType T1 R. % [factories-provide FL ML] computes the mixins ML generated by all F in FL % % cons tp p\ nil t\ [pr f1 [p,t]] % f1 p t = m1 t, m2 p t % cons tp p\ nil t\ [pr m1 [t], pr m2 [p,t]] pred factories-provide i:list-w-params factoryname, o:mixins. factories-provide FLwP MLwP :- std.do! [ list-w-params.flatten-map FLwP factory-provides UnsortedMLwP, w-params.map UnsortedMLwP (p\t\ toposort-mixins) MLwP, ]. pred undup-grefs i:list gref, o:list gref. undup-grefs L UL :- std.do! [ coq.gref.list->set L S, coq.gref.set.elements S UL, ]. pred undup-sorts i:list sort, o:list sort. undup-sorts L R :- std.do! [ if (std.mem L prop) (R1 = [prop]) (R1 = []), if (std.mem L sprop) (R2 = [sprop]) (R2 = []), if (std.mem L (typ _)) (R3 = [typ _]) (R3 = []), std.flatten [R1, R2, R3] R, ]. % also prunes cs-default pred undup-cs-patterns i:list cs-pattern, o:list cs-pattern. undup-cs-patterns L R :- std.do! [ std.map-filter L (x\r\ x = cs-gref r) LGR, undup-grefs LGR ULGR, std.map ULGR (x\r\ r = cs-gref x) R1, std.map-filter L (x\r\ x = cs-sort r) LS, undup-sorts LS ULS, std.map ULS (x\r\ r = cs-sort x) R2, if (std.mem L cs-prod) (R3 = [cs-prod]) (R3 = []), std.flatten [R1, R2, R3] R, ]. % Mixins can be topologically sorted according to their dependencies pred toposort-mixins i:list (w-args mixinname), o:list (w-args mixinname). toposort-mixins In Out :- std.do! [ std.map In triple_1 ML, std.map ML (m\r\sigma D D1\ gref-deps m D1, list-w-params_list D1 D, std.map D (d\r\r = pr d m) r) ES2, std.flatten ES2 ES, toposort-proj triple_1 ES In Out, ]. pred toposort-proj i:(A -> gref -> prop), i:list (pair gref gref), i:list A, o:list A. toposort-proj Proj ES In Out :- !, toposort-proj.acc Proj ES [] In Out. pred topo-find i:B, o:A. pred toposort-proj.acc i:(A -> gref -> prop), i:list (pair gref gref), i:list gref, i:list A, o:list A. toposort-proj.acc _ ES Acc [] Out :- !, std.map {std.gref.toposort ES Acc} topo-find Out. toposort-proj.acc Proj ES Acc [A|In] Out :- std.do![ Proj A B, topo-find B A => toposort-proj.acc Proj ES [B|Acc] In Out ]. % Classes can be topologically sorted according to the subclass relation pred toposort-classes.mk-class-edge i:prop, o:pair classname classname. toposort-classes.mk-class-edge (sub-class C1 C2 _ _) (pr C2 C1). pred toposort-classes i:list classname, o:list classname. toposort-classes In Out :- std.do! [ std.findall (sub-class C1_ C2_ _ _) SubClasses, std.map SubClasses toposort-classes.mk-class-edge ES, std.gref.toposort ES In Out, ]. pred findall-classes o:list class. findall-classes CLSortedDef :- std.do! [ std.findall (class-def C_) All, std.map All class-def_name CL, toposort-classes CL CLSorted, std.map CLSorted classname->def CLSortedDef, ]. pred findall-classes-for.unsorted i:list mixinname, i:list classname, o:list classname. findall-classes-for.unsorted [] CL CL :- !. findall-classes-for.unsorted [M|ML] CLAcc Out :- std.do! [ std.findall (mixin-class M C_) All, std.map All mixin-class_class CL, findall-classes-for.unsorted ML {std.append CL CLAcc} Out ]. pred findall-classes-for i:list mixinname, o:list class. findall-classes-for ML CLSortedDef :- std.do! [ findall-classes-for.unsorted ML [] CL, toposort-classes CL CLSorted, std.map CLSorted classname->def CLSortedDef, ]. pred findall-builders o:list builder. findall-builders LFIL :- std.map {std.findall (builder-decl B_)} extract-builder LFILunsorted, std.bubblesort LFILunsorted leq-builder LFIL. pred findall-has-mixin-instance i:cs-pattern, o:list prop. findall-has-mixin-instance P CL :- std.findall (has-mixin-instance P _ _) CL. pred has-mixin-instance_key i:prop, o:cs-pattern. has-mixin-instance_key (has-mixin-instance P _ _) P. pred findall-mixin-src i:term, o:list mixinname. findall-mixin-src T ML :- std.map {std.findall (mixin-src T M_ V_)} mixin-src_mixin ML. pred findall-local-canonical o:list constant. findall-local-canonical CL :- std.map {std.findall (local-canonical C_)} local-canonical-gref CL. % [distinct-pairs-below C AllSuper C1 C2] finds C1 and C2 in % AllSuper (all super classes of C) such that C1 != C2 % and for which there is no join C3. % If there exists a join C3 of C1 and C2 then C is a subclass % of C3 (otherwise C should have been declared before C3) % % / --- /-- C1 % C -- no C3 != % \ --- \-- C2 % % [findall-newjoins C AllSuper] finds all C1 and C2 such that C is a (new) join for % them pred distinct-pairs-below i:class, i:list class, o:class, o:class. distinct-pairs-below CurrentClass AllSuper C1 C2 :- std.mem AllSuper C1, std.mem AllSuper C2, % no cut until here, since we don't know which C1 and C2 to pick std.do! [ cmp_term C1 C2 lt, C1 = class C1n _ _, C2 = class C2n _ _ , not(sub-class? C1 C2), not(sub-class? C2 C1), if (join C1n C2n C3n) (assert-building-bottom-up CurrentClass C3n C1n C2n, fail) % a join, not a valid pair true, % no join, valid pair ]. pred assert-building-bottom-up i:class, i:classname, i:classname, i:classname. assert-building-bottom-up CurrentClass C3n C1n C2n :- class-def (class C3n X Y), CurrentClass = class CC _ _, if (not (sub-class? CurrentClass (class C3n X Y))) (gref->modname CC 1 "." Before, gref->modname_short C3n "." After, gref->modname_short C1n "." C1nS, gref->modname_short C2n "." C2nS, Msg1 is "- declare structure " ^ Before ^ " before structure " ^ After ^ " if " ^ After ^ " inherits from it;", Msg2 is "- declare an additional structure that inherits from both " ^ C1nS ^ " and " ^ C2nS ^ " and from which " ^ Before ^ " and/or " ^ After ^ " inherit.", coq.error "You must declare the hierarchy bottom-up or add a missing join." "There are two ways out:" Msg1 Msg2) true. pred distinct-pairs_pair i:prop, o:pair class class. distinct-pairs_pair (distinct-pairs-below _ _ X Y) (pr X Y). pred findall-newjoins i:class, i:list class, o:list (pair class class). findall-newjoins CurrentClass AllSuper TodoJoins :- std.findall (distinct-pairs-below CurrentClass AllSuper C1_ C2_) JoinOf, std.map JoinOf distinct-pairs_pair TodoJoins. pred class-coverage i:list classname, o:coq.gref.set. class-coverage CNL CSet :- std.map CNL classname->mixins CMLLwP, std.map CMLLwP list-w-params_list CMLL, coq.gref.list->set {std.flatten CMLL} CSet. pred assert-good-coverage! i:list mixinname, i:list classname. assert-good-coverage! MLSortedRev CNL :- std.do! [ coq.gref.list->set MLSortedRev MLSet, class-coverage CNL CMLSet, if (not(coq.gref.set.equal MLSet CMLSet)) (coq.gref.set.diff CMLSet MLSet Extra, coq.error "I could not find classes covering exactly mixins:" {std.any->string MLSortedRev} "In particular the covering" CNL "also includes mixins:" {coq.gref.set.elements Extra} "This should never happen, please report a bug.") true ]. %%%%% Coq Database %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [get-structure-coercion S1 S2 F] finds the coecion F from the structure S1 to S2 pred get-structure-coercion i:structure, i:structure, o:term. get-structure-coercion S T (global F) :- coq.coercion.db-for (grefclass S) (grefclass T) L, if (L = [pr F _]) true (coq.error "No one step coercion from" S "to" T). pred get-structure-sort-projection i:structure, o:term. get-structure-sort-projection (indt S) Proj :- !, coq.env.projections S L, if (L = [some P, _]) true (coq.error "No canonical sort projection for" S), Proj = global (const P). get-structure-sort-projection S _ :- coq.error "get-structure-sort-projection: not a structure" S. pred get-structure-class-projection i:structure, o:term. get-structure-class-projection (indt S) T :- !, coq.env.projections S L, if (L = [_, some P]) true (coq.error "No canonical class projection for" S), T = global (const P). get-structure-class-projection S _ :- coq.error "get-structure-class-projection: not a structure" S. pred get-constructor i:gref, o:gref. get-constructor (indt R) (indc K) :- !, if (coq.env.indt R _ _ _ _ [K] _) true (coq.error "Not a record" R). get-constructor I _ :- coq.error "get-constructor: not an inductive" I. % finding for locally defined structures pred get-cs-structure i:cs-instance, o:structure. get-cs-structure (cs-instance _ _ (const Inst)) Struct :- std.do! [ coq.env.typeof (const Inst) InstTy, coq.prod-tgt->gref InstTy Struct, is-structure Struct, ]. pred get-cs-instance i:cs-instance, o:constant. get-cs-instance (cs-instance _ _ (const Inst)) Inst. pred has-cs-instance i:gref, i:cs-instance. has-cs-instance GTy (cs-instance _ (cs-gref GTy) _). pred mixin-src->has-mixin-instance i:prop, o:prop. mixin-src->has-mixin-instance (mixin-src (global GR) M I) (has-mixin-instance (cs-gref GR) M IHd) :- term->gref I IHd. mixin-src->has-mixin-instance (mixin-src (app [global GR|_] ) M I) (has-mixin-instance (cs-gref GR) M IHd) :- term->gref I IHd. mixin-src->has-mixin-instance (mixin-src (prod _ _ _ ) M I) (has-mixin-instance cs-prod M IHd):- term->gref I IHd. mixin-src->has-mixin-instance (mixin-src (sort U) M I) (has-mixin-instance (cs-sort U) M IHd):- term->gref I IHd. % this auxiliary function iterates over the list of arguments of an application, % and create the necessary unify condition for each arguments % and at the end returns the mixin-src clause with all the conditions pred mixin-instance-type->mixin-src.aux i:list term, % list of arguments i:term, % head of the original application i:mixinname, % name of mixin i:term, % instance body i:list prop, % Cond list o:prop. mixin-instance-type->mixin-src.aux [] T M I Cond (mixin-src T M I :- Cond). mixin-instance-type->mixin-src.aux [A|Args] T M I Cond (pi a \ C a) :- pi a \ sigma Ta\ coq.mk-app T [a] Ta, mixin-instance-type->mixin-src.aux Args Ta M I [coq.unify-eq A a ok|Cond] (C a). % transforms the type of a mixin instance into a % mixin-src clause with eventual conditions regarding its parameters pred mixin-instance-type->mixin-src i:term, % type of the instance Ty i:mixinname, % name of mixin i:term, % instance body I of type Ty i:list prop, % Cond list o:prop. mixin-instance-type->mixin-src (app _ as F) M I Cond C :- factory? F (triple _ _ Subject), safe-dest-app Subject Hd Args, mixin-instance-type->mixin-src.aux Args Hd M I Cond C. mixin-instance-type->mixin-src (prod N_ _ F) M I Cond (pi a \ C a) :- pi a\ sigma Ia \ coq.mk-app I [a] Ia, mixin-instance-type->mixin-src (F a) M Ia Cond (C a). pred has-mixin-instance->mixin-src i:prop, o:prop. has-mixin-instance->mixin-src (has-mixin-instance _ M IHd) C :- std.do![ T = global IHd, coq.env.typeof IHd Ty, mixin-instance-type->mixin-src Ty M T [] C, ]. pred get-canonical-structures i:term, o:list structure. get-canonical-structures TyTrm StructL :- std.do! [ term->cs-pattern TyTrm Pat, !, coq.CS.db-for _ Pat DBGTyL, std.map-filter DBGTyL get-cs-structure StructL, ]. pred get-canonical-instances i:term, o:list constant. get-canonical-instances TyTrm StructL :- std.do! [ term->cs-pattern TyTrm Pat, !, coq.CS.db-for _ Pat DBGTyL, std.map-filter DBGTyL get-cs-instance StructL, ]. pred has-CS-instance? i:term, i:structure. has-CS-instance? TyTerm (indt Struct) :- std.do! [ term->cs-pattern TyTerm Pat, coq.env.projections Struct [some Proj, _], coq.CS.db-for (const Proj) Pat L, not(L = []) ]. pred structure-nparams i:structure, o:int. structure-nparams Structure NParams :- class-def (class Class Structure _), factory-nparams Class NParams. pred factory? i:term, o:w-args factoryname. factory? S (triple F Params T) :- not (var S), !, safe-dest-app S (global GR) Args, factory-alias->gref GR F ok, factory-nparams F NP, !, std.split-at NP Args Params [T|_]. % [find-max-classes Mixins Classes] states that Classes is a list of classes % which contain all the mixins in Mixins. % Although it is not strictly necessary, but desirable for debugging, % we use a heuristic that tries to minimize the number % of classes by assuming Mixins are reversed topologically sorted. % Note: works with flat mixins, no params pred find-max-classes i:list mixinname, o:list classname. find-max-classes [] []. find-max-classes [M|Mixins] [C|Classes] :- mixin-first-class M C, std.do! [ class-def (class C _ MLwP), list-w-params_list MLwP ML, std.filter Mixins (x\ not (std.mem! ML x)) Mixins', find-max-classes Mixins' Classes ]. find-max-classes [M|_] _ :- coq.error "HB: cannot find a class containing mixin" M. hierarchy-builder-1.8.1/HB/common/log.elpi000066400000000000000000000464501474513043100203530ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ % This file contains proxies for the API to write into the Coq state (eg add % an inductive, set implicit arguments...). This has two purposes: % - give nicer error messages % - we want to be able to log to a file all these actions (WIP), this file is % were logging takes place. Hence we never call, say, coq.evn.add-* directly, % but always via this proxy namespace log.coq { pred arguments.set-implicit i:gref, i:list (list implicit_kind). arguments.set-implicit GR I :- std.do! [ coq.arguments.set-implicit GR I, if (@local!) (Local = tt) (Local = ff), log.private.log-vernac (log.private.coq.vernac.implicit Local {coq.gref->id GR} I), ]. pred env.add-location i:gref. env.add-location GR :- if (get-option "elpi.loc" Loc) % remove when coq-elpi > 1.9 (acc-clause library (decl-location GR Loc)) true. pred strategy.set i:list constant, i:conversion_strategy. strategy.set CL S :- coq.strategy.set CL S, log.private.log-vernac (log.private.coq.vernac.strategy CL S). pred env.add-const-noimplicits i:id, i:term, i:term, i:opaque?, o:constant. env.add-const-noimplicits Name Bo Ty Opaque C :- std.do! [ if (not(ground_term Ty ; ground_term Bo)) (coq.error "HB: cannot infer some information in" Name ":" {coq.term->string Ty} ":=" {coq.term->string Bo}) true, avoid-name-collision Name Name1, coq.env.add-const Name1 Bo Ty Opaque C, env.add-location (const C), if (var Ty) (Ty? = none) (Ty? = some Ty), log.private.log-vernac (log.private.coq.vernac.definition Name1 Ty? Bo), @local! => arguments.set-implicit (const C) [[]], ]. pred env.add-const i:id, i:term, i:term, i:opaque?, o:constant. env.add-const Name Bo Ty Opaque C :- std.do! [ if (not(ground_term Ty ; ground_term Bo)) (coq.error "HB: cannot infer some information in" Name ":" {coq.term->string Ty} ":=" {coq.term->string Bo}) true, avoid-name-collision Name Name1, coq.env.add-const Name1 Bo Ty Opaque C, env.add-location (const C), if (var Ty) (Ty? = none) (Ty? = some Ty), log.private.log-vernac (log.private.coq.vernac.definition Name1 Ty? Bo), ]. pred env.add-const-noimplicits-failondup i:id, i:term, i:term, i:opaque?, o:constant. env.add-const-noimplicits-failondup Name Bo Ty Opaque C :- std.do! [ if (not(ground_term Ty ; ground_term Bo)) (coq.error "HB: cannot infer some information in" Name ":" {coq.term->string Ty} ":=" {coq.term->string Bo}) true, coq.env.add-const Name Bo Ty Opaque C, env.add-location (const C), if (var Ty) (Ty? = none) (Ty? = some Ty), log.private.log-vernac (log.private.coq.vernac.definition Name Ty? Bo), @local! => arguments.set-implicit (const C) [[]], ]. pred env.add-parameter i:id, i:term, o:constant. env.add-parameter ID Ty C :- std.do! [ @global! => coq.env.add-axiom ID Ty C, log.private.log-vernac (log.private.coq.vernac.parameter ID Ty), ]. pred env.add-indt i:indt-decl, o:inductive. env.add-indt Decl I :- std.do! [ if (not(coq.ground-indt-decl? Decl)) (coq.error "HB: cannot infer some information in" {coq.indt-decl->string Decl}) true, coq.env.add-indt Decl I, (coq.env.record? I P ; P = ff), log.private.log-vernac (log.private.coq.vernac.inductive Decl P), env.add-location (indt I), % copy the current value of implicit arguments coq.env.indt I _ _ _ _ KS _, log.private.log-implicits-of ff (indt I), std.forall KS (k\ env.add-location (indc k), log.private.log-implicits-of ff (indc k)), std.forall {coq.env.projections I} (p\ sigma c\ if (p = some c) (env.add-location (const c), log.private.log-implicits-of ff (const c)) true), ]. pred env.begin-module i:id, i:option (pair modtypath id). env.begin-module Name none :- std.do! [ coq.env.begin-module Name none, log.private.log-vernac (log.private.coq.vernac.begin-module Name none), ]. env.begin-module Name (some (pr Sig SigName)) :- std.do! [ coq.env.begin-module Name (some Sig), log.private.log-vernac (log.private.coq.vernac.begin-module Name (some SigName)), ]. pred env.begin-module-type i:id. env.begin-module-type Name :- std.do! [ coq.env.begin-module-type Name, log.private.log-vernac (log.private.coq.vernac.begin-module-type Name), ]. pred env.end-module-name i:id, o:modpath. env.end-module-name Name M :- std.do! [ coq.env.end-module M, log.private.log-vernac (log.private.coq.vernac.end-module Name), ]. pred env.end-module-type-name i:id, o:modtypath. env.end-module-type-name Name M :- std.do! [ coq.env.end-module-type M, log.private.log-vernac (log.private.coq.vernac.end-module-type Name), ]. pred env.begin-section i:id. env.begin-section Name :- std.do! [ coq.env.begin-section Name, log.private.log-vernac (log.private.coq.vernac.begin-section Name), ]. pred env.end-section-name i:id. env.end-section-name Name :- std.do! [ coq.env.end-section, log.private.log-vernac (log.private.coq.vernac.end-section Name), ]. pred notation.add-abbreviation i:id, i:int, i:term, i:bool, o:abbreviation. notation.add-abbreviation Name NArgs Body OnlyParsing O :- std.do! [ coq.notation.add-abbreviation Name NArgs Body OnlyParsing O, log.private.log-vernac (log.private.coq.vernac.abbreviation Name NArgs Body), ]. pred env.export-module i:id, i:modpath. env.export-module MPNice M :- std.do! [ coq.env.export-module M, log.private.log-vernac (log.private.coq.vernac.export-module MPNice), ]. pred env.import-module i:id, i:modpath. env.import-module MPNice M :- std.do! [ coq.env.import-module M, log.private.log-vernac (log.private.coq.vernac.import-module MPNice), ]. pred coercion.declare i:coercion. coercion.declare C :- std.do! [ @global! => @reversible! => coq.coercion.declare C, C = coercion GR _ SRCGR TGTCL, coq.gref->id GR Name, log.private.log-vernac (log.private.coq.vernac.coercion Name SRCGR TGTCL), ]. } % Since CS.foo is not a valid predicate name we can't use it % in the namespace, so we just define it here with the full name pred log.coq.CS.declare-instance i:constant. log.coq.CS.declare-instance C :- std.do! [ if (@local!) (Local = tt) (Local = ff), coq.CS.declare-instance (const C), coq.gref->id (const C) Id, std.last {coq.gref->path (const C)} M, std.last {coq.env.current-path} M1, if (M = M1) (Name = Id) (Name is M ^ "." ^ Id), log.private.log-vernac (log.private.coq.vernac.canonical Name Local), ]. pred log.coq.check i:term, o:term, o:term, o:diagnostic. log.coq.check Skel Ty T D :- std.do! [ coq.elaborate-skeleton Skel Ty T D, if (get-option "fail" tt) (Fail = tt) (Fail = ff), log.private.log-vernac (log.private.coq.vernac.check Skel Fail), ]. pred refine i:term, i:goal, o:list sealed-goal. % to silence a warning, since this is only in tactics pred log.refine i:term, i:goal, o:list sealed-goal. log.refine T G GL :- std.do! [ refine T G GL, G = goal _ _ _ Solution _, log.private.log-tactic Solution, ]. pred refine.no_check i:term, i:goal, o:list sealed-goal. % to silence a warning, since this is only in tactics pred log.refine.no_check i:term, i:goal, o:list sealed-goal. log.refine.no_check T G GL :- std.do! [ refine.no_check T G GL, G = goal _ _ _ Solution _, log.private.log-tactic Solution, ]. namespace log.private { %%%%% Logging Utils %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pred log-implicits-of i:bool, i:gref. log-implicits-of Local GR :- coq.arguments.implicit GR I, if (std.forall I (i\ std.forall i (x\ x = explicit))) (IMP = [[]]) (IMP = I), log.private.log-vernac (log.private.coq.vernac.implicit Local {coq.gref->id GR} IMP). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Coq document % This is a very minimalistic AST to represent a Coq document equipped with % pretty printing facilities. % % When "complete enough" this should be moved to coq-elpi proper. kind coq.vernac type. type coq.vernac.begin-module string -> option string -> coq.vernac. type coq.vernac.end-module string -> coq.vernac. type coq.vernac.begin-module-type string -> coq.vernac. type coq.vernac.end-module-type string -> coq.vernac. type coq.vernac.begin-section string -> coq.vernac. type coq.vernac.end-section string -> coq.vernac. type coq.vernac.import-module string -> coq.vernac. type coq.vernac.export-module string -> coq.vernac. type coq.vernac.definition string -> option term -> term -> coq.vernac. type coq.vernac.variable string -> term -> coq.vernac. type coq.vernac.parameter string -> term -> coq.vernac. type coq.vernac.inductive indt-decl -> bool -> coq.vernac. type coq.vernac.abbreviation string -> int -> term -> coq.vernac. type coq.vernac.notation string -> int -> term -> coq.vernac. type coq.vernac.coercion string -> gref -> class -> coq.vernac. type coq.vernac.canonical string -> bool -> coq.vernac. type coq.vernac.implicit bool -> string -> list (list implicit_kind) -> coq.vernac. type coq.vernac.comment A -> coq.vernac. type coq.vernac.check term -> bool -> coq.vernac. type coq.vernac.strategy list constant -> conversion_strategy -> coq.vernac. } pred with-logging i:prop. pred log.private.log-vernac i:log.private.coq.vernac. pred log.private.log-tactic i:term. /* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ % implementation of logging and vernac printing with-logging P :- (get-option "elpi.hb.log" _, NICE = tt ; get-option "elpi.hb.log.raw" _, NICE = ff), !, get-option "elpi.loc" Loc, loc.fields Loc FILE Start Stop _ _, LocStr is "characters " ^ {std.any->string Start} ^ "-" ^ {std.any->string Stop}, FILENAME is FILE ^ ".hb", open_append FILENAME OC1, std.string.concat "\n" ["","HIERARCHY BUILDER PATCH v1",LocStr,""] PATCH1, output OC1 PATCH1, close_out OC1, (log.private.logger L NICE => P), log.private.logger-close L, std.intersperse coq.pp.spc L PP, coq.pp->string (coq.pp.box (coq.pp.v 0) PP) S, open_append FILENAME OC2, output OC2 S, close_out OC2. with-logging P :- (get-option "log" tt, NICE = tt ; get-option "log.raw" tt, NICE = ff), !, (log.private.logger L NICE => P), log.private.logger-close L, std.intersperse coq.pp.spc L PP, coq.pp->string (coq.pp.box (coq.pp.v 0) PP) S, coq.say "(* \n" S "\n*)". with-logging P :- P. log.private.log-vernac V :- log.private.logger L Nice, !, if (Nice = tt) (PPALL = []) (PPALL = [@ppall!]), log.private.logger-extend L {PPALL => log.private.coq.vernac->pp [V]}. log.private.log-vernac _. log.private.log-tactic P :- log.private.logger L Nice, !, if (Nice = tt) (PPALL = []) (PPALL = [@ppall!]), log.private.logger-extend L {PPALL => @holes! => coq.term->pp P}. log.private.log-tactic _. % The main entry point to print vernacular commands is coq.vernac->pp shorten log.private.coq.vernac.{ begin-module , end-module , begin-section, end-section }. shorten log.private.coq.vernac.{ begin-module-type , end-module-type }. shorten log.private.coq.vernac.{ import-module , export-module }. shorten log.private.coq.vernac.{ definition , variable , comment , check }. shorten log.private.coq.{ vernac.inductive , vernac.implicit , vernac.parameter }. shorten log.private.coq.vernac.{ canonical , abbreviation , notation , coercion , strategy }. shorten log.private.{ coq.vernac }. shorten coq.pp.{ box , h , spc , v , str , hv , hov, glue, brk }. namespace log.private { pred logger o:list coq.pp, o:bool. pred logger-extend i:list coq.pp, i:coq.pp. logger-extend [] _ :- coq.error "HB: logger was closed". logger-extend (uvar as X) V :- X = [V|FRESH_]. logger-extend [_|XS] V :- logger-extend XS V. pred logger-close i:list coq.pp. logger-close (uvar as X) :- X = []. logger-close [_|XS] :- logger-close XS. pred coq.vernac->pp i:list coq.vernac, o:coq.pp. coq.vernac->pp L (box (v 0) L2) :- std.map L coq.vernac->pp1 L1, std.intersperse spc L1 L2. pred coq.vernac->pp1 i:coq.vernac, o:coq.pp. coq.vernac->pp1 (begin-module Name none) PP :- PP = box h [str "Module ", str Name, str "."]. coq.vernac->pp1 (begin-module Name (some TyName)) PP :- PP = box h [str "Module ", str Name, str " : ", str TyName, str "."]. coq.vernac->pp1 (end-module Name) PP :- PP = box h [str "End ", str Name, str "."]. coq.vernac->pp1 (begin-module-type Name) PP :- PP = box h [str "Module Type ", str Name, str "."]. coq.vernac->pp1 (end-module-type Name) PP :- PP = box h [str "End ", str Name, str "."]. coq.vernac->pp1 (begin-section Name) PP :- PP = box h [str "Section ", str Name, str "."]. coq.vernac->pp1 (end-section Name) PP :- PP = box h [str "End ", str Name, str "."]. coq.vernac->pp1 (definition Name none Body) PP :- PP = box (hv 2) [str "Definition ", str Name, str " :=", spc, B, str "."], coq.term->pp Body B. coq.vernac->pp1 (definition Name (some Ty) Body) PP :- PP = box (hv 2) [str "Definition ", str Name, str " : ", T, str " :=", spc, B, str "."], coq.term->pp Ty T, coq.term->pp Body B. coq.vernac->pp1 (variable Name Ty) (box (hv 2) [box h [str "Variable ", str Name, str " :"], spc, TY, str "."]) :- coq.term->pp Ty TY. coq.vernac->pp1 (vernac.parameter Name Ty) (box (hv 2) [box h [str "Parameter ", str Name, str " :"], spc, TY, str "."]) :- coq.term->pp Ty TY. coq.vernac->pp1 (import-module Name) (box h [str "Import ", str Name, str "."]). coq.vernac->pp1 (export-module Name) (box h [str "Export ", str Name, str "."]). coq.vernac->pp1 (notation KM NParams Term) (box (hv 2) [box h [str "Notation \"'",str KM,str"' "|StrParams], str "\" := (", spc, B, str ") (at level 1)."]) :- !, coq.vernac->ppabbrterm NParams Term StrParams B. coq.vernac->pp1 (abbreviation Name NParams Term) (box (hv 2) [box h [str "Notation ",str Name|StrParams], str " := (", spc, B, str ")."]) :- coq.vernac->ppabbrterm NParams Term StrParams B. coq.vernac->pp1 (canonical Name Local) (box h [Locality, str "Canonical ", str Name, str "."]) :- local->locality Local Locality. coq.vernac->pp1 (coercion Name SRC TGT) (box h [str "#[reversible] Coercion ", str Name, str " : ", str S, str " >-> ", str T, str "."]) :- coq.gref->path SRC SP, std.string.concat "." {std.take-last 2 SP} S', S is S' ^ "." ^ {coq.gref->id SRC}, if2 (TGT = sortclass) (T = "Sortclass") (TGT = funclass) (T = "Funclass") (TGT = grefclass GR, coq.gref->path GR GRP, std.string.concat "." {std.take-last 2 GRP} T', T is T' ^ "." ^ {coq.gref->id GR}). coq.vernac->pp1 (vernac.inductive I Primitive) (glue [str Start, PP, str Stop]) :- coq.vernac->ppinductive I [] PP, if (Primitive = tt) (Start = "Set Primitive Projections. ", Stop = "Unset Primitive Projections. ") (Start = "", Stop = ""). coq.vernac->pp1 (vernac.implicit Local Name [[]]) (box h [Locality, str "Arguments ", str Name, str " : clear implicits."]) :- local->locality Local Locality. coq.vernac->pp1 (vernac.implicit Local Name [L]) (box h [Locality, str "Arguments ", str Name, spc, glue PP, str "."]) :- local->locality Local Locality, std.map L coq.vernac->ppimparg PP1, std.intersperse spc PP1 PP. coq.vernac->pp1 (comment A) (box (hov 2) [str"(*", str S, str"*)"]) :- std.any->string A S. coq.vernac->pp1 (check T Fail) (box (hov 2) [Failure, str"Check", spc, PPT, str"."]) :- (@holes! => coq.term->pp T PPT), fail->failure Fail Failure. coq.vernac->pp1 (strategy L opaque) (box (hov 2) [str"Strategy opaque [", glue PPL , str"]."]) :- std.map L (c\r\sigma id\coq.gref->id (const c) id, r = str id) LID, std.intersperse spc LID PPL. coq.vernac->pp1 (strategy L expand) (box (hov 2) [str"Strategy expand [", glue PPL , str"]."]) :- std.map L (c\r\sigma id\coq.gref->id (const c) id, r = str id) LID, std.intersperse spc LID PPL. coq.vernac->pp1 (strategy L (level N)) (box (hov 2) [str"Strategy ",str NPP,str" [", glue PPL , str"]."]) :- std.any->string N NPP, std.map L (c\r\sigma id\coq.gref->id (const c) id, r = str id) LID, std.intersperse spc LID PPL. pred local->locality i:bool, o:coq.pp. local->locality tt (str "Local "). local->locality ff (str "Global "). pred fail->failure i:bool, o:coq.pp. fail->failure tt (str "Fail "). fail->failure ff (str ""). pred coq.vernac->ppimparg i:implicit_kind, o:coq.pp. coq.vernac->ppimparg explicit (str "_"). coq.vernac->ppimparg maximal (str "{_}"). coq.vernac->ppimparg implicit (str "[_]"). pred coq.vernac->ppinductive i:indt-decl, i:list (pair implicit_kind term), o:coq.pp. coq.vernac->ppinductive (parameter ID IMPL TY I) Acc R :- @pi-parameter ID TY p\ coq.vernac->ppinductive (I p) [pr IMPL p|Acc] R. coq.vernac->ppinductive (record ID SORT KID RD) ParamsRev (box (v 0) [Hack1, PP, Hack2]) :- PP = (box (hov 0) [ box (hov 0) [str "Record", spc, str ID, brk 1 4, glue ParamsPP, str " : ", SortPP, brk 1 2, str":= ", str KID], brk 1 2, box (hv 2) [str"{", spc, glue FieldsPP, str"}"], str"."]), Hack1 = glue [str "Section ", str ID, str ".", spc, str "Local Unset Implicit Arguments.", spc], Hack2 = glue [spc, str "End ", str ID, str".", spc], std.rev ParamsRev Params, coq.vernac->ppinductiveparams Params ParamsPP, coq.term->pp SORT SortPP, coq.vernac->pprecordfields RD FieldsPP. coq.vernac->ppinductive (inductive ID IsInd Arity Ks) ParamsRev PP :- PP = (box (hov 0) [ str CO,str "Inductive", spc, box (hov 0) [ str ID, brk 1 4, glue ParamsPP, ArityPP, str " :="], brk 0 2, box (hv 2) [str" ", glue KsPp], str "."]), std.rev ParamsRev Params, coq.vernac->ppinductiveparams Params ParamsPP, std.map Params snd ParamsAsArgs, if (IsInd = tt) (CO = "") (CO = "Co"), coq.arity->pp Arity ArityPP, @pi-inductive ID Arity x\ coq.mk-app x ParamsAsArgs (X x), coq.vernac->ppinductiveconstructor (Ks (X x)) KsPp. pred coq.vernac->ppinductiveconstructor i:list indc-decl, o:list coq.pp. coq.vernac->ppinductiveconstructor [] []. coq.vernac->ppinductiveconstructor [constructor ID Arity|Ks] PP :- PP = [str ID,{coq.arity->pp Arity},SEP|Rest], if (Ks = []) (SEP = str"") (SEP = glue [brk 1 0, str "| "]), coq.vernac->ppinductiveconstructor Ks Rest. pred coq.vernac->ppinductiveparams i:list (pair implicit_kind term), o:list coq.pp. coq.vernac->ppinductiveparams [] []. coq.vernac->ppinductiveparams [pr Imp T|Rest] PP :- PP = [box (hov 2) [str A,ID,str " : ", TY,str B]|PPRest], coq.term->pp T ID, decl T _ Ty, coq.term->pp Ty TY, if2 (Imp = explicit) (A = "(", B = ")") (Imp = maximal) (A = "{", B = "}") (A = "[", B = "]"), coq.vernac->ppinductiveparams Rest PPRest. pred coq.vernac->pprecordfields i:record-decl, o:list coq.pp. coq.vernac->pprecordfields end-record []. coq.vernac->pprecordfields (field _ ID TY F) [ str ID, str " : ", TYPP, str ";", spc|FPP] :- % TODO attributes coq.term->pp TY TYPP, @pi-parameter ID TY p\ coq.vernac->pprecordfields (F p) FPP. pred coq.vernac->ppabbrterm i:int, i:term, o:list coq.pp, o:coq.pp. coq.vernac->ppabbrterm 0 T [] B :- !, @holes! => coq.term->pp T B. coq.vernac->ppabbrterm N (fun _ _ F) [spc,str ID|StrParams] B :- ID is "X" ^ {std.any->string N}, coq.id->name ID Name, M is N - 1, @pi-decl Name (sort prop) x\ coq.vernac->ppabbrterm M (F x) StrParams B. } hierarchy-builder-1.8.1/HB/common/phant-abbreviation.elpi000066400000000000000000000324161474513043100233440ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ % Kit to build abbreviations /à la/ *pack*, that is % [Notation N x_0 .. x_n := C x_0 .. _ _ id .. x_i .. _ id _ _ id] % with a variable number of [_] between each [id], and where % - [x_i] is given by the user % - [_] correspond to arguments that are left implicit, % - [id] trigger unification as described in % - [Phant x] to infer the canonical structure on x % % See /Canonical Structures for the working Coq user/ by Mahboubi and Tassi % This type is private, build it via the APIs below typeabbrev phant-term phant.private.phant-term. namespace phant { % [add-abbreviation Name PhT C A] builds a definition "phant_Name" for the % term T and an abbreviation Name as per Ph. % Use the API below to build a PhT as you like. pred add-abbreviation i:string, i:phant-term, o:constant, o:abbreviation. add-abbreviation N (private.phant-term AL T1) C Abbrev :- std.do! [ NC is "phant_" ^ N, std.assert-ok! (coq.elaborate-skeleton T1 TTy T) "add-abbreviation: T illtyped", log.coq.env.add-const-noimplicits NC T TTy @transparent! C, private.build-abbreviation 0 (global (const C)) AL NParams AbbrevT, @global! => log.coq.notation.add-abbreviation N NParams AbbrevT tt Abbrev, ]. % [of-gref WithCopy GR RealMixinArgs PT] % builds a phant-term taking all parameters, % the type, then inferring automatically all structures covering the mixins % GR depends on. RealMixinArgs is a list of mixins one wants to explicitly % pass (instead of being inferred) % If WithCopy = tt, an extra argument is added after all the parameters % and before the source keu to replace the target key by a user chosen one. pred of-gref i:bool, i:gref, i:list mixinname, o:phant-term. of-gref WithCopy GRF RealMixinArgs PhBody:- !, std.do! [ std.assert! (gref-deps GRF MLwP) "mk-phant-term: unknown gref", std.assert! (coq.env.typeof GRF FTy) "mk-phant-term: F illtyped", coq.mk-eta (-1) FTy (global GRF) EtaF, % toposort-mixins ML MLSorted, MLwP = MLwPSorted, % Assumes we give them already sorted in dep order. std.rev {list-w-params_list MLwPSorted} MLSortedRev, std.map RealMixinArgs (m\ r\ r = private.this-mixin-is-real-arg m) RMClauses, std.filter MLSortedRev (m\ not(std.mem! RealMixinArgs m)) MLSortedRevFiltered, find-max-classes MLSortedRevFiltered CNL, assert-good-coverage! MLSortedRevFiltered CNL, RMClauses => if (WithCopy = ff) (w-params.then MLwP fun-real fun-real (ps\ t\ ml\ o\ private.mk-phant-term.classes EtaF CNL ps t t ml o) PhBody) (w-params.fold MLwP fun-real (private.mk-phant-term-with-copy EtaF CNL) PhBody ) ]. % API à la carte: start with a term and wrap it up ------------------------- % A term with no phantom arguments pred init i:term, o:phant-term. init T (private.phant-term [] T). % [fun-real N T Ph Ph1] Adds a real argument named N of type T around Ph pred fun-real i:name, i:term, i:(term -> phant-term), o:phant-term. fun-real N T F Res :- !, private.phant-fun (private.real N) T F Res. % [fun-unify Msg X1 X2 Ph Ph1] Adds an argument that will foce the unification % of X1 with X2 and print Msg is case of error around Ph pred fun-unify i:option term, i:term, i:term, i:phant-term, o:phant-term. fun-unify OMsg X1 X2 (private.phant-term AL F) (private.phant-term [private.unify|AL] UF) :- std.assert-ok! (coq.typecheck X1 T1) "fun-unify: X1 illtyped", std.assert-ok! (coq.typecheck X2 T2) "fun-unify: X2 illtyped", if (OMsg = some M) (Msg = {{lib:hb.not_a_msg lp:M}}) (Msg = {{lib:hb.nomsg}}), UF = {{fun unif_arbitrary : lib:hb.unify lp:T1 lp:T2 lp:X1 lp:X2 lp:Msg => lp:F}}. % [fun-implicit N T Ph Ph1] Adds an implicit argument name N of type T areound Ph pred fun-implicit i:name, i:term, i:(term -> phant-term), o:phant-term. fun-implicit N Ty (t\ private.phant-term AL (F t)) (private.phant-term [private.implicit|AL] (fun N Ty F)). % [fun-infer-type N T Ph Ph1] Adds an argument N of type T such that one passes % a value V of type {{ Type }} the corresponding canonical VC of type T is passed % for N , eg `fun T (phT : phant T) => Ph` pred fun-infer-type i:class, i:name, i:term, i:(term -> phant-term), o:phant-term. fun-infer-type sortclass N Ty (t\private.phant-term AL (Bo t)) Out :- coq.name-suffix N "ph" PhN, fun-implicit N Ty (t\private.phant-term [private.infer-type N sortclass|AL] (fun PhN {{ lib:@hb.phant lp:t }} _\ Bo t)) Out. fun-infer-type funclass N Ty (t\private.phant-term AL (Bo t)) Out :- coq.name-suffix N "ph" PhN, fun-implicit N Ty (t\private.phant-term [private.infer-type N funclass|AL] (fun PhN {{ lib:@hb.phantom (_ -> _) lp:t }} _\ Bo t)) Out. fun-infer-type (grefclass Class) N Ty (t\private.phant-term AL (Bo t)) Out :- coq.name-suffix N "ph" PhN, private.build-type-pattern Class Pat, fun-implicit N Ty (t\private.phant-term [private.infer-type N (grefclass Class)|AL] (fun PhN {{ lib:@hb.phantom lp:Pat lp:t }} _\ Bo t)) Out. % TODO: this looks like a hack to remove pred append-fun-unify i:phant-term, o:phant-term. append-fun-unify (private.phant-term LP T) (private.phant-term LPU T) :- std.append LP [private.unify] LPU. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { % phant-term is a pair of a list of argument kinds together with a term kind phant-term type. type phant-term list phant-arg -> term -> phant-term. % phant-arg encode these three kind of arguments % - [x_i] is encoded using [real x_i] % - [_] using [implicit] % - [id] using [unify] % - [Phant x] using [infer-type] kind phant-arg type. type real name -> phant-arg. type infer-type name -> class -> phant-arg. type implicit phant-arg. type unify phant-arg. shorten coq.{ mk-app }. pred this-mixin-is-real-arg o:mixinname. pred phant-fun i:phant-arg, i:term, i:(term -> phant-term), o:phant-term. phant-fun Arg Ty PhF (phant-term [Arg|ArgL] (fun N Ty F)) :- if (Arg = real N) true (N = `_`), @pi-decl N Ty x\ PhF x = phant-term ArgL (F x). % [phant-fun-mixin N Ty PF PUF] states that PUF is a phant-term % which quantifies [PF x] over [x : Ty] (with name N) % Ty must be an (applied) mixin M, and the phantom status of this mixin % is determined by [this-mixin-is-real-arg M]. pred phant-fun-mixin i:name, i:term, i:(term -> phant-term), o:phant-term. phant-fun-mixin N Ty PF (private.phant-term [Status|AL] (fun N Ty F)) :- !, std.do! [ @pi-decl N Ty t\ PF t = private.phant-term AL (F t), coq.safe-dest-app Ty (global Mixin) _, if (this-mixin-is-real-arg Mixin) (Status = private.real N) (Status = private.implicit) ]. pred fun-unify-mixin i:term, i:name, i:term, i:(term -> phant-term), o:phant-term. fun-unify-mixin T N Ty PF Out :- !, std.do! [ coq.safe-dest-app Ty (global M) _, Msg is "fun-unify-mixin: No mixin-src on " ^ {coq.term->string T}, std.assert! (mixin-src T M Msrc) Msg, (@pi-decl `m` Ty m\ fun-unify none m Msrc (PF m) (PFM m)), fun-implicit N Ty PFM Out ]. % [phant-fun-struct T S Params PF PSF] states that PSF is a phant-term % which postulate a structure [s : S Params] such that [T = sort s] % and then outputs [PF s] pred phant-fun-struct i:term, i:name, i:structure, i:list term, i:(term -> phant-term), o:phant-term. phant-fun-struct T Name S Params PF Out :- std.do! [ get-structure-sort-projection S SortProj, mk-app (global S) Params SParams, mk-app SortProj Params SortProjParams, % Msg = {{lib:hb.nomsg}}, Msg = some {{lp:SParams}}, (@pi-decl Name SParams s\ fun-unify Msg T {mk-app SortProjParams [s]} (PF s) (UnifSI s)), fun-implicit Name SParams UnifSI Out ]. % A *pack* notation can be easiliy produced from a phant-term using % [add-abbreviation N PT C], which states that C is a new constant % which name is phant_N, and which produces a simple notation % with name N using the data of the phant-term PT to reconstruct a notation % [Notation N x0 .. xn := C x0 _ _ id .. xi .. _ id _ _ id] % as described above. pred build-abbreviation i:int, i:term, i:list phant-arg, o:int, o:term. build-abbreviation K F [] K F. build-abbreviation K F [real N|AL] K'' (fun N _ AbbrevFx) :- !, pi x\ build-abbreviation K {mk-app F [x]} AL K' (AbbrevFx x), K'' is K' + 1. build-abbreviation K F [infer-type N sortclass|AL] K'' (fun N _ AbbrevFx) :- !, pi x\ build-abbreviation K {mk-app F [{{ lib:hb.Phant lp:x }}]} AL K' (AbbrevFx x), K'' is K' + 1. build-abbreviation K F [infer-type N funclass|AL] K'' (fun N _ AbbrevFx) :- !, pi x\ build-abbreviation K {mk-app F [{{ lib:hb.Phantom (_ -> _) lp:x }}]} AL K' (AbbrevFx x), K'' is K' + 1. build-abbreviation K F [infer-type N (grefclass Class)|AL] K'' (fun N _ AbbrevFx) :- !, build-type-pattern Class Pat, pi x\ build-abbreviation K {mk-app F [{{ lib:hb.Phantom lp:Pat lp:x }}]} AL K' (AbbrevFx x), K'' is K' + 1. build-abbreviation K F [implicit|AL] K' FAbbrev :- !, build-abbreviation K {mk-app F [_]} AL K' FAbbrev. build-abbreviation K F [unify|AL] K' FAbbrev :- !, build-abbreviation K {mk-app F [{{lib:@hb.id _ _}}]} AL K' FAbbrev. % [build-type-pattern GR Pat] cheks that GR : forall x_1 ... x_n, Type % and returns Pat = GR _ ... _ (that is GR applied to n holes). % Note that n can be 0 when GR : Type. pred build-type-pattern i:gref, o:term. build-type-pattern GR Pat :- build-type-pattern.aux GR {coq.env.typeof GR} Pat. build-type-pattern.aux GR T {{ lp:Pat _ }} :- coq.unify-eq T (prod N S T') ok, !, @pi-decl N S x\ build-type-pattern.aux GR (T' x) Pat. build-type-pattern.aux GR T (global GR) :- coq.unify-eq T {{ Type }} ok, !. build-type-pattern.aux _ _ _ :- coq.error "HB: wrong carrier type". % [mk-phant-term F PF] states that % if F = fun p1 .. p_k T m_0 .. m_n => _ % then PF = phant-term % [real p_1, ... real p_k, real T, implicit, .., implicit, % implicit, .., implicit, % implicit, unify, % implicit, unify, % implicit, .., implicit, unify, % unify, ..., unify, % ..., % implicit, .., implicit, % implicit, unify, % implicit, unify, % implicit, .., implicit, unify, % unify, ..., unify] % {{fun p_1 ... p_k T m_0 .. m_n => % fun q_1 .. q_l => % [find t | T ~ t] % [find s_0 | t ~ s_0] % [find c_0 | s_0 ~ SK q_1 .. q_l t c_0] % [find m'_{i_0_0}, .., m'_{i_0_n0} | c_0 ~ CK m'_{i_0_0} .. m'_{i_0_n0}] % fun of hb.unify m_{i_0_0} m'_{i_0_0} & ... & hb.unify m_{i_0_n0} m'_{i_0_n0} => % ... % fun q'_1 .. q'_l' => % [find t | T ~ t] % [find s_k | t ~ s_k] % [find c_k | s_k ~ SK q'_1 .. q'_l' y c_k] % [find m'_{i_k_0}, .., m'_{i_k_nk} | c_0 ~ CK m'_{i_k_0} .. m'_{i_k_nk}] % fun of hb.unify m_{i_0_0} m'_{i_0_0} & ... & hb.unify m_{i_k_nk} m'_{i_k_nk} => % F p_1 ... p_k T m_i0_j0 .. m_il_jl}} pred mk-phant-term.mixins i:term, i:term, i:classname, i:phant-term, i:list term, i:name, i:term, i:(term -> list (w-args mixinname)), o:phant-term. mk-phant-term.mixins Target Src CN PF Params N Ty MLwA Out :- std.do! [ class-def (class CN SI _), mk-app (global SI) Params SIParams, coq.name-suffix N "local" Nlocal, (@pi-decl Nlocal Ty t\ sigma SK KC ML ParamsT SKPT\ std.do! [ std.map (MLwA t) triple_1 ML, std.append Params [t] ParamsT, SKPT = app [global {get-constructor SI} | ParamsT], ClassTy t = app [global CN | ParamsT], (@pi-decl `s` SIParams s\ @pi-decl `c` (ClassTy t) c\ sigma PF2\ std.do![ synthesis.under-mixins.then (MLwA t) (fun-unify-mixin Target) (mk-phant-term.mixins.aux t Params c CN PF) PF2, fun-unify none s {mk-app SKPT [c]} PF2 (PFU t s c), ]), Body t = {fun-unify none t Src {phant-fun-struct t `s` SI Params s\ {fun-implicit `c` (ClassTy t) (PFU t s)}}} ]), fun-implicit Nlocal Ty Body Out ]. mk-phant-term.mixins.aux T Params C CN PF X :- std.do![ get-constructor CN KC, synthesis.infer-all-gref-deps Params T KC KCM, fun-unify none KCM C PF X, ]. pred mk-phant-term.class i:term, i:term, i:classname, i:phant-term, o:phant-term. mk-phant-term.class Target Src CN PF CPF :- !, std.do! [ class-def (class CN _ CMLwP), w-params.fold CMLwP fun-implicit (mk-phant-term.mixins Target Src CN PF) CPF, ]. pred mk-phant-term.classes i:term, i:list classname, i:list term, i:term, i:term, i:list (w-args mixinname), o:phant-term. mk-phant-term.classes EtaF CNF PL Target Src MLwA PhF :- !, std.do! [ std.map MLwA triple_1 ML, synthesis.under-mixins.then MLwA phant-fun-mixin (out\ sigma FPLTM\ std.do! [ synthesis.infer-all-these-mixin-args PL Target ML EtaF FPLTM, std.fold CNF (phant-term [] FPLTM) (mk-phant-term.class Target Src) out]) PhF ]. pred mk-phant-term-with-copy i:term, i:list classname, i:list term, i:name, i:term, i:(term -> list (w-args mixinname)), o:phant-term. mk-phant-term-with-copy EtaF CNF PL N Ty MLwA PhF :- !, std.do! [ (@pi-decl N Ty target\ @pi-decl N Ty src\ sigma Body\ mk-phant-term.classes EtaF CNF PL target src (MLwA target) Body, fun-unify none target src Body (BodyUnif target src)), fun-real N Ty (target\ {fun-real N Ty (BodyUnif target)}) PhF ]. }} hierarchy-builder-1.8.1/HB/common/stdpp.elpi000066400000000000000000000343411474513043100207200ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ % This file contains additions to elpi or coq-elpi standard library % elpi:if version < 2.0.0 kind triple type -> type -> type -> type. type triple A -> B -> C -> triple A B C. pred triple_1 i:triple A B C, o:A. triple_1 (triple A _ _) A. pred triple_2 i:triple A B C, o:B. triple_2 (triple _ B _) B. pred triple_3 i:triple A B C, o:C. triple_3 (triple _ _ C) C. % elpi:endif namespace std { pred nlist i:int, i:A, o: list A. nlist N X L :- std.map {std.iota N} (_\ y\ y = X) L. pred list-diff i:list A, i:list A, o:list A. list-diff X [] X. list-diff L [D|DS] R :- std.filter L (x\ not(x = D)) L1, list-diff L1 DS R. pred list-uniq i:list A, o:list A. pred list-uniq.seen i:A. list-uniq [] []. list-uniq [X|XS] YS :- list-uniq.seen X, !, list-uniq XS YS. list-uniq [X|XS] [X|YS] :- list-uniq.seen X => list-uniq XS YS. pred list-eq-set i:list A, i:list A. list-eq-set L1 L2 :- list-diff L1 L2 [], list-diff L2 L1 []. pred partition i:list A, i:(A -> prop), o:list A, o:list A. partition [] _ [] []. partition [X|XS] P [X|YS] ZS :- P X, !, partition XS P YS ZS. partition [X|XS] P YS [X|ZS] :- partition XS P YS ZS. pred under.do! i:((A -> prop) -> A -> prop), i:list prop. under.do! Then LP :- Then (_\ std.do! LP) _. pred map-triple i:(A -> A1 -> prop), i:(B -> B1 -> prop), i:(C -> C1 -> prop), i:triple A B C, o:triple A1 B1 C1. map-triple F G H (triple X Y Z) (triple X1 Y1 Z1) :- F X X1, G Y Y1, H Z Z1. pred sort.split i:list A, o:list A, o:list A. sort.split [] [] [] :- !. sort.split [X] [X] [] :- !. sort.split [X,Y|TL] [X|L1] [Y|L2] :- sort.split TL L1 L2. pred sort.merge i:(A -> A -> prop), i:list A, i:list A, o:list A. sort.merge _ [] L L :- !. sort.merge _ L [] L :- !. sort.merge Rel [X1|L1] [X2|L2] [X1|M] :- Rel X1 X2, !, sort.merge Rel L1 [X2|L2] M. sort.merge Rel [X1|L1] [X2|L2] [X2|M] :- sort.merge Rel [X1|L1] L2 M. pred sort i:list A, i:(A -> A -> prop), o:list A. sort [] _ [] :- !. sort [X] _ [X] :- !. sort L Rel M :- sort.split L L1 L2, sort L1 Rel S1, sort L2 Rel S2, sort.merge Rel S1 S2 M. pred bubblesort i:list A, i:(A -> A -> prop), o:list A. bubblesort [] _ [] :- !. bubblesort [X] _ [X] :- !. bubblesort [X,Y|TL] Rel [X|Rest1] :- Rel X Y, !, bubblesort [Y|TL] Rel Rest1. bubblesort [X,Y|TL] Rel [Y|Rest1] :- bubblesort [X|TL] Rel Rest1. % TODO: pred toposort i:(A -> A -> prop), i:list A, o:list A. % pred edge? i:int, i:int. % toposort edge? [1,2,3,4] TopoList pred topovisit i: list (pair A A), i: A, i: list A, i: list A, o: list A, o: list A. topovisit _ X VS PS VS PS :- std.mem PS X, !. topovisit _ X VS _ _ _ :- std.mem VS X, !, halt "cycle detected.". topovisit ES X VS PS VS' [X|PS'] :- toporec ES {std.map {std.filter ES (e\ fst e X)} snd} [X|VS] PS VS' PS'. pred toporec i: list (pair A A), i: list A, i: list A, i: list A, o: list A, o: list A. toporec _ [] VS PS VS PS. toporec ES [X|XS] VS PS VS'' PS'' :- topovisit ES X VS PS VS' PS', toporec ES XS VS' PS' VS'' PS''. pred toposort i: list (pair A A), i: list A, o: list A. toposort ES XS XS'' :- toporec ES XS [] [] _ XS', std.filter XS' (std.mem XS) XS''. namespace gref { pred topovisit i: coq.gref.map coq.gref.set, i: classname, i: coq.gref.set, i: list classname, i: coq.gref.set, o: coq.gref.set, o: list classname, o: coq.gref.set. topovisit _ X VS PS PSS VS PS PSS :- coq.gref.set.mem X PSS, !. topovisit _ X VS _ _ _ _ _ :- coq.gref.set.mem X VS, !, halt "cycle detected.". topovisit ES X VS PS PSS VS' [X|PS'] PSS'' :- (coq.gref.map.find X ES M ; coq.gref.set.empty M), toporec ES {coq.gref.set.elements M} {coq.gref.set.add X VS} PS PSS VS' PS' PSS', coq.gref.set.add X PSS' PSS''. pred toporec i: coq.gref.map coq.gref.set, i: list classname, i: coq.gref.set, i: list classname, i: coq.gref.set, o: coq.gref.set, o: list classname, o: coq.gref.set. toporec _ [] VS PS PSS VS PS PSS. toporec ES [X|XS] VS PS PSS VS'' PS'' PSS'' :- topovisit ES X VS PS PSS VS' PS' PSS', toporec ES XS VS' PS' PSS' VS'' PS'' PSS''. pred add-to-neighbours i:coq.gref.set, i:pair gref gref, i:coq.gref.map coq.gref.set, o:coq.gref.map coq.gref.set. add-to-neighbours VS (pr _ V) A A :- not(coq.gref.set.mem V VS), !. add-to-neighbours _ (pr K V) A A1 :- coq.gref.map.find K A L, !, coq.gref.map.add K {coq.gref.set.add V L} A A1. add-to-neighbours _ (pr K V) A A1 :- coq.gref.map.add K {coq.gref.set.add V {coq.gref.set.empty} } A A1. pred toposort i:list (pair gref gref), i:list gref, o:list gref. toposort ES XS XS'' :- !, std.do! [ std.fold XS {coq.gref.set.empty} coq.gref.set.add VS, std.fold ES {coq.gref.map.empty} (add-to-neighbours VS) EM, toporec EM XS {coq.gref.set.empty} [] {coq.gref.set.empty} _ XS'' _ ]. } pred time-do! i:list prop. time-do! []. time-do! [P|PS] :- std.time P Time, !, if (constant P C _) true (C = P), coq.say Time ">>" C, time-do! PS. } namespace compat { % TODO: replace with std.map-filter when coq-elpi > 1.9.2 pred map-filter i:list A, i:(A -> B -> prop), o:list B. map-filter [] _ []. map-filter [X|XS] F [Y|YS] :- F X Y, !, map-filter XS F YS. map-filter [_|XS] F YS :- map-filter XS F YS. } pred print-ctx. print-ctx :- declare_constraint print-ctx []. constraint print-ctx mixin-src { rule \ (G ?- print-ctx) | (coq.say "The context is:" G). } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pred coq.term-is-gref? i:term, o:gref. coq.term-is-gref? (global GR) GR :- !. coq.term-is-gref? (pglobal GR _) GR :- !. coq.term-is-gref? (app [Hd|_]) GR :- !, coq.term-is-gref? Hd GR. coq.term-is-gref? (let _ _ T x\x) GR :- !, coq.term-is-gref? T GR. pred coq.prod-tgt->gref i:term, o:gref. coq.prod-tgt->gref T GR :- whd1 T T1, !, coq.prod-tgt->gref T1 GR. coq.prod-tgt->gref (prod N Src Tgt) GR :- !, @pi-decl N Src x\ coq.prod-tgt->gref (Tgt x) GR. coq.prod-tgt->gref End GR :- coq.term->gref End GR. % TODO: move to coq-elpi proper / move to coq.pp in coq-elpi >= 1.9 pred coq.indt-decl->string i:indt-decl, o:string. coq.indt-decl->string (parameter ID _ Ty D) S :- coq.id->name ID Name, (@pi-decl Name Ty x\ coq.indt-decl->string (D x) S1), S is "Parameter" ^ ID ^ " : " ^ {coq.term->string Ty} ^ "\n" ^ S1. coq.indt-decl->string (inductive _ _ _ _) "NYI". coq.indt-decl->string (record ID Ty KID RD) S :- coq.record-decl->string RD S1, S is ID ^ " : " ^ {coq.term->string Ty} ^ " := " ^ KID ^ " {\n" ^ S1 ^ "}". pred coq.record-decl->string i:record-decl, o:string. coq.record-decl->string end-record "". coq.record-decl->string (field _ ID Ty D) S :- coq.id->name ID Name, (@pi-decl Name Ty x\ coq.record-decl->string (D x) S1), S is " " ^ ID ^ " : " ^ {coq.term->string Ty} ^ ";\n" ^ S1. pred coq.ground-indt-decl? i:indt-decl. coq.ground-indt-decl? (parameter ID _ Ty D) :- ground_term Ty, coq.id->name ID Name, (@pi-decl Name Ty x\ coq.ground-indt-decl? (D x)). coq.ground-indt-decl? (inductive _ _ _ _). coq.ground-indt-decl? (record _ Ty _ RD) :- ground_term Ty, coq.ground-record-decl? RD. pred coq.ground-record-decl? i:record-decl. coq.ground-record-decl? end-record. coq.ground-record-decl? (field _ ID Ty D) :- ground_term Ty, coq.id->name ID Name, (@pi-decl Name Ty x\ coq.ground-record-decl? (D x)). % TODO: remove when coq-elpi > 1.9.3 pred copy-indt-decl i:indt-decl, o:indt-decl. copy-indt-decl (parameter ID I Ty D) (parameter ID I Ty1 D1) :- copy Ty Ty1, @pi-parameter ID Ty1 x\ copy-indt-decl (D x) (D1 x). copy-indt-decl (inductive ID CO A D) (inductive ID CO A1 D1) :- copy-arity A A1, coq.id->name ID N, coq.arity->term A1 T, @pi-decl N T i\ std.map (D i) copy-constructor (D1 i). % @pi-inductive ID A1 i\ std.map (D i) copy-constructor (D1 i). % requires Coq-Elpi 1.9.x copy-indt-decl (record ID T IDK F) (record ID T1 IDK F1) :- copy T T1, copy-fields F F1. pred copy-fields i:record-decl, o:record-decl. copy-fields end-record end-record. copy-fields (field Att ID T F) (field Att ID T1 F1) :- copy T T1, @pi-parameter ID T1 x\ copy-fields (F x) (F1 x). pred copy-constructor i:indc-decl, o:indc-decl. copy-constructor (constructor ID A) (constructor ID A1) :- copy-arity A A1. % TODO: move to coq-elpi proper pred coq.gref.list->set i:list gref, o:coq.gref.set. coq.gref.list->set L S :- std.fold L {coq.gref.set.empty} coq.gref.set.add S. % [coq.abstract-indt-decl Section I AbsI] abstracts I over the Section variables % which becomes parameter nodes of the indt-decl type pred coq.abstract-indt-decl i:list constant, i:indt-decl, o:indt-decl. coq.abstract-indt-decl [] X X1 :- copy-indt-decl X X1. coq.abstract-indt-decl [C|CS] X (parameter ID explicit Ty1 X1) :- coq.gref->id (const C) ID, coq.env.typeof (const C) Ty, copy Ty Ty1, @pi-parameter ID Ty x\ (copy (global (const C)) x :- !) => coq.abstract-indt-decl CS X (X1 x). % [coq.abstract-const-decl Section I AbsI] abstracts I over the Section variables % which becomes fun nodes pred coq.abstract-const-decl i:list constant, i:pair term term, o:pair term term. coq.abstract-const-decl [] (pr X Y) (pr X1 Y1) :- copy X X1, copy Y Y1. coq.abstract-const-decl [C|CS] X (pr (fun Name Ty1 X1) (prod Name Ty1 X2)) :- coq.gref->id (const C) ID, coq.id->name ID Name, coq.env.typeof (const C) Ty, copy Ty Ty1, @pi-parameter ID Ty x\ (copy (global (const C)) x :- !) => coq.abstract-const-decl CS X (pr (X1 x) (X2 x)). % [coq.copy-clauses-for-unfold CS CL] generates clauses for the copy predicate % to unfold all constants in CS pred coq.copy-clauses-for-unfold i:list constant, o:list prop. coq.copy-clauses-for-unfold [] []. coq.copy-clauses-for-unfold [C|CS] [ClauseApp,Clause|L] :- coq.env.const C (some B) _, ClauseApp = (pi B1 Args Args1 B2 Args2 R\ copy (app[global (const C)|Args]) R :- !, copy B B1, std.map Args copy Args1, hd-beta B1 Args1 B2 Args2, unwind B2 Args2 R), Clause = (pi B1\ copy (global (const C)) B1 :- !, copy B B1), coq.copy-clauses-for-unfold CS L. % like fold-map, needed for coq-elpi < 1.9 pred coq.fold-map i:term, i:A, o:term, o:A. coq.fold-map X A Y A :- name X, !, X = Y, !. % avoid loading "coq.fold-map x A x A" at binders coq.fold-map (global _ as C) A C A :- !. coq.fold-map (sort _ as C) A C A :- !. coq.fold-map (fun N T F) A (fun N T1 F1) A2 :- !, coq.fold-map T A T1 A1, pi x\ coq.fold-map (F x) A1 (F1 x) A2. coq.fold-map (let N T B F) A (let N T1 B1 F1) A3 :- !, coq.fold-map T A T1 A1, coq.fold-map B A1 B1 A2, pi x\ coq.fold-map (F x) A2 (F1 x) A3. coq.fold-map (prod N T F) A (prod N T1 F1) A2 :- !, coq.fold-map T A T1 A1, (pi x\ coq.fold-map (F x) A1 (F1 x) A2). coq.fold-map (app L) A (app L1) A1 :- !, std.fold-map L A coq.fold-map L1 A1. coq.fold-map (fix N Rno Ty F) A (fix N Rno Ty1 F1) A2 :- !, coq.fold-map Ty A Ty1 A1, pi x\ coq.fold-map (F x) A1 (F1 x) A2. coq.fold-map (match T Rty B) A (match T1 Rty1 B1) A3 :- !, coq.fold-map T A T1 A1, coq.fold-map Rty A1 Rty1 A2, std.fold-map B A2 coq.fold-map B1 A3. coq.fold-map (primitive _ as C) A C A :- !. coq.fold-map (uvar M L as X) A W A1 :- var X, !, std.fold-map L A coq.fold-map L1 A1, coq.mk-app-uvar M L1 W. % when used in CHR rules coq.fold-map (uvar X L) A (uvar X L1) A1 :- std.fold-map L A coq.fold-map L1 A1. pred cs-pattern->term i:cs-pattern, o:term. cs-pattern->term (cs-gref GR) T :- coq.env.global GR T. cs-pattern->term (cs-sort prop) (sort prop). cs-pattern->term (cs-sort sprop) (sort sprop). cs-pattern->term (cs-sort _) T :- coq.elaborate-skeleton {{ Type }} _ T ok. cs-pattern->term cs-prod T :- coq.elaborate-skeleton (prod `x` Ty_ x\ Bo_ x) _ T ok. pred term->cs-pattern i:term, o:cs-pattern. term->cs-pattern (prod _ _ _) cs-prod. term->cs-pattern (sort U) (cs-sort U). term->cs-pattern T (cs-gref GR) :- coq.term->gref T GR. term->cs-pattern T _ :- coq.error T "HB database: is not a valid canonical key". % this one is in utils, maybe cs-pattern->name is not stdpp material pred gref->modname-label i:gref, i:int, i:string, o:string. pred cs-pattern->name i:cs-pattern, o:string. cs-pattern->name cs-prod "prod". cs-pattern->name (cs-sort _) "sort". cs-pattern->name cs-default "default". cs-pattern->name (cs-gref GR) Name :- gref->modname-label GR 1 "_" Name. % --------------------------------------------------------------------- % kit for closing a term by abstracting evars with lambdas % we use constraints to attach to holes a number % and replace them by a special node, to later be bound % via a lambda namespace abstract-holes { % we add a new constructor to terms to represent terms to be abstracted type abs int -> term. % bind back abstracted subterms pred bind i:int, i:int, i:term, o:term. bind I M T T1 :- M > I, !, T1 = {{ fun x => lp:(B x) }}, N is I + 1, pi x\ % we allocate the fresh symbol for (abs M) (copy (abs N) x :- !) => % we schedule the replacement (abs M) -> x bind N M T (B x). bind M M T T1 :- copy T T1. % we perform all the replacements % for a term with M holes, returns a term with M variables to fill these holes % the clause see is only generated for a term if it hasn't been seen before % the term might need to be typechecked first or main generates extra holes for the % type of the parameters pred main i:term, o:term. main T1 T3 :- std.do! [ % we put (abs N) in place of each occurrence of the same hole (pi T Ty N N' M \ fold-map T N (abs M) M :- var T, not (seen? T _), !, coq.typecheck T Ty ok, fold-map Ty N _ N', M is N' + 1, seen! T M) => (pi T N M \ fold-map T N (abs M) N :- var T, seen? T M, !) => fold-map T1 0 T2 M, % we abstract M holes (M abs nodes) bind 0 M T2 T3, % cleanup constraint store purge-seen!, ]. % all constraints are also on _ so that they share % a variable with the constraint to purge the store % we query if the hole was seen before, and if so % we fetch its number pred seen? i:term, o:int. seen? X Y :- declare_constraint (seen? X Y) [X,_]. % we declare it is now seen and label it with a number pred seen! i:term, i:int. seen! X Y :- declare_constraint (seen! X Y) [X,_]. % to empty the store pred purge-seen!. purge-seen! :- declare_constraint purge-seen! [_]. constraint seen? seen! purge-seen! { % a succesful query, give the label back via M rule (seen! X N) \ (seen? X M) <=> (M = N). % an unsuccesful query rule \ (seen? X _) <=> false. rule purge-seen! \ (seen! _ _). rule \ purge-seen!. } }hierarchy-builder-1.8.1/HB/common/synthesis.elpi000066400000000000000000000331271474513043100216200ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ % This file implements a simple form of "type inference" for arguments which % are mixins and can be inferred looking at the \lambda Prolog context, in % particular [mixins-src] context entries (the one of Coq looks at CS databases % and such, which cannot be easily manipulated on the fly). % % If provides function to infer this kind of arguments and to declare a context % made of mixins to be used for such inference. The idea is that one has % a bunch of mixins at hand and does want to pass them down to other terms, % without explictly saying exactly where they should be used. namespace synthesis { % [infer-all-these-mixin-args Ps T ML F X] fills in all the arguments of F % which are misxins in ML, abstracts the others pred infer-all-these-mixin-args i:list term, i:term, i:list mixinname, i:term, o:term. infer-all-these-mixin-args Ps T ML F SFX :- std.do! [ std.assert-ok! (coq.typecheck F Ty) "try-infer-these-mixin-args: F illtyped", coq.mk-eta (-1) Ty F EtaF, coq.subst-fun {std.append Ps [T]} EtaF FT, private.instantiate-all-these-mixin-args FT T ML SFX, ]. % [infer-all-gref-deps Ps T GR X] fills in all the arguments of GR % which are misxins in gref-deps GR, other arguments are abstracted pred infer-all-gref-deps i:list term, i:term, i:gref, o:term. infer-all-gref-deps Ps T GR X :- std.do! [ std.assert! (gref-deps GR MLwP) "BUG: gref-deps should never fail", list-w-params_list MLwP ML, coq.env.typeof GR Ty, coq.mk-eta (-1) Ty (global GR) EtaF, coq.subst-fun {std.append Ps [T]} EtaF FT, private.instantiate-all-these-mixin-args FT T ML Xraw, infer-holes-depending-on-params T Xraw X, ]. % [infer-holes-depending-on-params TheType T NewT] pred infer-holes-depending-on-params i:term, i:term, o:term. infer-holes-depending-on-params T (app [global GR|Args]) (app [global GR|Args1]) :- !, std.map Args (infer-holes-depending-on-pack T) Args1. infer-holes-depending-on-params _ X X. pred class-of-phant i:term, o:gref, o:gref, o:gref. class-of-phant (prod N T F) X Y Z :- @pi-decl N T x\ class-of-phant (F x) X Y Z. class-of-phant (global GR) Y Z X :- class-def (class X GR _), get-constructor X Y, get-constructor GR Z. class-of-phant (app[global GR|_]) Y Z X :- class-def (class X GR _), get-constructor X Y, get-constructor GR Z. pred infer-holes-depending-on-pack i:term, i:term, o:term. infer-holes-depending-on-pack T (app [global GR | Args]) S :- ((coq.gref->id GR GRS, rex.match "phant.*" GRS /*TODO: phant-clone? GR N*/); pack? GR _), coq.env.typeof GR Ty, class-of-phant Ty KC SC C, factory-nparams C N, std.take N Args Params, !, std.do! [ infer-all-args-let Params T KC ClassInstance ok, std.rev [ClassInstance,T|{std.rev Params}] NewArgs, S = app[global SC| NewArgs ] ]. infer-holes-depending-on-pack _ X X. % [infer-all-args-let Ps T GR X Diagnostic] fills in all the Args in % app[global GR, Ps, T | Args] % and generates a term % let `a1` ty1 t1 a1\ .... app[global GR, p1, .. pn, T, a1, .. , an] % if Diagnostic is ok, else X is unassigned pred infer-all-args-let i:list term, i:term, i:gref, o:term, o:diagnostic. infer-all-args-let Ps T GR X Diag :- std.do! [ coq.env.typeof GR Ty, coq.mk-eta (-1) Ty (global GR) EtaF, coq.subst-fun {std.append Ps [T]} EtaF FT, private.instantiate-all-args-let FT T X Diag, ]. % [assert!-infer-mixin TheType M Out] infers one mixin M on TheType and % aborts with an error message if the mixin cannot be inferred pred assert!-infer-mixin i:term, i:mixinname, o:term. assert!-infer-mixin T M B :- if (private.mixin-for T M B) true (coq.error "HB: cannot inhabit mixin" {nice-gref->string M} "on"{coq.term->string T}). % Given TheType it looks all canonical structure instances on it and makes % all their mixins available for inference pred under-local-canonical-mixins-of.do! i:term, i:list prop. under-local-canonical-mixins-of.do! T P :- std.do! [ get-canonical-structures T CS, std.map CS (private.structure-instance->mixin-srcs T) MSLL, std.flatten MSLL MSL, MSL => std.do! P ]. % Given TheType and a factory instance (on it), makes all the mixins provided by % the factory available for inference. pred under-mixin-src-from-factory.do! i:term, i:term, i:list prop. under-mixin-src-from-factory.do! TheType TheFactory LP :- std.do! [ private.factory-instance->new-mixins [] TheFactory ML, std.map ML (m\c\ c = mixin-src TheType m TheFactory) MLClauses, MLClauses => std.do! LP ]. % Given TheType and a factory instance (on it), builds all the *new* mixins % provided by the factory available for and passes them to the given % continuation pred under-new-mixin-src-from-factory.do! i:term, i:term, i:(list mixinname -> prop). under-new-mixin-src-from-factory.do! TheType TheFactory LP :- findall-mixin-src TheType OldMixins, private.factory-instance->new-mixins OldMixins TheFactory NewML, std.map NewML (m\c\ c = mixin-src TheType m TheFactory) NewMLClauses, NewMLClauses => std.do! [ LP NewML ]. % [under-mixins.then MLwP Pred F] states that F has shape % fun p_1 .. p_k T, % (m_0 : M_0 ..p.. T) .. (m_n : M_n ..p.. T m_i0 .. m_ik) => % Body m_0 .. m_n % where MLwP contains M_0, .., M_n (under p_1 .. p_k) % and Body is such that [..,mixin-src T M_i m_i,..] => Pred Body % and ..p.. is a list of terms built using p_1 .. p_k and T pred under-mixins.then i:list (w-args mixinname), i:(name -> term -> (term -> A) -> A -> prop), i:(A -> prop), o:A. under-mixins.then [] _ Pred Body :- !, Pred Body. under-mixins.then [triple M Args T|ML] MkFun Pred Out :- std.do! [ infer-all-gref-deps Args T M MTy, (@pi-decl `m` MTy m\ mixin-src T M m => under-mixins.then ML MkFun Pred (Body m)), MkFun `m` MTy Body Out, ]. % [mixins-w-params.fun MLwP Pred F] states that F has shape % fun p_1 .. p_k T, % (m_0 : M_0 ..p.. T) .. (m_n : M_n ..p.. T m_i0 .. m_ik) => % Body m_0 .. m_n % where MLwP contains M_0, .., M_n (under p_1 .. p_k) % and Body is such that [..,mixin-src T M_i m_i,..] => Pred Body % and ..p.. is a list of terms built using p_1 .. p_k and T pred mixins-w-params.fun i:mixins, i:(list term -> term -> term -> prop), o:term. mixins-w-params.fun L P Out :- !, w-params.then L mk-fun mk-fun (p\ t\ ml\ under-mixins.then ml mk-fun (P p t)) Out. % [mixins-w-params.length LwP N] states N is Nmixins+Nparams pred mixins-w-params.length i:mixins, o:int. mixins-w-params.length MLwP N :- w-params.nparams MLwP Nparams, std.length {list-w-params_list MLwP} Nmixins, N is Nparams + Nmixins. pred infer-coercion-tgt i:mixins, o:class. infer-coercion-tgt (w-params.cons ID Ty F) CoeClass :- @pi-parameter ID Ty x\ infer-coercion-tgt (F x) CoeClass. infer-coercion-tgt (w-params.nil _ {{ Type }} _) sortclass. infer-coercion-tgt (w-params.nil _ {{ forall x, _ }} _) funclass. % do not use {{ _ -> _ }} since Funclass can be a dependent function! infer-coercion-tgt (w-params.nil _ T _) (grefclass GR) :- coq.term->gref T GR. pred w-args.check-key i:list term, i:term, i:list (w-args A), o:prop. w-args.check-key _PS _T [] true :- !. w-args.check-key PS T [triple _ _ T|LwA] P :- !, w-args.check-key PS T LwA P. w-args.check-key _PS _T _LwA false :- !, coq.error "HB: all mixins must have the same key". pred list-w-params.check-key i:list-w-params A. list-w-params.check-key MLwP :- !, w-params.then MLwP ignore ignore w-args.check-key _. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { % [mixin-for T M MI] synthesizes an instance of mixin M on type T using % the databases [mixin-src] and [from] pred mixin-for i:term, i:mixinname, o:term. mixin-for T M MICompressed :- mixin-src T M Tm, !, std.do! [ %if-verbose (coq.say {header} "Trying to infer mixin for" M), std.assert-ok! (coq.typecheck Tm Ty) "mixin-for: Tm illtyped", %%%%% mterm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% factory? Ty (triple Factory Params _), if (M = Factory) (MI = Tm) ( private.builder->term Params T Factory M B, coq.subst-fun [Tm] B MI ), %if-verbose (coq.say {header} "Trying to compress mixin for" {coq.term->string MI}), compress-coercion-paths MI MICompressed, ]. pred drop i:int, i:list A, o:list A. drop 0 L L :- !. drop N [_|XS] L :- !, N1 is N - 1, drop N1 XS L. pred compress-copy o:term, o:term. compress-copy (app [global (const C) | L]) R :- sub-class C2 C3 C NparamsC, drop NparamsC L [app [global (const C') | L']], sub-class C1 C2 C' NparamsC', drop NparamsC' L' L'', sub-class C1 C3 C'' NparamsC'', std.append {coq.mk-n-holes NparamsC''} L'' HL'', CHL'' = app [global (const C'') | HL''], coq.typecheck CHL'' _ ok, !, compress-copy CHL'' R. compress-copy (app L) (app L1) :- !, std.map L compress-copy L1. compress-copy X X. pred compress-coercion-paths i:term, o:term. compress-coercion-paths MI MICompressed :- if (get-option "compress_coercions" tt) (compress-copy MI MICompressed) (MI = MICompressed). pred mixin-for_mixin-builder i:prop, o:term. mixin-for_mixin-builder (mixin-for _ _ B) B. % [builder->term Params TheType Src Tgt MF] finds a builder from Src to Tgt % and fills in all the mixins required by the builder using mixin-src, obtaining % a function (MF = Builder Params TheType InferredStuff : Src -> Tgt) pred builder->term i:list term, i:term, i:factoryname, i:mixinname, o:term. builder->term Ps T Src Tgt B :- !, std.do! [ from Src Tgt FGR, F = global FGR, gref-deps Src MLwP, list-w-params_list MLwP ML, infer-all-these-mixin-args Ps T ML F B, ]. % [instantiate-all-these-mixin-args T F M_i TFX] where mixin-for T M_i X_i states that % if F ~ fun xs (m_0 : M_0 T) .. (m_n : M_n T ..) ys % => F xs m_0 .. m_{i-1} m_i m_{i+1} .. m_n ys % then TFX := fun xs m_0 .. m_{i-1} m_{i+1} .. m_n ys % => F xs m_0 .. m_{i-1} X_i m_{i+1} .. m_n ys % thus instanciating an abstraction on mixin M_i with X_i pred instantiate-all-these-mixin-args i:term, i:term, i:list mixinname, o:term. instantiate-all-these-mixin-args (fun _ Tm F) T ML R :- coq.safe-dest-app Tm (global TmGR) _, factory-alias->gref TmGR M ok, std.mem! ML M, !, if (mixin-for T M X) true (coq.error "HB: Unable to find mixin" {nice-gref->string M} "on subject" {coq.term->string T}), !, instantiate-all-these-mixin-args (F X) T ML R. instantiate-all-these-mixin-args (fun N Ty F) T ML (fun N Ty FX) :- !, @pi-decl N Ty m\ instantiate-all-these-mixin-args (F m) T ML (FX m). instantiate-all-these-mixin-args F _ _ F. pred instantiate-all-args-let i:term, i:term, o:term, o:diagnostic. instantiate-all-args-let (fun N Tm F) T (let N Tm X R) Diag :- !, std.do! [ coq.safe-dest-app Tm (global TmGR) _, factory-alias->gref TmGR M ok, if (mixin-for T M X) (@pi-def N Tm X m\ instantiate-all-args-let (F m) T (R m) Diag) (Diag = error Msg, Msg is "cannot synthesize mixin " ^ {nice-gref->string M} ^ " for " ^ {coq.term->string T}), ]. instantiate-all-args-let F _ F ok. % [structure-instance->mixin-srcs TheType Structure] finds a CS instance for % Structure on TheType (if any) and builds mixin-src clauses for all the mixins % which can be candidates from that class instance. It finds instances which are % concrete, that is not by projecting a rich type (a variable) to its class. pred structure-instance->mixin-srcs i:term, i:structure, o:list prop. structure-instance->mixin-srcs T S MSLC :- std.do! [ structure-key SortProj _ S, class-def (class (indt Class) S CMLwP), structure-nparams S NParams, coq.mk-n-holes NParams Holes, std.append Holes [ST] HolesST, coq.mk-app (global (const SortProj)) HolesST SortHolesST, % find an instance in ST coq.unify-eq T SortHolesST ok, % we look for an instance which is concrete, we take the parts get-constructor S KS, coq.mk-app (global KS) {std.append Holes [T, CT]} KSHolesC, coq.unify-eq ST KSHolesC ok, % if the class instance is concrete, we take the parts get-constructor (indt Class) KC, std.length {list-w-params_list CMLwP} CMixinsN, coq.mk-n-holes CMixinsN MIL, coq.mk-app (global KC) {std.append Holes [T | MIL]} CBody, coq.unify-eq CT CBody ok, % we finally generare micin-src clauses for all mixins std.map MIL (structure-instance->mixin-srcs.aux T) MSLL, std.flatten MSLL MSLC, ]. % this catch all sucks a bit, but is very relevant. Some instance, like % unification hints (canonical coercions) which require a type which is too rich % fail the second unif problem structure-instance->mixin-srcs _ _ []. structure-instance->mixin-srcs.aux2 Params T Class (some P) M :- coq.mk-app (global (const P)) {std.append Params [T,Class]} M. structure-instance->mixin-srcs.aux T F CL :- factory-instance->new-mixins [] F ML, std.map ML (m\c\ c = mixin-src T m F) CL. % [factory-instance->new-mixins OldMixins FI MSL] find all the mixins % which can be generated by the factory instance FI which are not part of % OldMixins (that is, the contribution of FI to the current context) pred factory-instance->new-mixins i:list mixinname, i:term, o:list mixinname. factory-instance->new-mixins OldMixins X NewML :- std.do! [ std.assert-ok! (coq.typecheck X XTy) "mixin-src: X illtyped", if (not (coq.safe-dest-app XTy (global _) _)) (coq.error "Term:\n" {coq.term->string X} "\nhas type:\n" {coq.term->string XTy} "\nwhich is not a record") true, coq.term->gref XTy Src, factory-provides Src MLwP, list-w-params_list MLwP ML, std.filter ML (m\ not(std.mem! OldMixins m)) NewML, ]. }} hierarchy-builder-1.8.1/HB/common/utils-synterp.elpi000066400000000000000000000045501474513043100224270ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ % runs P in a context where Coq #[attributes] are parsed pred with-attributes i:prop. with-attributes P :- attributes A, coq.parse-attributes A [ att "verbose" bool, att "mathcomp" bool, att "mathcomp.axiom" string, att "short.type" string, att "short.pack" string, att "key" string, att "arg_sort" bool, att "log" bool, att "log.raw" bool, att "compress_coercions" bool, att "export" bool, att "skip" string, att "local" bool, att "fail" bool, att "doc" string, att "primitive" bool, att "non_forgetful_inheritance" bool, att "hnf" bool, ] Opts, !, Opts => (save-docstring, P). pred if-verbose i:prop. if-verbose P :- get-option "verbose" tt, !, P. if-verbose _. % header of if-verbose messages pred header o:string. header Msg :- Msg is "[" ^ {std.any->string {gettimeofday}} ^ "] HB: ". % approximation, it should be logical path, not the file name pred coq.env.current-library o:string. coq.env.current-library L :- loc.fields {get-option "elpi.loc"} L _ _ _ _. coq.env.current-library "dummy.v". % this is only declared in hb.db, this declaration is only to avoid a warning pred docstring o:loc, o:string. pred save-docstring. save-docstring :- if (get-option "elpi.loc" Loc, get-option "elpi.phase" "interp", get-option "doc" Txt) (coq.elpi.accumulate _ "hb.db" (clause _ _ (docstring Loc Txt))) true. pred compute-filter i:option string, o:list string. compute-filter none []. compute-filter (some S) MFilter :- % S is a component of the current modpath coq.env.current-path P, rex_split "\\." S L, compute-filter.aux P L MFilter, !. compute-filter (some S) MFilter :- coq.locate-module S M, coq.modpath->path M MFilter. compute-filter.aux [S|_] [S] [S] :- !. compute-filter.aux [S|XS] [S|SS] [S|YS] :- compute-filter.aux XS SS YS. compute-filter.aux [X|XS] L [X|YS] :- compute-filter.aux XS L YS. pred list-uniq i:list A, o:list A. pred list-uniq.seen i:A. list-uniq [] []. list-uniq [X|XS] YS :- list-uniq.seen X, !, list-uniq XS YS. list-uniq [X|XS] [X|YS] :- list-uniq.seen X => list-uniq XS YS. pred record-decl->id i:indt-decl, o:id. record-decl->id (parameter _ _ _ D) N :- pi p\ record-decl->id (D p) N. record-decl->id (record N _ _ _) N. hierarchy-builder-1.8.1/HB/common/utils.elpi000066400000000000000000000336251474513043100207320ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ % This file contains some HB specific utilities accumulate HB/common/utils-synterp. shorten coq.{ term->gref, subst-fun, safe-dest-app, mk-app, mk-eta, subst-prod }. pred if-arg-sort i:prop. if-arg-sort P :- get-option "arg_sort" tt, !, P. if-arg-sort _. pred if-MC-compat i:(option gref -> prop). if-MC-compat P :- get-option "mathcomp" tt, !, P none. if-MC-compat P :- get-option "mathcomp.axiom" S, !, std.assert! (coq.locate S GR) "The name passed to the mathcomp.axiom attribute does not exist", P (some GR). if-MC-compat _. pred with-locality i:prop. with-locality P :- if (get-option "local" tt) (A = @local!) (A = @global!), A => P. pred acc-clause i:scope, i:prop. acc-clause Scope C :- coq.elpi.accumulate Scope "hb.db" (clause _ _ C). /* Uncomment and remove HB/common/compat_acc_clauses_*.elpi once requiring coq-elpi >= 1.18.0, which implies Coq >= 8.17 pred acc-clauses i:scope, i:list prop. acc-clauses Scope CL :- coq.elpi.accumulate-clauses Scope "hb.db" {std.map CL (c\r\ r = clause _ _ c)}. */ % TODO: Should this only be used for gref that are factories? (and check in the first/second branch so?) % Should we make this an HO predicate, eg "located->gref S L is-factory? GR" % TODO: rename since this is HB specific and is expected to return a factory pred located->gref i:string, i:list located, o:gref. located->gref _ [loc-gref GR|_] GR. located->gref _ [loc-abbreviation Abbrev|_] GR :- phant-abbrev GR _ Abbrev, !. located->gref S [loc-abbreviation _|_] _ :- coq.error S "is an abbreviation out of the control of HB". located->gref S [loc-modpath _|_] _ :- coq.error S "should be a factory, but is a module". located->gref S [loc-modtypath _|_] _ :- coq.error S "should be a factory, but is a module type". located->gref S [] _ :- coq.error "Could not locate name" S. % TODO: generalize/rename when we support parameters pred argument->gref i:argument, o:gref. argument->gref (str S) GR :- located->gref S {coq.locate-all S} GR. argument->gref X _ :- coq.error "Argument" X "is expected to be a string". pred argument->term i:argument, o:term. argument->term (str S) (global GR) :- !, argument->gref (str S) GR. argument->term (trm T) T1 :- !, std.assert-ok! (coq.elaborate-skeleton T _ T1) "not well typed term". argument->term X _ :- coq.error "Argument" X " is expected to be a term or a string". pred argument->ty i:argument, o:term. argument->ty (str S) T1 :- !, argument->gref (str S) GR, std.assert-ok! (coq.elaborate-ty-skeleton (global GR) _ T1) "global reference is not a type". argument->ty (trm T) T1 :- !, std.assert-ok! (coq.elaborate-ty-skeleton T _ T1) "not well typed type". argument->ty X _ :- coq.error "Argument" X " is expected to be a type or a string". pred builder->string i:builder, o:string. builder->string (builder _ _ _ B) S :- coq.term->string (global B) S. pred nice-gref->string i:gref, o:string. nice-gref->string X Mod :- coq.gref->path X Path, std.rev Path [Mod1,Mod2|_], !, Mod is Mod2 ^ "_" ^ Mod1. nice-gref->string X S :- coq.term->string (global X) S. pred gref->modname i:gref, i:int, i:string, o:string. gref->modname GR NComp Sep ModName :- coq.gref->path GR Path, std.rev Path Mods, std.length Path Len, if (Len >= NComp) true (coq.error "Not enough enclosing modules for" {coq.gref->string GR}), std.take NComp Mods L, std.string.concat Sep {std.rev L} ModName. pred gref->modname-label i:gref, i:int, i:string, o:string. gref->modname-label GR NComp Sep ModName :- coq.gref->path GR Path, std.rev Path PathRev, std.length PathRev Len, if (Len >= NComp) (N = NComp) (N = Len), std.take N PathRev L, std.string.concat Sep {std.rev [{coq.gref->id GR}|L]} ModName. pred string->modpath i:string, o:modpath. string->modpath S MP :- std.filter {coq.locate-all S} (l\l = loc-modpath _) L, L = [loc-modpath MP]. pred gref->modname_short1 i:modpath, i:string, i:list string, o:string. gref->modname_short1 _ S [] S. gref->modname_short1 MP "" [X|L] L' :- gref->modname_short1 MP X L L'. gref->modname_short1 MP S _ S :- string->modpath S MP. gref->modname_short1 MP S [X|L] S' :- gref->modname_short1 MP {std.string.concat "." [X,S]} L S'. % Print shortest qualified identifier of the module containing a gref % Sep is used as separator pred gref->modname_short i:gref, i:string, o:string. gref->modname_short GR Sep IDS :- coq.gref->path GR Path, string->modpath {std.string.concat "." Path} MP, gref->modname_short1 MP "" {std.rev Path} ID, rex.replace "[.]" Sep ID IDS. pred avoid-name-collision i:string, o:string. avoid-name-collision S S1 :- coq.locate-all S L, if (std.mem L (loc-gref GR), coq.gref->path GR P, coq.env.current-path P) (S1 is S ^ "__" ^ {std.any->string {new_int}}) (S1 is S). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function to predicate generic constructions % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pred mk-nil o:list A. mk-nil []. pred mk0 i:A, o:A. mk0 F R :- constant R F []. pred mk1 i:(A -> B), i:A, o:B. mk1 F X1 R :- constant R F [X1]. pred mk2 i:(A -> A -> C), i:A, i:A, o:C. mk2 F X1 X2 R :- constant R F [X1, X2]. pred mk3 i:(A -> A -> A -> D), i:A, i:A, i:A, o:D. mk3 F X1 X2 X3 R :- constant R F [X1, X2, X3]. pred mk4 i:(A -> A -> A -> A -> E), i:A, i:A, i:A, i:A, o:E. mk4 F X1 X2 X3 X4 R :- constant R F [X1, X2, X3,X4]. pred mk-fun i:name, i:term, i:(term -> term), o:term. mk-fun N Ty Body (fun N Ty Body). % generic argument to pass to w-params pred ignore i:name, i:term, i:(term -> A), o:A. ignore _ _ F X :- (pi x y\ F x = F y), X = F (sort prop). % combining body and type pred mk-fun-prod i:name, i:term, o:(term -> pair term term), o:pair term term. mk-fun-prod N Ty (x\ pr (Body x) (Type x)) (pr (fun N Ty Body) (prod N Ty Type)). pred mk-parameter i:implicit_kind, i:name, i:term, i:(term -> indt-decl), o:indt-decl. pred mk-parameter i:implicit_kind, i:name, i:term, i:(term -> arity), o:arity. mk-parameter IK Name X F Decl :- !, Decl = parameter {coq.name->id Name} IK X F. pred params->holes i:list-w-params A, o:list term. params->holes (w-params.nil _ _ _) []. params->holes (w-params.cons _ _ F) [_|PS] :- pi x\ params->holes (F x) PS. pred fresh-type o:term. fresh-type Ty :- Ty = {{Type}}, std.assert-ok! (coq.typecheck-ty Ty _) "impossible". %%%%%%%%%%%%%%%%%%%%%% % w-params interface % %%%%%%%%%%%%%%%%%%%%%% pred apply-w-params i:w-params A, i:list term, i:term, o:A. apply-w-params (w-params.cons _ _ PL) [P|PS] T R :- !, apply-w-params (PL P) PS T R. apply-w-params (w-params.nil _ _ L) [] T R :- !, R = L T. apply-w-params _ _ _ _ :- coq.error "apply-w-params". pred w-params.nparams i:w-params A, o:int. w-params.nparams (w-params.cons _ _ F) N :- pi x\ w-params.nparams (F x) M, N is M + 1. w-params.nparams (w-params.nil _ _ _) 0. % [w-params.fold AwP Cons Nil Out] states that Out has shape % Cons `x_1` T_1 p_1 \ .. \ Nil [p_1 .. p_n] `T` Ty F % where AwP = w-params.cons `x_1` T_1 p_1 \ ... \ w-params.nil `T` Ty F pred w-params.fold i:w-params A, i:(name -> term -> (term -> B) -> B -> prop), i:(list term -> name -> term -> (term -> A) -> B -> prop), o:B. w-params.fold L Cons Nil Out :- w-params.fold.params L Cons Nil [] Out. pred w-params.fold.params i:w-params A, i:(name -> term -> (term -> B) -> B -> prop), i:(list term -> name -> term -> (term -> A) -> B -> prop), i:list term, % accumulator o:B. w-params.fold.params (w-params.cons ID PTy F) Cons Nil RevPs Out :- !, std.do! [ coq.id->name ID N, (@pi-decl N PTy p\ w-params.fold.params (F p) Cons Nil [p|RevPs] (Body p)), Cons N PTy Body Out]. w-params.fold.params (w-params.nil ID TTy F) _ Nil RevParams Out :- !, std.do! [ coq.id->name ID N, std.rev RevParams Params, Nil Params N TTy F Out, ]. % [w-params.then AwP Cons Nil Out] states that Out has shape % Cons `x_1` T_1 p_1 \ .. \ Nil [p_1 .. p_n] `T` Ty t \ Body % where Pred [p_1 .. p_n] T Body % and AwP = w-params.cons `x_1` T_1 p_1 \ ... \ w-params.nil `T` Ty F pred w-params.then i:w-params A, i:(name -> term -> (term -> C) -> C -> prop), i:(name -> term -> (term -> B) -> C -> prop), i:(list term -> term -> A -> B -> prop), o:C. w-params.then L Cons Nil Pred Out :- w-params.fold L Cons (ps\ n\ ty\ f\ out\ sigma Body\ (@pi-decl n ty t\ Pred ps t (f t) (Body t)), Nil n ty Body out) Out. pred w-params.map i:w-params A, i:(list term -> term -> A -> B -> prop), o:w-params B. w-params.map AL F BL :- w-params.then AL mk-w-params.cons-name mk-w-params.nil-name F BL. % TODO: make combinators pass id type mk-w-params.cons-name name -> term -> (term -> w-params A) -> w-params A -> prop. mk-w-params.cons-name N T F (w-params.cons ID T F):- coq.name->id N ID. type mk-w-params.nil-name name -> term -> (term -> A) -> w-params A -> prop. mk-w-params.nil-name N T F (w-params.nil ID T F):- coq.name->id N ID. % on the fly abstraction pred bind-nil i:id, i:term, i:term, i:A, o:w-params A. bind-nil N T X V (w-params.nil N T A) :- V = A X. pred bind-cons i:id, i:term, i:term, i:w-params A, o:w-params A. bind-cons N T X V (w-params.cons N T A) :- V = A X. % Specific to list-w-params pred list-w-params_list i:list-w-params A, o:list A. list-w-params_list AwP R :- w-params.then AwP ignore ignore (p\ t\ x\ std.map x triple_1) R. pred list-w-params.append i:list-w-params A, i:list-w-params A, o:list-w-params A. list-w-params.append (w-params.nil N T ML1) (w-params.nil N T ML2) (w-params.nil N T ML) :- pi x\ std.append (ML1 x) (ML2 x) (ML x). list-w-params.append (w-params.cons N Ty ML1) (w-params.cons N Ty ML2) (w-params.cons N Ty ML) :- pi x\ list-w-params.append (ML1 x) (ML2 x) (ML x). pred list-w-params.rcons i:list-w-params A, i:(list term -> term -> w-args A -> prop), o:list-w-params A. list-w-params.rcons LwP F R :- list-w-params.rcons.aux LwP F [] R. pred list-w-params.rcons.aux i:list-w-params A, i:(list term -> term -> w-args A -> prop), i:list term, o:list-w-params A. list-w-params.rcons.aux (w-params.nil N T ML1) F Acc (w-params.nil N T ML2) :- pi x\ sigma Last\ F {std.rev Acc} x Last, std.append (ML1 x) [Last] (ML2 x). list-w-params.rcons.aux (w-params.cons N Ty ML1) F Acc (w-params.cons N Ty ML2) :- pi x\ list-w-params.rcons.aux (ML1 x) F [x|Acc] (ML2 x). pred list-w-params.flatten-map i:list-w-params A, i:(A -> list-w-params B -> prop), o:list-w-params B. list-w-params.flatten-map (w-params.cons N T L) F (w-params.cons N T L1) :- @pi-parameter N T p\ list-w-params.flatten-map (L p) F (L1 p). list-w-params.flatten-map (w-params.nil N TTy L) F (w-params.nil N TTy L1) :- @pi-parameter N TTy t\ list-w-params.flatten-map.aux (L t) F (L1 t). pred list-w-params.flatten-map.aux i:list (w-args A), i:(A -> list-w-params B -> prop), o:list (w-args B). list-w-params.flatten-map.aux [] _ []. list-w-params.flatten-map.aux [triple M Ps T|L] F Res1 :- F M MwP, apply-w-params MwP Ps T ML, list-w-params.flatten-map.aux L F Res, std.append ML Res Res1. % [build-list-w-params TheParams TheType Factories ListWParams] % Params is a list of pairs (section variable, its type). % ListWParams has as many w-params.cons as TheParams and the terms % in Factories are abstracted wrt the first component of TheParams. pred build-list-w-params i:list (triple id term term), i:term, i:list (w-args A), o: list-w-params A. build-list-w-params [triple ID P Pty|PS] TheType Factories (w-params.cons ID Pty1 R) :- std.do! [ copy Pty Pty1, (@pi-parameter ID Pty1 p\ (copy P p :- !) => build-list-w-params PS TheType Factories (R p)), ]. build-list-w-params [] TheType Factories (w-params.nil Name TT1 R) :- std.do! [ std.assert-ok! (coq.typecheck TheType TT) "BUG: TheType does not typecheck", copy TT TT1, coq.gref->id {coq.term->gref TheType} Name, (@pi-parameter Name TT1 t\ (copy TheType t :- !) => std.map Factories (std.map-triple (=) (x\ std.map x (copy-pack-holes TheType t)) (copy-pack-holes TheType t)) (R t)), ]. pred copy-pack-holes i:term, i:term, i:term, o:term. copy-pack-holes TheType NewType Term Out :- std.do! [ (pi Args NewArgs CSInstance ParamsRev ParamsRevCopy Pack \ (copy (app[global Pack | Args]) (app[global Pack | NewArgs]) :- pack? Pack _, std.rev Args [CSInstance,TheType|ParamsRev], !, std.map ParamsRev copy ParamsRevCopy, std.rev [{{ lib:elpi.hole }},NewType|ParamsRevCopy] NewArgs)) => copy Term Out, ]. pred pack? i:gref, o:classname. pack? (indc K) C :- coq.env.indc K _ _ _ KTy, prod-last-gref KTy (indt I), % TODO: use new API class-def (class C (indt I) _). pred distribute-w-params i:list-w-params A, o:list (one-w-params A). distribute-w-params (w-params.cons N T F) L :- pi x\ distribute-w-params (F x) (L1 x), std.map (L1 x) (bind-cons N T x) L. distribute-w-params (w-params.nil N T F) L :- pi x\ std.map (F x) (bind-nil N T x) L. % Specific to one-w-params pred w-params_1 i:one-w-params A, o:A. w-params_1 X Y :- w-params.then X ignore ignore (p\ t\ triple_1) Y. pred disable-id-phant i:term, o:term. disable-id-phant T T1 :- (pi fresh fresh1 t v\ copy {{lib:@hb.id lp:t lp:v}} {{lib:@hb.id_disabled lp:t lp:fresh lp:v lp:fresh1}} :- !) => (pi fresh fresh1 t v\ copy {{lib:@hb.ignore lp:t lp:v}} {{lib:@hb.ignore_disabled lp:t lp:fresh lp:v lp:fresh1}} :- !) => copy T T1. pred re-enable-id-phant i:term, o:term. re-enable-id-phant T T1 :- (pi f1 f2 t v\ copy {{lib:@hb.id_disabled lp:t lp:f1 lp:v lp:f2}} {{lib:@hb.id lp:t lp:v}} :- !) => (pi f1 f2 t v\ copy {{lib:@hb.ignore_disabled lp:t lp:f1 lp:v lp:f2}} {{lib:@hb.ignore lp:t lp:v}} :- !) => copy T T1. pred prod-last i:term, o:term. prod-last (prod N S X) Y :- !, @pi-decl N S x\ prod-last (X x) Y. prod-last X X :- !. pred prod-last-gref i:term, o:gref. prod-last-gref (prod N S X) GR :- !, @pi-decl N S x\ prod-last-gref (X x) GR. prod-last-gref X GR :- coq.term->gref X GR. % saturate a type constructor with holes pred saturate-type-constructor i:term, o:term . saturate-type-constructor T ET :- coq.typecheck T TH ok, coq.count-prods TH N, coq.mk-app T {coq.mk-n-holes N} ET. hierarchy-builder-1.8.1/HB/context.elpi000066400000000000000000000072451474513043100177650ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace context { pred declare i:factories, o:mixins, o:list term, o:term, o:list prop, o:list constant. declare FLwP MLwP Params TheKey MSL CL :- !, std.do! [ factories-provide FLwP MLwPRaw, declare.params-key MLwPRaw ParamsSection TheKey _MLwA, std.map ParamsSection triple_2 Params, declare.mixins TheKey ParamsSection MLwPRaw MLwP MSL CL ]. pred declare.params-key i:w-params A, o:list (triple id term term), o:term, o:A. declare.params-key MLwP Params TheKey Out :- !, std.do! [ if-verbose (coq.say {header} "declaring parameters and key as section variables"), declare.params MLwP Params KId KTy F, log.coq.env.add-section-variable-noimplicits KId KTy C, TheKey = global (const C), Out = F TheKey ]. pred declare.params i:w-params A, o:list (triple id term term), o:id, o:term, o:(term -> A). declare.params (w-params.cons PId PTy F) [triple PId P PTy|Params] KId KTy Out :- !, std.do! [ log.coq.env.add-section-variable-noimplicits PId PTy C, P = global (const C), declare.params (F P) Params KId KTy Out ]. declare.params (w-params.nil KId KTy F) [] KId KTy F :- !. % [declare.mixins TheType Parameters Factories Clauses] postulates a % (section) context with all the mixins provided by the factories and all % the structure instances we can derive on TheType from these. Clauses % contain mixin-src for each postulated mixin pred declare.mixins i:term, i:list (triple id term term), i:mixins, o:mixins, o:list prop, o:list constant. declare.mixins TheType TheParamsSection MLwPRaw MLwP MSL CL :- std.do! [ if-verbose (coq.say "Here is the list of mixins to declare (the order matters): " {list-w-params_list MLwPRaw}), std.map TheParamsSection triple_2 TheParams, apply-w-params MLwPRaw TheParams TheType MLwAllArgsRaw, std.fold MLwAllArgsRaw (triple [] [] []) (private.postulate-mixin TheType) (triple CL MSL MLwPRev), acc-clauses current {std.map CL (cs\r\ r = local-canonical cs)}, std.rev MLwPRev MLwPSection, build-list-w-params TheParamsSection TheType MLwPSection MLwP, acc-clauses current MSL, ]. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { % Given a type T, a fresh number N, and a mixin M it postulates % a variable "mN" inhabiting M applied to T and % all its dependencies, previously postulated and associated % to the corresponding mixin using mixin-for pred postulate-mixin i:term, i:w-args mixinname, i:triple (list constant) (list prop) (list (w-args mixinname)), o:triple (list constant) (list prop) (list (w-args mixinname)). postulate-mixin TheType (triple M Ps T) (triple CL MSL MLwP) (triple OutCL [MC|MSL] [NewMwP|MLwP]) :- MSL => std.do! [ Name is "local_mixin_" ^ {gref->modname M 2 "_"}, if-verbose (coq.say "HB: postulate" Name "on" {coq.term->string T}), synthesis.infer-all-gref-deps Ps T M TySkel, % was synthesis.infer-all-mixin-args Ps T M TySkel, % if-verbose (coq.say "HB: postulate-mixin checking" TySkel), % std.assert-ok! (coq.typecheck Ty _) "postulate-mixin: Ty illtyped", std.assert-ok! (coq.elaborate-ty-skeleton TySkel _ Ty) "postulate-mixin: Ty illtyped", log.coq.env.add-section-variable-noimplicits Name Ty C, factory? Ty NewMwP, MC = mixin-src T M (global (const C)), MC => get-option "local" tt => instance.declare-all TheType {findall-classes-for [M]} NewCSL, std.map NewCSL snd NewCL, std.append CL NewCL OutCL ]. }} hierarchy-builder-1.8.1/HB/export.elpi000066400000000000000000000076431474513043100176240ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ pred export.any i:id. export.any S :- coq.locate-all S L, if (L = []) (coq.error "HB: cannot locate" S) true, if (L = [X]) (export.any.aux S X) (coq.error "HB:" S "is ambiguous:" L). export.any.aux S (loc-gref GR) :- export.abbrev S GR. export.any.aux S (loc-modpath MP) :- export.module S MP. export.any.aux S X :- coq.error "HB:" S "denotes" X "which is not supported for exporting". % [export.module Module] exports a Module now adds it to the collection of % modules to export in the end of the current enclosing module, % by the command HB.Exports % CAVEAT: "module" is a keyword, we put it in the namespace by hand pred export.module i:id, i:modpath. export.module NiceModule Module :- !, log.coq.env.export-module NiceModule Module, coq.env.current-library File, acc-clause current (module-to-export File NiceModule Module). pred export.abbrev i:id, i:gref. export.abbrev NiceName GR :- !, coq.env.current-library File, acc-clause current (abbrev-to-export File NiceName GR). pred export.clause i:prop. export.clause Clause :- !, coq.env.current-library File, acc-clauses current [Clause, clause-to-export File Clause]. pred export.reexport-all-modules-and-CS i:option string. export.reexport-all-modules-and-CS Filter :- std.do! [ coq.env.current-library File, export.private.compute-filter Filter MFilter, if-verbose (coq.say {header} "exporting under the module path" MFilter), % NODE: std.list-uniq is for coq < 8.13 std.findall (module-to-export File NiceModule_ Module_) ModsCL, std.filter {std.list-uniq ModsCL} (export.private.module-in-module MFilter) ModsCLFiltered, std.map ModsCLFiltered module-to-export_module-nice NiceMods, std.map ModsCLFiltered module-to-export_module Mods, if-verbose (coq.say {header} "exporting modules" NiceMods), std.forall2 NiceMods Mods log.coq.env.export-module, std.findall (instance-to-export File NiceInstance_ Const_) InstCL, std.filter {std.list-uniq InstCL} (export.private.instance-in-module MFilter) InstCLFiltered, std.map InstCLFiltered instance-to-export_instance Insts, if-verbose (coq.say {header} "exporting CS instances" Insts), std.forall Insts log.coq.CS.declare-instance, std.findall (abbrev-to-export File NiceAbbrev_ GR_) InstAbbL, std.filter {std.list-uniq InstAbbL} (export.private.abbrev-in-module MFilter) InstAbbLFiltered, std.map InstAbbLFiltered abbrev-to-export_name AbbNames, std.map InstAbbLFiltered abbrev-to-export_body AbbBodies, if-verbose (coq.say {header} "exporting Abbreviations" AbbNames), std.forall2 AbbNames AbbBodies (n\b\@global! => log.coq.notation.add-abbreviation n 0 b ff _), std.findall (clause-to-export File Clause_) ClausesL, if-verbose (coq.say {header} "exporting Clauses" Clauses), std.map ClausesL clause-to-export_clause Clauses, acc-clauses current Clauses ]. namespace export.private { pred abbrev-in-module i:list string, i:prop. abbrev-in-module PM (abbrev-to-export _ _ GR) :- coq.gref->path GR PC, std.appendR PM _ PC. % sublist pred module-in-module i:list string, i:prop. module-in-module PM (module-to-export _ _ M) :- coq.modpath->path M PC, std.appendR PM _ PC. % sublist pred instance-in-module i:list string, i:prop. instance-in-module PM (instance-to-export _ _ C) :- coq.gref->path (const C) PC, std.appendR PM _ PC. % sublist pred compute-filter i:option string, o:list string. compute-filter none []. compute-filter (some S) MFilter :- % S is a component of the current modpath coq.env.current-path P, rex_split "\\." S L, compute-filter.aux P L MFilter, !. compute-filter (some S) MFilter :- coq.locate-module S M, coq.modpath->path M MFilter. compute-filter.aux [S|_] [S] [S] :- !. compute-filter.aux [S|XS] [S|SS] [S|YS] :- compute-filter.aux XS SS YS. compute-filter.aux [X|XS] L [X|YS] :- compute-filter.aux XS L YS. } hierarchy-builder-1.8.1/HB/factory.elpi000066400000000000000000000443501474513043100177460ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace factory { pred declare i:argument. declare A :- private.declare-asset A private.asset-factory. pred declare-mixin i:argument. declare-mixin A :- private.declare-asset A private.asset-mixin. kind factory-abbrev type. type by-classname gref -> factory-abbrev. type by-phantabbrev abbreviation -> factory-abbrev. pred declare-abbrev i:id, i:factory-abbrev, o:abbreviation. declare-abbrev Name (by-classname GR) Abbrev :- % looks fishy (the parameters are not taken into account) @global! => log.coq.notation.add-abbreviation Name 1 (fun _ _ t\ app[global GR,t]) tt Abbrev. declare-abbrev Name (by-phantabbrev Abbr) Abbrev :- std.do! [ coq.notation.abbreviation-body Abbr Nargs AbbrTrm, @global! => log.coq.notation.add-abbreviation Name Nargs AbbrTrm tt Abbrev, ]. pred argument->w-mixins i:argument, o:w-mixins argument. argument->w-mixins (indt-decl Decl) (pr MLwP ArgwP) :- !, std.do! [ pdecl->w-mixins Decl (pr MLwP DeclwP), w-params.map DeclwP (_\ _\ x\ y\ y = indt-decl x) ArgwP ]. argument->w-mixins (const-decl Id none Decl) (pr MLwP ArgwP) :- !, std.do! [ pdecl->w-mixins Decl (pr MLwP DeclwP), w-params.map DeclwP (_\ _\ x\ y\ y = const-decl Id none x) ArgwP, ]. argument->w-mixins (const-decl Id (some Body) Decl as CDecl) (pr MLwP ArgwP) :- !, std.do! [ if-verbose (coq.say {header} "arguments->w-mixins on const-decl Decl=" CDecl), pdecl->w-mixins Decl (pr MLwP DeclwP), if-verbose (coq.say {header} "arguments->w-mixins on const-decl Decl=" Decl "\nwith MLwP =" MLwP), std.length {list-w-params_list MLwP} NML, if-verbose (coq.say "ML length =" NML), w-params.map DeclwP (ps\ t\ x\ y\ sigma Dummies Args AppBody\ std.do! [ std.nlist NML (sort prop) Dummies, std.append ps [t|Dummies] Args, coq.subst-fun Args Body AppBody, y = const-decl Id (some AppBody) x]) ArgwP ]. argument->w-mixins (ctx-decl Decl) (pr MLwP ArgwP) :- !, std.do! [ cdecl->w-mixins Decl (pr MLwP DeclwP), w-params.map DeclwP (_\ _\ x\ y\ y = ctx-decl x) ArgwP ]. pred argument-name i:argument, o:string. argument-name (const-decl Id _ _) Id :- !. argument-name (indt-decl (parameter _ _ _ R)) Id :- !, argument-name (indt-decl (R (sort prop))) Id. argument-name (indt-decl (record Id _ _ _)) Id :- !. argument-name (indt-decl (inductive Id _ _ _)) Id :- !. argument-name (ctx-decl _) "_" :- !. pred pdecl->w-mixins i:indt-decl, o:w-mixins indt-decl. pred pdecl->w-mixins i:arity, o:w-mixins arity. pdecl->w-mixins (parameter ID _ TySkel Rest as Decl) Out :- private.is-key Decl, !, private.key-decl-w-mixins "parameter" ID TySkel Rest private.pdecl->w-mixins.mixins Out. pdecl->w-mixins (parameter ID _ TySkel Rest) Out :- !, private.param-decl-w-mixins "parameter" ID TySkel Rest pdecl->w-mixins Out. pdecl->w-mixins _ _ :- !, coq.error "HB: declaration must have at least one parameter". pred cdecl->w-mixins i:context-decl, o:w-mixins context-decl. cdecl->w-mixins (context-item _ _ _ (some _) _) _ :- !, coq.error "HB: local definition is not supported in this context". cdecl->w-mixins (context-item ID _ TySkel none Rest as Decl) Out :- private.is-key Decl, !, private.key-decl-w-mixins "context-item" ID TySkel Rest private.cdecl->w-mixins.mixins Out. cdecl->w-mixins (context-item ID _ TySkel none Rest) Out :- !, private.param-decl-w-mixins "context-item" ID TySkel Rest cdecl->w-mixins Out. cdecl->w-mixins _ _ :- !, coq.error "HB: declaration must have at least one parameter". /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { shorten coq.{ term->gref, subst-fun, safe-dest-app, mk-app, mk-eta, subst-prod }. % Type to share code between HB.mixin and HB.factory e(that supports alias factories) kind asset type. type asset-mixin asset. type asset-factory asset. pred check-key-attribute-consistency i:id. check-key-attribute-consistency _ :- not(get-option "key" _), !. check-key-attribute-consistency ID :- get-option "key" ID, !. check-key-attribute-consistency ID :- get-option "key" ID1, coq.error "HB:" {calc ("The #[key=\"" ^ ID1 ^ "\"] attribute")} "does not match the selected subject" ID. pred is-key i:indt-decl. pred is-key i:arity. pred is-key i:context-decl. is-key (parameter ID _ _ _\ record _ _ _ _) :- !, check-key-attribute-consistency ID. is-key (parameter ID _ _ _\ inductive _ _ _ _) :- !, check-key-attribute-consistency ID. is-key (parameter ID _ _ _\ arity _) :- !, check-key-attribute-consistency ID. is-key (context-item ID _ _ _ _\ context-end) :- !, check-key-attribute-consistency ID. is-key (parameter ID _ _ _) :- get-option "key" ID, !. is-key (context-item ID _ _ _ _) :- get-option "key" ID, !. is-key (parameter ID _ _ p\ parameter _ _ (M p) _) :- pi p\ factory? (M p) _, !, check-key-attribute-consistency ID. is-key (context-item ID _ _ _ p\ context-item _ _ (M p) _ _) :- pi p\ factory? (M p) _, !, check-key-attribute-consistency ID. pred mixin-decl-w-mixins i:string, i:string, i:term, i:(term -> A), i:(A -> pair (list (w-args mixinname)) A -> prop), o:pair (list (w-args mixinname)) A. mixin-decl-w-mixins DeclKind ID TySkel Rest Conv Out :- std.do! [ if-verbose (coq.say {header} "processing mixin" DeclKind ID), std.assert! (not (var TySkel)) "HB: no type provided for mixin", disable-id-phant TySkel TySkelNoId, std.assert-ok! (coq.elaborate-ty-skeleton TySkelNoId _ TyNoId) "HB: mixin illtyped", re-enable-id-phant TyNoId Ty, std.assert! (factory? Ty (triple F Ps T)) "HB: Not a factory applied to the key variable", std.assert! (pi x y\ Rest y = Rest x) "HB: Factories cannot be explicitly mentioned in the subsequent declaration", Dummy = sort prop, Conv (Rest Dummy) (pr MLwA R), Out = pr [triple F Ps T|MLwA] R ]. pred key-decl-w-mixins i:string, i:string, i:term, i:(term -> A), i:(A -> pair (list (w-args mixinname)) A -> prop), o:pair mixins (w-params A). key-decl-w-mixins DeclKind ID TySkel Rest Conv Out :- std.do! [ if-verbose (coq.say {header} "processing key" DeclKind), std.assert-ok! (coq.elaborate-ty-skeleton TySkel _ Ty) "key illtyped", coq.string->name ID N, @pi-decl N Ty t\ Conv (Rest t) (pr (MLwA t) (R t)), if (var Ty) (fresh-type Ty) true, Out = pr (w-params.nil ID Ty MLwA) (w-params.nil ID Ty R) ]. pred param-decl-w-mixins i:string, i:string, i:term, i:(term -> A), i:(A -> pair mixins (w-params A) -> prop), o:pair mixins (w-params A). param-decl-w-mixins DeclKind ID TySkel Rest Conv Out :- std.do! [ if-verbose (coq.say {header} "processing param" DeclKind), std.assert-ok! (coq.elaborate-ty-skeleton TySkel _ Ty) "param illtyped", coq.string->name ID N, @pi-decl N Ty p\ Conv (Rest p) (pr (MLwP p) (R p)), if (var Ty) (fresh-type Ty) true, Out = pr (w-params.cons ID Ty MLwP) (w-params.cons ID Ty R) ]. pred pdecl->w-mixins.mixins i:indt-decl, o:pair (list (w-args mixinname)) indt-decl. pred pdecl->w-mixins.mixins i:arity, o:pair (list (w-args mixinname)) arity. pdecl->w-mixins.mixins (parameter ID _ TySkel Rest) Out :- !, mixin-decl-w-mixins "parameter" ID TySkel Rest pdecl->w-mixins.mixins Out. pdecl->w-mixins.mixins R (pr [] R) :- !. pred cdecl->w-mixins.mixins i:context-decl, o:pair (list (w-args mixinname)) context-decl. cdecl->w-mixins.mixins context-end (pr [] context-end) :- !. cdecl->w-mixins.mixins (context-item _ _ _ (some _) _) _ :- !, coq.error "HB: local definition is not supported in this context". cdecl->w-mixins.mixins (context-item ID _ TySkel none Rest) Out :- !, mixin-decl-w-mixins "parameter" ID TySkel Rest cdecl->w-mixins.mixins Out. % The identity builder pred declare-id-builder i:factoryname, o:prop. declare-id-builder GR (from GR GR (const C)) :- std.do! [ gref-deps GR GRD, synthesis.mixins-w-params.fun GRD (declare-id-builder.aux GR) IDBodySkel, std.assert-ok! (coq.elaborate-skeleton IDBodySkel IDType IDBody) "identity builder illtyped", log.coq.env.add-const-noimplicits "identity_builder" IDBody IDType @transparent! C, ]. declare-id-builder.aux GR Params TheType (fun `x` Ty x\x) :- synthesis.infer-all-gref-deps Params TheType GR Ty. % [mk-factory-abbrev Str GR CL FactAbbrev] % creates an abbreviation for GR names Str and creates a phant-abbrev clause in CL. % FactAbbrev is the short name for the factory (either an alias of the class record) pred mk-factory-abbrev i:string, i:gref, o:list prop, o:factory-abbrev. mk-factory-abbrev Str GR Aliases FactAbbrev :- !, std.do! [ if (factory-alias->gref GR _ ok) (Aliases = [], FactAbbrev = by-classname GR) (phant.of-gref ff GR [] PhTerm, phant.add-abbreviation Str PhTerm PhC Abbrv, Aliases = [phant-abbrev GR (const PhC) Abbrv], FactAbbrev = by-phantabbrev Abbrv), ]. % [declare-asset Asset AssetKind] unifies the code paths for % mixins, factories (and alias factories) pred declare-asset i:argument, i:asset. declare-asset Arg AssetKind :- std.do! [ argument-name Arg Module, if-verbose (coq.say {header} "start module and section" Module), log.coq.env.begin-module Module none, log.coq.env.begin-section Module, if-verbose (coq.say {header} "converting arguments" Arg "to factories"), argument->w-mixins Arg (pr FLwP ArgwP), if-verbose (coq.say {header} "converting factories" FLwP "to mixins"), %%% factories-provide FLwP MLwP, if-verbose (coq.say {header} "declaring context" FLwP), context.declare FLwP MLwP Params TheKey MixinSrcClauses SectionCanonicalInstance, if (Arg = indt-decl _) ( apply-w-params ArgwP Params TheKey (indt-decl (record _ Sort _ Fields)), if-verbose (coq.say {header} "declare mixin or factory"), declare-mixin-or-factory MixinSrcClauses SectionCanonicalInstance Params TheKey Sort Fields MLwP Module AssetKind ) ( apply-w-params ArgwP Params TheKey (const-decl _ (some Sort) _), if-verbose (coq.say {header} "declare factory alias"), declare-factory-alias MixinSrcClauses SectionCanonicalInstance Params TheKey Sort MLwP Module ) ]. pred declare-mixin-or-factory i:list prop, i:list constant, i:list term, i:term, i:term, i:record-decl, i:list-w-params factoryname, i:id, i:asset. declare-mixin-or-factory MixinSrcClauses SectionCanonicalInstance TheParams TheType Sort1 Fields GRFSwP Module D :- std.do! [ if-verbose (coq.say {header} "declare record axioms_"), Kname = "Axioms_", RDeclSkel = record "axioms_" Sort1 Kname Fields, std.assert-ok! (coq.elaborate-indt-decl-skeleton RDeclSkel RDecl) "record declaration illtyped", abstract-over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance coq.abstract-indt-decl RDecl RDeclClosed _, if (get-option "primitive" tt) (@primitive! => log.coq.env.add-indt RDeclClosed R) (log.coq.env.add-indt RDeclClosed R), log.coq.env.end-section-name Module, % We need to anyway declare the record inside the section % since closing the section purges the unused universe level we may have % allocated by typechecking the skeleton just above coq.env.indt R tt _ _ _ [K] _, GRK = indc K, @global! => log.coq.arguments.set-implicit (indt R) [[]], @global! => log.coq.arguments.set-implicit GRK [[]], factories-provide GRFSwP MLwP, w-params.nparams MLwP NParams, build-deps-for-projections R MLwP GRDepsClausesProjs, GRDepsClauses = [gref-deps (indt R) MLwP, gref-deps (indc K) MLwP|GRDepsClausesProjs], % GRDepsClauses => mk-factory-sort MLwP (indt R) _ FactorySortCoe, % FactorySortCoe = coercion GRFSort _ _ _, % TODO: should this be in the Exports module? if-verbose (coq.say {header} "declare notation Build"), GRDepsClauses => phant.of-gref ff GRK [] PhGRK, GRDepsClauses => phant.add-abbreviation "Build" PhGRK BuildConst BuildAbbrev, if-verbose (coq.say {header} "declare notation axioms"), if (D = asset-mixin) ((GRDepsClauses => mk-factory-abbrev "axioms" (indt R) FRClauses FactAbbrev), (GRDepsClauses => FRClauses => declare-id-builder (indt R) IdBuilderClause), Clauses = [IdBuilderClause|FRClauses]) (GRDepsClauses => mk-factory-abbrev "axioms" (indt R) Clauses FactAbbrev), if-verbose (coq.say {header} "start module Exports"), log.coq.env.begin-module "Exports" none, std.flatten [Clauses, GRDepsClauses, [ factory-constructor (indt R) GRK, factory-nparams (indt R) NParams, factory-builder-nparams BuildConst NParams, phant-abbrev GRK (const BuildConst) BuildAbbrev, % gref-deps GRFSort MLwP, % factory-sort FactorySortCoe, ]] NewClauses, acc-clauses current NewClauses, list-w-params_list MLwP MLwoP, std.map MLwoP (_\ r\ r = maximal) Implicits, /* std.map {list-w-params_list MLwP} (_\ r\ r = maximal) Implicits, */ @global! => log.coq.arguments.set-implicit GRK [[maximal|Implicits]], % @global! => log.coq.coercion.declare FactorySortCoe, % NewClauses => instance.declare-factory-sort-deps (indt R), log.coq.env.end-module-name "Exports" Exports, log.coq.env.end-module-name Module _, if-verbose (coq.say {header} "end modules and sections; export" Exports), export.module {calc (Module ^ ".Exports")} Exports, GRDepsClauses => declare-abbrev Module FactAbbrev _, ]. pred declare-factory-alias i:list prop, i:list constant, i:list term, i:term, i:term, i:list-w-params factoryname, i:id. declare-factory-alias MixinSrcClauses SectionCanonicalInstance TheParams TheType Ty1Skel GRFSwP Module :- std.do! [ if-verbose (coq.say {header} "declare constant axioms_"), std.assert-ok! (coq.elaborate-ty-skeleton Ty1Skel _ Ty1) "Illtyped alias factory", abstract-over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance coq.abstract-const-decl (pr Ty1 _) (pr Ty1Closed _) Section, log.coq.env.add-const-noimplicits "axioms_" Ty1Closed _ @transparent! C, std.assert! (safe-dest-app Ty1 (global PhF) _Args) "Argument must be a factory", std.assert-ok! (factory-alias->gref PhF F) "HB", std.assert! (factory-constructor F FK) "BUG: Factory constructor missing", MixinSrcClauses => synthesis.infer-all-gref-deps TheParams TheType FK MFK, std.assert-ok! (coq.typecheck MFK MFKTy) "BUG: typecking of former factory constructor failed", (pi Args\ copy (app[global F|Args]) (app[global (const C)|Section])) => copy MFKTy MFKTyC, abstract-over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance coq.abstract-const-decl (pr MFK MFKTyC) (pr MFKClosed MFKTyCClosed) _, log.coq.env.add-const-noimplicits "Axioms_" MFKClosed MFKTyCClosed @transparent! CK, GRK = const CK, log.coq.env.end-section-name Module, @global! => log.coq.arguments.set-implicit GRK [[]], factories-provide GRFSwP MLwP, GRDepsClauses = [gref-deps (const C) MLwP, gref-deps (const CK) MLwP], GRDepsClauses => phant.of-gref ff GRK [] PhGRK0, % GRDepsClauses => mk-factory-sort MLwP (const C) _ FactorySortCoe, % FactorySortCoe = coercion GRFSort _ _ _, if (mixin-first-class F _) (PhGRK = PhGRK0) (phant.append-fun-unify PhGRK0 PhGRK), GRDepsClauses => phant.add-abbreviation "Build" PhGRK BuildConst _, GRDepsClauses => mk-factory-abbrev "axioms" (const C) Clauses FactAbbrev, if-verbose (coq.say {header} "start module Exports"), log.coq.env.begin-module "Exports" none, w-params.nparams MLwP NParams, std.flatten [ Clauses, GRDepsClauses, [ factory-nparams (const C) NParams, factory-constructor (const C) GRK, factory-builder-nparams BuildConst NParams, % gref-deps GRFSort MLwP, % factory-sort FactorySortCoe ] ] NewClauses, acc-clauses current NewClauses, %@global! => log.coq.coercion.declare FactorySortCoe, % NewClauses => instance.declare-factory-sort-deps (const C), log.coq.env.end-module-name "Exports" Exports, log.coq.env.end-module-name Module _, if-verbose (coq.say {header} "end modules and sections; export" Exports), export.module {calc (Module ^ ".Exports")} Exports, GRDepsClauses => declare-abbrev Module FactAbbrev _, ]. % [build-deps-for-projections I ML CL] builds a [gref-dep] for each projection P % of I such that P depends on "ML @ [I]" (each operation depends on the the % deps of the record plus the record itself) pred build-deps-for-projections i:inductive, i:mixins, o:list prop. build-deps-for-projections R MLwP CL :- std.do! [ compat.map-filter {coq.env.projections R} (x\y\x = some y) MixinOps, list-w-params.rcons MLwP (pl\t\r\ r = triple (indt R) pl t) MLRwP, std.map MixinOps (gr\r\ r = gref-deps (const gr) MLRwP) CL, ]. % Section handling in Coq is smart, in the sense it it only abstracts over % variables that aoccur. We don't want that for mixin/factories, so we implement % our own discharging. Note that definitions (like canonical instance) have % to be abstracted too. pred abstract-over-section i:list term, i:term, i:list prop, i:list constant, i:(list constant -> A -> A -> prop), i:A, o:A, o:list term. abstract-over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance F X X1 Section :- % compute section variables to be used for discharging std.map MixinSrcClauses mixin-src_src Mixins, std.append TheParams [TheType|{std.rev Mixins}] Section, std.map Section (x\r\ x = global (const r)) SectionVars, % We discharge by hand the record declaration so that we can be sure all % parameters and mixins are abstracted (even if unused). coq.copy-clauses-for-unfold SectionCanonicalInstance CopyUnfold, CopyUnfold => F SectionVars X X1. pred mk-factory-sort i:mixins, i:gref, o:gref, o:coercion. mk-factory-sort MLwP GR (const FactorySortCst) Coe :- if-verbose (coq.say {header} "declaring tagged sort for GR=" GR), synthesis.mixins-w-params.fun MLwP (mk-factory-sort.term GR) FactorySort, std.assert-ok! (coq.typecheck FactorySort FactorySortTy) "HB: cannot elaborate sort", log.coq.env.add-const-noimplicits "sort" FactorySort FactorySortTy ff FactorySortCst, synthesis.mixins-w-params.length MLwP MLwPLength, std.nlist {calc (MLwPLength + 1)} implicit MLwPImplicits, (@global! => log.coq.arguments.set-implicit (const FactorySortCst) [MLwPImplicits]), synthesis.infer-coercion-tgt MLwP CoeClass, Coe = coercion (const FactorySortCst) MLwPLength GR CoeClass. pred mk-factory-sort.term i:gref, i:list term, i:term, o:term. mk-factory-sort.term GR P T (fun `_` Ty _\ T) :- synthesis.infer-all-gref-deps P T GR Ty. }}hierarchy-builder-1.8.1/HB/graph.elpi000066400000000000000000000016721474513043100174000ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace graph { pred to-file i:string. to-file File :- !, std.do! [ open_out File OC, output OC "digraph Hierarchy { ", std.forall {coq.coercion.db} (private.pp-coercion-dot OC), output OC "}", close_out OC, ]. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { pred pp-coercion-dot i:out_stream, i:coercion. pp-coercion-dot OC (coercion _ _ Src (grefclass Tgt)) :- class-def (class Src _ _), class-def (class Tgt _ _), !, std.do! [ output OC {gref->modname_short Tgt "_"}, output OC " -> ", output OC {gref->modname_short Src "_"}, output OC ";\n", ]. pp-coercion-dot _ _. }}hierarchy-builder-1.8.1/HB/howto.elpi000066400000000000000000000150101474513043100174260ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace howto { pred main-trm i:term, i:string, i:option int. main-trm T STgt Depth :- coq.term->gref T GR, main-gref GR STgt Depth. pred main-str i:string, i:string, i:option int. main-str S STgt Depth :- coq.locate S GR, main-gref GR STgt Depth. pred main-gref i:gref, i:string, i:option int. main-gref GR STgt Depth :- class-def (class _ GR _), !, private.mixins-in-structures [GR] MLSrc, main-from MLSrc STgt Depth. main-gref GR STgt Depth :- private.structures-on-gref GR SL, private.mixins-in-structures SL MLSrc, main-from MLSrc STgt Depth. pred main-from i:list mixinname, i:string, i:option int. main-from MLSrc STgt Depth :- private.mixins-in-structures [{coq.locate STgt}] MLTgt, private.list-diff MLTgt MLSrc ML, if (ML = []) (coq.say "HB: nothing to do.") (main-from.aux MLSrc ML Depth). main-from.aux MLSrc ML (some Depth) :- main-increase-depth MLSrc ML Depth false. main-from.aux MLSrc ML none :- main-increase-depth MLSrc ML 3 true. pred main-increase-depth i:list mixinname, i:list mixinname, i:int, i:prop. main-increase-depth MLSrc ML Depth AutoIncrease :- private.paths-from-for-step MLSrc ML Depth R, if (not (R = [])) (private.pp-solutions R) (if AutoIncrease (Depth' is Depth + 1, coq.say "HB: no solution found at depth" Depth "looking at depth" Depth', main-increase-depth MLSrc ML Depth' true) (coq.error "HB: no solution found, try to increase search depth.")). /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { shorten coq.pp.{ v , hov , spc , str , box , glue }. % L1 \subseteq L2 pred incl i:list A, i:list A. incl L1 L2 :- std.forall L1 (std.mem L2). % R = L1 \ L2 pred list-diff i:list A, i:list A, o:list A. list-diff L1 L2 R :- std.filter L1 (about.not1 (std.mem L2)) R. % R = L1 U L2 pred union i:list A, i:list A, o:list A. union L1 L2 R :- std.fold L2 L1 (x\l\l'\if (std.mem l x) (l' = l) (l' = [x|l])) R. pred insert-sorted i:(A -> A -> prop), i:A, i:list A, o:list A. insert-sorted _ X [] [X] :- !. insert-sorted Rel X [Y|T] [X,Y|T] :- Rel X Y, !. insert-sorted Rel X [Y|T] [Y|T'] :- insert-sorted Rel X T T', !. pred lt-gref i:gref, i:gref. lt-gref X Y :- gref->modname_short X "." SX, gref->modname_short Y "." SY, !, SX s< SY. pred size-order i:(list A -> list A -> prop), i:list A, i:list A. size-order Rel L1 L2 :- std.length L1 S1, std.length L2 S2, !, (S1 i< S2; (S1 = S2, !, Rel L1 L2)). pred lexi-order i:list gref, i:list gref. lexi-order [] []. lexi-order [X1|_] [X2|_] :- lt-gref X1 X2. lexi-order [X|T1] [X|T2] :- lexi-order T1 T2. % [structures-on-gref GR ML] list structures [GR] is equipped with pred structures-on-gref i:gref, o:list structure. structures-on-gref GR SL :- std.filter {coq.CS.db-for _ (cs-gref GR)} (about.not1 about.unif-hint?) LV, std.map LV structures-on-gref.aux SL. structures-on-gref.aux (cs-instance _ _ GR) F :- coq.prod-tgt->gref {coq.env.typeof GR} F, class-def (class _ F _). % [mixins-in-structures SL ML] list mixins in structures [SL] pred mixins-in-structures i:list structure, o:list mixinname. mixins-in-structures SL ML :- std.fold SL [] mixins-in-structures.aux ML. mixins-in-structures.aux F L L' :- class-def (class _ F MLWP), union L {list-w-params_list MLWP} L'. % a type to store a factory along with the mixins it depends on % and the mixins it provides kind factory_deps_prov type. type fdp factoryname -> list mixinname -> list mixinname -> factory_deps_prov. % get all available factories in the above type pred list_factories o:list factory_deps_prov. list_factories FL :- std.map-filter {std.findall (factory-constructor _ _)} list_factories.aux FL. list_factories.aux (factory-constructor F _) (fdp F DML PML) :- gref-deps F FD, list-w-params_list FD DML, list-w-params_list {factory-provides F} PML. % [paths-from-for-step MLSrc ML K R] returns in [R] a list of sequences % of at most [K] factories that could, starting from mixins [MLSrc], % build exactly the mixins [ML] pred paths-from-for-step i:list mixinname, i:list mixinname, i:int, o:list (list factoryname). paths-from-for-step MLSrc ML K R :- std.filter {list_factories} (fd\sigma pml\fd = fdp _ _ pml, incl pml ML) FL, paths-from-for-step-using MLSrc ML K [] [] FL _ R. % [paths-from-for-step-using MLSrc ML K Pre KnownPre FL KnownPre' R] % same as [paths-from-for-step MLSrc ML K R] using only factories in [FL] % [Pre] is a (sorted) prefix that is looked into the list of known (sorted) % prefixes [KnownPre] to avoid generating identical solutions up to permutations pred paths-from-for-step-using i:list mixinname, i:list mixinname, i:int, i:list factoryname, i:list (list factoryname), i:list factory_deps_prov, o:list (list factoryname), o:list (list factoryname). paths-from-for-step-using _ _ K _ KnownPre _ KnownPre [] :- K i< 0. paths-from-for-step-using _ _ _ Pre KnownPre _ KnownPre [] :- std.mem KnownPre Pre, !. paths-from-for-step-using _ [] _ Pre KnownPre _ [Pre|KnownPre] [[]] :- !. paths-from-for-step-using MLSrc ML K Pre KnownPre FL [Pre|KnownPre'] R :- K' is K - 1, std.filter FL (p\sigma dml\p = fdp _ dml _, incl dml MLSrc) FLdep, std.fold FLdep (pr KnownPre []) (paths-from-for-step-using.aux MLSrc ML FL K' Pre) (pr KnownPre' R). paths-from-for-step-using.aux MLSrc ML FL' K' Pre (fdp F _ MLF) (pr KnPre L) (pr KnPre' R) :- std.append MLSrc MLF MLSrc', list-diff ML MLF ML', insert-sorted lt-gref F Pre Pre', std.filter FL' (p\sigma pml\p = fdp _ _ pml, incl pml ML') FML', paths-from-for-step-using MLSrc' ML' K' Pre' KnPre FML' KnPre' R', std.map R' (l\r\r = [F|l]) R'', std.append L R'' R. pred pp-solutions i:list (list factoryname). pp-solutions LLF :- std.sort LLF (size-order lexi-order) SLLF, % format PpSolutions = box (v 4) [ str "HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F):", {about.bulletize SLLF pp-solution}], % print coq.say {coq.pp->string PpSolutions}, coq.say, coq.say "For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances", coq.say. pred pp-solution i:list factoryname, o:coq.pp. pp-solution L (box (hov 0) PLS) :- std.map L about.pp-module PL, std.intersperse (glue [str ";", spc]) PL PLS. }}hierarchy-builder-1.8.1/HB/instance.elpi000066400000000000000000000476261474513043100201140ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace instance { % [declare-existing T F] equips T with all the canonical structures that can be % built using factory instance F pred declare-existing i:argument, i:argument. declare-existing T0 F0 :- std.do! [ argument->ty T0 T, % TODO: change this when supporting morphism hierarchies argument->term F0 F, std.assert-ok! (coq.typecheck F FTy) "HB: declare-existing illtyped factory instance", std.assert! (coq.safe-dest-app FTy (global FactoryAlias) _) "The type of the instance is not a factory", std.assert-ok! (factory-alias->gref FactoryAlias Factory) "HB: ", private.declare-instance Factory T F Clauses _ _, acc-clauses current Clauses, ]. % [declare-const N B Ty CFL CSL] adds a Definition N : Ty := B where Ty is a factory % and equips the type the factory is used on with all the canonical structures % that can be built using factory instance B. CFL contains the list of % factories being defined, CSL the list of canonical structures being defined. pred declare-const i:id, i:term, i:arity, o:list (pair id constant), o:list (pair id constant). declare-const Name BodySkel TyWPSkel CFL CSL :- std.do! [ std.assert-ok! (coq.elaborate-arity-skeleton TyWPSkel _ TyWP) "Definition type illtyped", coq.arity->term TyWP Ty, std.assert-ok! (coq.elaborate-skeleton BodySkel Ty Body) "Definition illtyped", % handle parameters via a section -- begin if (TyWP = arity SectionTy) ( % Do not open a section when it is not necessary (no parameters) % A side effect of opening a section is loosing meta data associated % with instances, in particular builder tags are lost if-verbose (coq.say "HB: skipping section opening"), SectionBody = Body ) ( std.assert! (coq.next-synterp-action (begin-section SectionName)) "synterp code did not open section", log.coq.env.begin-section SectionName, private.postulate-arity TyWP [] Body SectionBody SectionTy ), % identify the factory std.assert! (coq.safe-dest-app SectionTy (global FactoryAlias) Args) "The type of the instance is not a factory", std.assert-ok! (factory-alias->gref FactoryAlias Factory) "HB", std.assert! (factory-nparams Factory NParams) "Not a factory synthesized by HB", % declare the constant for the factory instance private.hack-section-discharging SectionBody SectionBodyHack, private.optimize-body SectionBodyHack OptimizedBody, if (Name = "_") (RealName is "HB_unnamed_factory_" ^ {std.any->string {new_int} }) (RealName = Name), % unfold local instances in the type of C if (current-mode (builder-from _ _ _ _)) (std.do![ findall-local-canonical LocalCSL, coq.copy-clauses-for-unfold LocalCSL UnfoldClauses, UnfoldClauses => copy SectionTy SectionTyUnfolded, ]) (SectionTy = SectionTyUnfolded), % call HB.instance TheType TheFactory std.drop NParams Args [TheType|_], if (var TheType) (coq.error "HB: The instance subject must be explicitly given.\nUse:\n HB.instance Definition _ : M := ...\n HB.instance Definition _ := M.Build ...") true, log.coq.env.add-const-noimplicits-failondup RealName OptimizedBody SectionTyUnfolded @transparent! C, TheFactory = (global (const C)), private.check-non-forgetful-inheritance TheType Factory, private.declare-instance Factory TheType TheFactory Clauses CFL CSL, if (CSL = []) (coq.warning "HB" "HB.no-new-instance" "HB: no new instance is generated") true, % handle parameters via a section -- end if (TyWP = arity _) true ( if-verbose (coq.say {header} "closing instance section"), log.coq.env.end-section-name SectionName ), % we accumulate clauses now that the section is over acc-clauses current Clauses ]. % [not-subclass-of X C] holds if C does not inherit from X pred not-subclass-of i:classname, i:class. not-subclass-of HasNoInstance (class C _ _) :- not(sub-class C HasNoInstance _ _). % [declare-all T CL MCSTL] given a type T and a list of class definition % CL in topological order (from least dep to most) looks for classes % for which all the dependencies (mixins) were postulated so far and skips the % rest. For each fulfilled class it declares a local constant inhabiting the % corresponding structure and declares it canonical. % Each mixin used in order to fulfill a class is returned together with its name. pred declare-all i:term, i:list class, o:list (pair id constant). declare-all _ [] []. declare-all T [class _ Struct _|Rest] L :- has-instance T Struct, !, declare-all T Rest L. declare-all T [class Class Struct MLwP|Rest] [pr Name CS|L] :- infer-class T Class Struct MLwP S Name STy Clauses, !, decl-const-in-struct Name S STy CS, Clauses => declare-all T Rest L. declare-all T [class HasNoInstance _ _|Rest] L :- % filter out classes we can't build for sure std.filter Rest (not-subclass-of HasNoInstance) Rest1, declare-all T Rest1 L. % for generic types, we need first to instantiate them by giving them holes, % so they can be used to instantiate the classes pred declare-all-on-type-constructor i:term, i:list class, o:list (pair id constant). declare-all-on-type-constructor _ [] []. declare-all-on-type-constructor TK [class _ Struct _|Rest] L :- saturate-type-constructor TK T, has-instance T Struct, !, declare-all-on-type-constructor TK Rest L. declare-all-on-type-constructor TK [class Class Struct MLwP|Rest] [pr Name CS|L] :- %TODO: compute the arity of the Class subject and saturate up to that point % there may even be more than one possibility saturate-type-constructor TK T, infer-class T Class Struct MLwP S Name _STy Clauses, !, abstract-holes.main S SC, std.assert-ok! (coq.typecheck SC SCTy) "declare-all-on-type-constructor: badly closed", decl-const-in-struct Name SC SCTy CS, Clauses => declare-all-on-type-constructor TK Rest L. declare-all-on-type-constructor TK [class HasNoInstance _ _|Rest] L :- % filter out classes we can't build for sure std.filter Rest (not-subclass-of HasNoInstance) Rest1, declare-all-on-type-constructor TK Rest1 L. pred has-instance i:term, i:structure. has-instance T Struct :- if (has-CS-instance? T Struct) (if-verbose (coq.say {header} "skipping already existing" {nice-gref->string Struct} "instance on" {coq.term->string T})) fail. % we build it pred infer-class i:term, i:classname, i:gref, i:factories, o:term, o:string, o:term, o:list prop. infer-class T Class Struct MLwP S Name STy Clauses:- std.do![ params->holes MLwP Params, get-constructor Class KC, if (synthesis.infer-all-args-let Params T KC KCApp ok) (if-verbose (coq.say {header} "we can build a" {nice-gref->string Struct} "on" {coq.term->string T})) fail, Name is {cs-pattern->name {term->cs-pattern T}} ^ "__canonical__" ^ {gref->modname Struct 2 "_" }, if-verbose (coq.say {header} "declare canonical structure instance" Name), get-constructor Struct KS, coq.safe-dest-app T THD _, private.optimize-class-body THD {std.length Params} KCApp KCAppNames Clauses, coq.mk-app (global KS) {std.append Params [T, KCAppNames]} S, if-verbose (coq.say {header} "structure instance for" Name "is" {coq.term->string S}), coq.typecheck S STy ok, % failure may be due to a parameter not rich enough see #435 ]. pred decl-const-in-struct i:string, i:term, i:term, i:constant. decl-const-in-struct Name S STy CS:- std.do![ if (ground_term S) (S1 = S, STy1 = STy) (abstract-holes.main S S1, std.assert-ok! (coq.typecheck S1 STy1) "HB: structure instance illtyped after generalizing over holes"), log.coq.env.add-const-noimplicits Name S1 STy1 @transparent! CS, % Bug coq/coq#11155, could be a Let with-locality (log.coq.CS.declare-instance CS), % Bug coq/coq#11155, should be local acc-clause current (local-canonical CS), if-verbose (coq.say {header} "structure instance" Name "declared"), ]. pred declare-factory-sort-deps i:gref. declare-factory-sort-deps GR :- std.do! [ if-verbose (coq.say {header} "required instances on factory sort for" GR), Name is "SortInstances" ^ {std.any->string {new_int}}, log.coq.env.begin-module Name none, log.coq.env.begin-section Name, mk-factory-sort-deps GR CSL, log.coq.env.end-section-name Name, log.coq.env.end-module-name Name _, std.forall CSL (x\ sigma CS\ x = pr _ CS, log.coq.CS.declare-instance CS) ]. pred declare-factory-sort-factory i:gref. declare-factory-sort-factory GR :- std.do! [ if-verbose (coq.say {header} "required instances on factory sort for" GR), Name is "SortInstances" ^ {std.any->string {new_int}}, log.coq.env.begin-module Name none, log.coq.env.begin-section Name, mk-factory-sort-factory GR CFL CSL, log.coq.env.end-section-name Name, log.coq.env.end-module-name Name _, std.forall {std.append CFL CSL} (x\ sigma CS\ x = pr _ CS, log.coq.CS.declare-instance CS) ]. pred context.declare i:factories, o:mixins, o:list term, o:term, o:list prop, o:list constant. pred mk-factory-sort-deps i:gref, o:list (pair id constant). mk-factory-sort-deps AliasGR CSL :- std.do! [ std.assert-ok! (factory-alias->gref AliasGR GR) "HB: mk-factory-sort-deps", gref-deps GR MLwPRaw, context.declare MLwPRaw MLwP SortParams SortKey SortMSL _, SortMSL => synthesis.infer-all-gref-deps SortParams SortKey GR FSort, log.coq.env.add-section-variable-noimplicits "f" FSort CF, GCF = global (const CF), factory-sort (coercion GRFSort _ GR _), SortMSL => synthesis.infer-all-gref-deps SortParams SortKey GRFSort KSort, coq.mk-app KSort [GCF] KFSortEta, list-w-params_list MLwP ML, std.length ML NMLArgs, coq.mk-n-holes NMLArgs SortMLHoles, std.append {std.append SortParams [SortKey|SortMLHoles]} [GCF] KFSortArgs, coq.mk-app (global GRFSort) KFSortArgs KFSort, std.assert-ok! (coq.unify-eq KFSortEta KFSort) "HB: KRSort not an app", std.map SortMSL (c\ o\ sigma m t\ c = mixin-src _ m t, o = mixin-src KFSort m t) KFSortMSL, KFSortMSL => synthesis.under-mixin-src-from-factory.do! KFSort GCF [declare-all KFSort {findall-classes-for ML} CSL] ]. pred mk-factory-sort-factory i:gref, o:list (pair id constant), o:list (pair id constant). mk-factory-sort-factory AliasGR CFL CSL :- std.do! [ std.assert-ok! (factory-alias->gref AliasGR GR) "HB", gref-deps GR MLwPRaw, context.declare MLwPRaw MLwP SortParams SortKey SortMSL _, SortMSL => synthesis.infer-all-gref-deps SortParams SortKey GR FSort, log.coq.env.add-section-variable-noimplicits "f" FSort CF, std.length {list-w-params_list MLwP} NMLArgs, coq.mk-n-holes NMLArgs SortMLHoles, GCF = global (const CF), coq.mk-app (global GR) {std.append SortParams [GCF|SortMLHoles]} FGCF, declare-const "_" GCF (arity FGCF) CFL CSL ]. % create instances for all possible combinations of types and structure compatible pred saturate-instances i:cs-pattern. saturate-instances Filter :- std.do! [ findall-has-mixin-instance Filter ClausesHas, std.map ClausesHas has-mixin-instance_key KL, undup-cs-patterns KL UKL, std.map UKL cs-pattern->term TL, findall-classes AllClasses, std.map ClausesHas has-mixin-instance->mixin-src Clauses, Clauses => std.forall2 TL UKL (t\k\sigma Classes\ std.filter AllClasses (no-instance-for k) Classes, declare-all-on-type-constructor t Classes _), ]. pred no-instance-for i:cs-pattern, i:class. no-instance-for K (class _ S _) :- get-structure-sort-projection S (global Proj), coq.CS.db-for Proj K []. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { shorten coq.{ term->gref, subst-fun, safe-dest-app, mk-app, mk-eta, subst-prod }. pred declare-instance i:factoryname, i:term, i:term, o:list prop, o:list (pair id constant), o:list (pair id constant). declare-instance Factory T F Clauses CFL CSL :- current-mode (builder-from T TheFactory FGR _), !, if (get-option "local" tt) (coq.error "HB: declare-instance: cannot make builders local. If you want temporary instances, make an alias, e.g. with let T' := T") true, !, declare-canonical-instances-from-factory-and-local-builders Factory T F TheFactory FGR Clauses CFL CSL. declare-instance Factory T F Clauses CFL CSL :- declare-canonical-instances-from-factory Factory T F Clauses1 CFL CSL, if (get-option "export" tt) (coq.env.current-library File, std.map {std.append CFL CSL} (x\r\ sigma i c\ x = pr i c, r = instance-to-export File i c) Clauses2) (Clauses2 = []), std.append Clauses1 Clauses2 Clauses. % [add-mixin T F _ M Cl] adds a constant being the mixin instance for M on type % T built from factory F pred add-mixin i:term, i:factoryname, i:bool, i:mixinname, o:list prop, o:list (pair id constant). add-mixin T FGR MakeCanon MissingMixin [MixinSrcCl, BuilderDeclCl] CSL :- std.do! [ new_int N, % timestamp synthesis.assert!-infer-mixin T MissingMixin Bo, MixinSrcCl = mixin-src T MixinName (global (const C)), BuilderDeclCl = builder-decl (builder N FGR MixinName (const C)), std.assert-ok! (coq.typecheck Bo Ty) "declare-instances: mixin illtyped", safe-dest-app Ty (global MixinNameAlias) _, std.assert-ok! (factory-alias->gref MixinNameAlias MixinName) "HB", std.assert! (MissingMixin = MixinName) "HB: anomaly: we built the wrong mixin", % If the mixin instance is already a constant there is no need to % alias it. if (Bo = global (const C)) true (Name is {gref->modname FGR 2 "_"} ^"__to__" ^ {gref->modname MixinName 2 "_"}, if-verbose (coq.say {header} "declare mixin instance" Name), log.coq.env.add-const-noimplicits Name Bo Ty @transparent! C), if (MakeCanon = tt, whd (global (const C)) [] (global (indc _)) _) (std.do! [ if-verbose (coq.say {header} "declare canonical mixin instance" C), with-locality (log.coq.CS.declare-instance C), CSL = [pr "_" C] ]) (CSL = []), ]. pred add-all-mixins i:term, i:factoryname, i:list mixinname, i:bool, o:list prop, o:list (pair id constant). add-all-mixins T FGR ML MakeCanon Clauses CSL :- std.do! [ std.map ML (m\ o\ sigma ClL CSL\ add-mixin T FGR MakeCanon m ClL CSL, o = pr ClL CSL) ClLxCSL_L, std.unzip ClLxCSL_L ClLL CSLL, std.flatten ClLL Clauses, std.flatten CSLL CSL ]. % [postulate-arity A Acc T TS] postulates section variables % corresponding to parameters in arity A. TS is T applied % to all section variables (and hd-beta reduced). Acc should % be [] at call site. pred postulate-arity i:arity, i:list term, i:term, o:term, o:term. postulate-arity (parameter ID _ S A) Acc T T1 Ty :- std.assert-ok! (coq.typecheck-ty S _) "arity parameter illtyped", if-verbose (coq.say {header} "postulating" ID), if (var S) (coq.fresh-type S) true, log.coq.env.add-section-variable-noimplicits ID S C, Var = global (const C), postulate-arity (A Var) [Var|Acc] T T1 Ty. postulate-arity (arity Ty) ArgsRev X T Ty :- hd-beta X {std.rev ArgsRev} X1 Stack1, unwind X1 Stack1 T. % We find the new mixins that F build, we build them and shedule them % for becoming builders at section closing time. We also declare % all canonical instances these new mixins allow for, so that the user % can access their theory and notations pred declare-canonical-instances-from-factory-and-local-builders i:factoryname, i:term, i:term, i:term, i:factoryname, o:list prop, o:list (pair id constant), o:list (pair id constant). declare-canonical-instances-from-factory-and-local-builders Factory T F _TheFactory FGR Clauses CFL CSL :- std.do! [ synthesis.under-new-mixin-src-from-factory.do! T F (NewMixins\ std.do! [ add-all-mixins T FGR NewMixins ff Clauses CFL, ]), list-w-params_list {factory-provides Factory} ML, Clauses => declare-all T {findall-classes-for ML} CSL, ]. % [declare-canonical-instances-from-factory T F] given a factory F % it uses all known builders to declare canonical instances of structures % on T pred declare-canonical-instances-from-factory i:factoryname, i:term, i:term, o: list prop, o:list (pair id constant), o:list (pair id constant). declare-canonical-instances-from-factory Factory T F ClausesHas CFL CSL :- std.do! [ % The order of the following two "under...do!" is crucial, % priority must be given to canonical mixins % as they are the ones which guarantee forgetful inheritance % hence we add these clauses last. synthesis.under-mixin-src-from-factory.do! T F [ synthesis.under-local-canonical-mixins-of.do! T [ list-w-params_list {factory-provides Factory} ML, add-all-mixins T Factory ML tt Clauses CFL, std.map-filter Clauses (mixin-src->has-mixin-instance ) ClausesHas, ClausesHas => declare-all T {findall-classes-for ML} CSL, % declare-all-on-type-constructor doesn't work here ] ], ]. % If you don't mention the factory in a builder, then Coq won't make % a lambda for it at section closing time. pred hack-section-discharging i:term, o:term. hack-section-discharging B B :- current-mode no-builder, !. hack-section-discharging B B1 :- current-mode (builder-from _ TheFactory _ _), !, std.assert-ok! (coq.typecheck TheFactory TheFactoryTy) "TheFactory is illtyped (BUG)", B1 = {{ let _ : lp:TheFactoryTy := lp:TheFactory in lp:B }}. hack-section-discharging B B. % unfolds the constant used for the phant abbreviation to avoid storing all % the phantom abstrctions and idfun that were used to trigger inference pred optimize-body i:term, o:term. optimize-body (app[global (const C)| Args]) Red :- (phant-abbrev _ (const C) _ ; (rex_match "phant_" {coq.gref->id (const C)})), !, coq.env.const C (some B) _, hd-beta B Args HD Stack, unwind HD Stack Red. optimize-body (let _ _ T x\x) Red :- !, optimize-body T Red. optimize-body X X. pred hnf i:term, o:term. hnf X R :- get-option "hnf" tt, !, unwind {whd X []} R. hnf X X. pred optimize-class-body i:term, i:int, i:term, o:term, o:list prop. optimize-class-body T NParams (let _ _ MBo R) R1 Clauses :- std.do! [ declare-mixin-name {hnf MBo} MC CL1, if (T = global (indt _), MC = global (const C), not(coq.env.opaque? C)) (log.coq.strategy.set [C] (level 1000)) true, % opaque stops simpl optimize-class-body T NParams (R MC) R1 CL2, std.append CL1 CL2 Clauses, ]. optimize-class-body _ _ (app L) (app L) []. pred declare-mixin-name i:term, o:term, o:list prop. declare-mixin-name (global _ as T) T []. declare-mixin-name T (global GR) [] :- mixin-mem T GR. declare-mixin-name T T [] :- coq.safe-dest-app T (global GR) _, not (from _ _ GR), not (get-option "hnf" tt). declare-mixin-name T (global (const C)) [mixin-mem T (const C)] :- std.do! [ Name is "HB_unnamed_mixin_" ^ {std.any->string {new_int}}, if-verbose (coq.say {header} "Giving name" Name "to mixin instance" {coq.term->string T}), log.coq.env.add-const-noimplicits Name T _ @transparent! C, ]. pred check-non-forgetful-inheritance i:term, i:gref. check-non-forgetful-inheritance _ _ :- get-option "non_forgetful_inheritance" tt, !. check-non-forgetful-inheritance T Factory :- std.do! [ if (coq.safe-dest-app T (global (const HdSym)) _, structure-key HdSym _ Super) ( coq.warning "HB" "HB.non-forgetful-inheritance" "non forgetful inheritance detected.\n" "You have two solutions:" "1. (Best practice) Reorganize your hierarchy to make" {nice-gref->string Factory} "depend on" { calc ({nice-gref->string Super} ^ ".") } "See the paper \"Competing inheritance paths in" "dependent type theory\" (https://hal.inria.fr/hal-02463336) for more" "explanations" "2. Use the attribute #[non_forgetful_inheritance] to disable this check." "We strongly advise you encapsulate this instance inside a module," "in order to isolate it from the rest of the code, and to be able" "to import it on demand. See the above paper and the file" "https://github.com/math-comp/hierarchy-builder/blob/master/tests/non_forgetful_inheritance.v" "to witness devastating effects." ) true ]. }} hierarchy-builder-1.8.1/HB/pack.elpi000066400000000000000000000067561474513043100172250ustar00rootroot00000000000000 /* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace pack { pred main i:term, i:list argument, o:term. main Ty Args Instance :- std.do! [ std.assert! (not(var Ty)) "HB.pack: the structure to pack cannot be unknown, use HB.pack_for", std.assert! (coq.safe-dest-app {unwind {whd Ty []}} (global Structure) Params) "HB.pack: not a structure", std.assert! (class-def (class Class Structure _)) "HB.pack: not a structure", std.assert! (Args = [trm TSkel|FactoriesSkel]) "HB.pack: not enough arguments", get-constructor Class KC, get-constructor Structure KS, std.assert-ok! (d\ (coq.elaborate-ty-skeleton TSkel _ T d, d = ok) ; coq.elaborate-skeleton TSkel _ T d ) "HB.pack: not a well typed key", private.elab-factories FactoriesSkel T Factories, if (var T) (coq.error "HB.pack: you must pass a type or at least one factory") true, if2 (T = app[global (const SortProj)|ProjParams], structure-key SortProj ClassProj _) (AllFactories = [app[global (const ClassProj)|ProjParams] | Factories], Tkey = T) % already existing class on T (def T _ _ Tkey) % we unfold letins if we can, they may hide constants with CS instances (AllFactories = Factories) (AllFactories = Factories, Tkey = T), % it's a factory, won't add anything private.synth-instance Params KC KS T Tkey AllFactories Instance, ]. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { pred synth-instance i:list term, i:gref, i:gref, i:term, i:term, i:list term, o:term. synth-instance Params KC KS T Tkey [Factory|Factories] Instance :- synthesis.under-new-mixin-src-from-factory.do! Tkey Factory (_\ synth-instance Params KC KS T Tkey Factories Instance). synth-instance Params KC KS T Tkey [] Instance :- coq.safe-dest-app Tkey (global _) _, !, synthesis.under-local-canonical-mixins-of.do! Tkey [ std.assert-ok! (synthesis.infer-all-args-let Params Tkey KC ClassInstance) "HB.pack: cannot infer the instance", std.append Params [T, ClassInstance] InstanceArgs, Instance = app[global KS | InstanceArgs] ]. synth-instance Params KC KS T Tkey [] Instance :- std.do! [ std.assert-ok! (synthesis.infer-all-args-let Params Tkey KC ClassInstance) "HB.pack: cannot infer the instance", std.append Params [T, ClassInstance] InstanceArgs, Instance = app[global KS | InstanceArgs] ]. pred elab-factories i:list argument, i:term, o:list term. elab-factories [] _ []. elab-factories [trm FactorySkel|More] T [Factory|Factories] :- std.assert-ok! (coq.elaborate-skeleton FactorySkel FTy MaybeFactory) "HB.pack: illtyped factory", if2 (factory? {unwind {whd FTy []}} (triple _ _ T1)) % a factory (Factory = MaybeFactory) (coq.safe-dest-app {unwind {whd FTy []}} (global GR) _, structure-key SortP ClassP GR) % a structure instance (coq.mk-n-holes {structure-nparams GR} Params, std.append Params [MaybeFactory] ParamsF, coq.mk-app (global (const SortP)) ParamsF T1, coq.mk-app (global (const ClassP)) ParamsF Factory) (coq.error "HB: argument" {coq.term->string MaybeFactory} "is not a factory, it has type:" {coq.term->string FTy}), std.assert-ok! (coq.unify-eq T T1) "HB.pack: factory for the wrong type", elab-factories More T Factories. }} hierarchy-builder-1.8.1/HB/status.elpi000066400000000000000000000055351474513043100176240ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace status { pred print-hierarchy. print-hierarchy :- std.do! [ coq.say "--------------------- Hierarchy -----------------------------------", std.findall (class-def CL_) CL, std.forall CL private.pp-class, coq.say "", coq.say "--------------------- Builders -----------------------------------", std.findall (from A_ B_ C_) FL, std.forall FL private.pp-from, std.findall (mixin-src T_ M_ V_) ML, if (ML = []) true ( coq.say "", coq.say "--------------------- Local mixin instances ----------------------", std.forall ML private.pp-mixin-src ), std.findall (builder-decl BD_) BDL, if (BDL = []) true ( coq.say "", coq.say "--------------------- Builder declarations ----------------------", std.forall BDL private.pp-builder-decl ), std.findall (current-mode BF_) BFL, if (BFL = []) true ( coq.say "", coq.say "--------------------- Current mode ----------------------", std.forall BFL private.pp-current-mode ), ]. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { pred pp-from i:prop. pp-from (from F M T) :- coq.say "From" {coq.term->string (global F)} "to" {coq.term->string (global M)}, coq.say " " {coq.term->string (global T)}, coq.say "". pred pp-list-w-params i:mixins, i:term. pred pp-list-w-params.list-triple i:list (w-args mixinname), i:term. pred pp-list-w-params.triple i:w-args mixinname. pp-list-w-params (w-params.cons N Ty LwP) T :- @pi-parameter N Ty p\ pp-list-w-params (LwP p) {coq.mk-app T [p]}. pp-list-w-params (w-params.nil N TTy LwP) T :- @pi-parameter N TTy t\ pp-list-w-params.list-triple (LwP t) {coq.mk-app T [t]}. pp-list-w-params.list-triple L S :- coq.say {coq.term->string S} ":=", std.forall L pp-list-w-params.triple. pp-list-w-params.triple (triple M Params T) :- coq.say " " {coq.term->string (app [global M|{std.append Params [T]}])}. pred pp-class i:prop. pp-class (class-def (class _ S MLwP)) :- pp-list-w-params MLwP (global S). pred pp-mixin-src i:prop. pp-mixin-src (mixin-src T M C) :- coq.say {coq.term->string T} "is a" {nice-gref->string M} "thanks to" {coq.term->string C}. pred pp-builder-decl i:prop. pp-builder-decl (builder-decl (builder N F M GR)) :- coq.say "builder" GR "with serial number" N "will build mixin" M "from factory" F. pred pp-current-mode i:prop. pp-current-mode (current-mode (builder-from TheType TheFactory GRF Mod)) :- coq.say "The current key is" TheType "with factory" TheFactory "corresponding to Global Ref" GRF "in module" Mod. }} hierarchy-builder-1.8.1/HB/structure.elpi000066400000000000000000000664621474513043100203470ustar00rootroot00000000000000/* Hierarchy Builder: algebraic hierarchies made easy This software is released under the terms of the MIT license */ namespace structure { % HB.structure Definition S P1 P2 := { T of F1 P1 T & F2 P1 (P2*P2) T } % cons p1\ cons p2\ nil t\ [triple f1 [p1] t,triple f2 [p1, {{p1 * p2}}] t] pred declare i:string, i:term, i:sort. declare Module BSkel Sort :- std.do! [ disable-id-phant BSkel BSkelNoId, std.assert-ok! (coq.elaborate-skeleton BSkelNoId _ BNoId) "illtyped structure definition", re-enable-id-phant BNoId B, private.sigT->list-w-params B GRFSwP ClosureCheck, factories-provide GRFSwP PMLwP, list-w-params.flatten-map GRFSwP gref-deps RMLwP, % TODO: extract code from factories-provide list-w-params.append PMLwP RMLwP UnsortedMLwP, w-params.map UnsortedMLwP (p\t\ toposort-mixins) MLwP, list-w-params_list PMLwP PML, list-w-params_list MLwP ML, synthesis.list-w-params.check-key MLwP, if (ClosureCheck = tt, not({std.length PML} = {std.length ML})) (coq.warning "HB" "HB.implicit-structure-dependency" "pulling in dependencies:" {std.map {std.list-diff ML PML} nice-gref->string} "\nPlease list them or end the declaration with '&'") true, private.if-class-already-exists-error Module {findall-classes-for ML} ML, private.if-coverage-not-good-error ML, % TODO: check we never define the superclass of an exising class if-verbose (coq.say {header} "start module" Module), log.coq.env.begin-module Module none, private.declare-class+structure MLwP Sort ClassName Structure SortProjection ClassProjection Factories StructKeyClause, w-params.map MLwP (_\_\_\ mk-nil) NilwP, ClassAlias = (factory-alias->gref ClassName ClassName ok), CurrentClass = (class ClassName Structure MLwP), ClassName = indt ClassInd, coq.env.indt ClassInd _ _ _ _ [ClassK] _, GRDepsClauses = [gref-deps (indt ClassInd) NilwP, gref-deps (indc ClassK) MLwP], std.map ML (m\ o\ o = mixin-class m ClassName) MixinMems, std.filter ML (m\ not (mixin-first-class m _)) NewMixins, std.map NewMixins (m\ r\ r = mixin-first-class m ClassName) MixinFirstClass, if-verbose (coq.say {header} "structure: new mixins" NewMixins), if-verbose (coq.say {header} "structure: mixin first class" MixinFirstClass), if-verbose (coq.say {header} "declaring clone abbreviation"), w-params.then MLwP phant.fun-real phant.fun-real (private.clone-phant-body ClassName SortProjection Structure) PhClone, phant.add-abbreviation "clone" PhClone _ _, if-verbose (coq.say {header} "declaring pack_ constant"), (ClassAlias => class-def CurrentClass => GRDepsClauses => MixinMems => w-params.then MLwP mk-fun mk-fun (private.pack-body ClassName) Pack), if-verbose (coq.say {header} "declaring pack_ constant =" Pack), log.coq.env.add-const-noimplicits "pack_" Pack _ @transparent! ConstPack, GRPack = const ConstPack, if-arg-sort ( if-verbose (coq.say {header} "define arg_sort"), std.assert-ok! (coq.typecheck SortProjection SortProjTy) "HB: BUG: cannot retype projection", log.coq.env.add-const-noimplicits "arg_sort" SortProjection SortProjTy ff ArgSortCst ), if-verbose (coq.say {header} "start module Exports"), log.coq.env.begin-module "Exports" none, %(ClassAlias => class-def CurrentClass => % GRDepsClauses => MixinFirstClass => gref-deps GRPack MLwP => % phant.of-gref tt GRPack [] PhRepack), %if-verbose (coq.say {header} "declaring pack abbreviation =" PhRepack), % phant.add-abbreviation "pack" PhRepack _ PackAbbrev, if (get-option "short.type" ShortType) ( if-verbose (coq.say {header} "short name for type:" ShortType), (@global! => log.coq.notation.add-abbreviation ShortType 0 (global Structure) ff _)) true, coq.mk-app (global Structure) {coq.mk-n-holes {w-params.nparams MLwP}} HB_Instance, if (get-option "short.pack" ShortPack) (std.do! [ if-verbose (coq.say {header} "declaring pack abbreviation:" ShortPack), % coq.notation.abbreviation-body PackAbbrev NPackAbbrev PackAbbrevTrm, % @global! => log.coq.notation.add-abbreviation % ShortPack NPackAbbrev PackAbbrevTrm ff _ coq.notation.add-abbreviation-for-tactic ShortPack "HB.pack_for" [trm HB_Instance] ]) true, % (std.do! [ % PackAbbrevName is Module ^ ".pack", % if-verbose (coq.say {header} "declaring pack abbreviation:" PackAbbrevName), % coq.notation.add-abbreviation-for-tactic PackAbbrevName "HB.pack_for" [trm HB_Instance], %]), if-verbose (coq.say {header} "making coercion from type to target"), synthesis.infer-coercion-tgt MLwP CoeClass, if-arg-sort (private.declare-sort-coercion CoeClass Structure (global (const ArgSortCst))), private.declare-sort-coercion CoeClass Structure SortProjection, if-verbose (coq.say {header} "exporting unification hints"), ClassAlias => Factories => GRDepsClauses => private.declare-unification-hints SortProjection ClassProjection CurrentClass NewJoins, % Register in Elpi's DB the new structure % NOT TODO: All these acc are correctly locaed in an Export Module if (ClassName = indt ClassInd) (std.do![ if-verbose (coq.say {header} "exporting coercions from class to mixins"), std.forall {coq.env.projections ClassInd} (private.export-mixin-coercion ClassName) ]) (coq.say "declare:" ClassName "should be an inductive", fail), if-verbose (coq.say {header} "accumulating various props"), std.flatten [ Factories, [is-structure Structure], NewJoins, [class-def CurrentClass], GRDepsClauses, [gref-deps GRPack MLwP], MixinMems, [StructKeyClause] ] NewClauses, acc-clauses current NewClauses, if-verbose (coq.say {header} "stop module Exports"), log.coq.env.end-module-name "Exports" Exports, log.coq.env.import-module "Exports" Exports, if-verbose (coq.say {header} "declaring on_ abbreviation"), private.mk-infer-key CoeClass ClassProjection NilwP (global Structure) PhClass, phant.add-abbreviation "on_" PhClass _ ClassOfAbbrev, (pi c\ coq.notation.abbreviation ClassOfAbbrev [c] (ClassOfAbbrev_ c)), if-verbose (coq.say {header} "declaring `copy` abbreviation"), coq.mk-app (global ClassName) {params->holes NilwP} AppClassHoles, @global! => log.coq.notation.add-abbreviation "copy" 2 {{fun T C => (lp:(ClassOfAbbrev_ C) : (lp:AppClassHoles T)) }} tt _, if-verbose (coq.say {header} "declaring on abbreviation"), @global! => log.coq.notation.add-abbreviation "on" 1 {{fun T => (lp:{{ ClassOfAbbrev_ {{_}} }} : (lp:AppClassHoles T)) }} tt _OnAbbrev, log.coq.env.end-module-name Module ModulePath, if-verbose (coq.say {header} "end modules; export" Exports), export.module {calc (Module ^ ".Exports")} Exports, if-verbose (coq.say {header} "exporting operations"), ClassAlias => Factories => GRDepsClauses => private.export-operations Structure SortProjection ClassProjection MLwP [] EX MLToExport, % TODO: issue an Arguments op T : rename, where T is the name written by % the user in Definition foo := { T of ... } if-verbose (coq.say {header} "operations meta-data module: ElpiOperations"), ElpiOperationModName is {calc (Module ^ "ElpiOperations")}, log.coq.env.begin-module ElpiOperationModName none, acc-clauses current {std.append EX MixinFirstClass}, log.coq.env.end-module-name ElpiOperationModName ElpiOperations, export.module ElpiOperationModName ElpiOperations, if-verbose (coq.say {header} "abbreviation factory-by-classname"), ClassAlias => NewClauses => factory.declare-abbrev Module (factory.by-classname ClassName) ClassAbbrev, export.clause (phant-abbrev ClassName ClassName ClassAbbrev), NewClauses => if-MC-compat (private.mc-compat-structure Module ModulePath MLToExport {w-params.nparams MLwP} ClassProjection GRPack), % Automatic saturation disabled since it is expensive % NewClauses => instance.saturate-instances, ]. /* ------------------------------------------------------------------------- */ /* ----------------------------- private code ------------------------------ */ /* ------------------------------------------------------------------------- */ namespace private { shorten coq.{ term->gref, subst-fun, safe-dest-app, mk-app, mk-eta, subst-prod }. % const Po : forall p1 .. pm T m1 .. mn, Extra (Eg Extra = forall x y, x + y = y + z) % const C : forall p1 .. pm s, Extra % Po P1 .. PM T M1 .. MN PoArgs -> C P1 .. PM S PoArgs pred clean-op-ty i:list prop, i:term, i:term, o:term. clean-op-ty [] _ T1 T2 :- copy T1 T2. clean-op-ty [exported-op _ Po C|Ops] S T1 T2 :- gref-deps (const Po) MLwP, w-params.nparams MLwP NParams, std.length {list-w-params_list MLwP} NMixins, (pi L L1 L2 Params Rest PoArgs\ copy (app [global (const Po)| L]) (app [global (const C) | L2]) :- std.split-at NParams L Params [_|Rest], std.drop NMixins Rest PoArgs, std.append Params [S|PoArgs] L1, std.map L1 copy L2) => clean-op-ty Ops S T1 T2. pred operation-body-and-ty i:list prop, i:constant, i:structure, i:term, i:term, i:list term, i:term, i:w-args A, o:pair term term. operation-body-and-ty EXI Poperation Struct Psort Pclass Params _T (triple _ ParamsOp _) (pr Bo Ty) :- std.do! [ mk-app (global Struct) Params StructType, mk-app Psort Params PsortP, mk-app Pclass Params PclassP, Bo = fun `s` StructType Body, Ty = prod `s` StructType BodyTy, (@pi-decl `s` StructType s\ sigma Carrier Class\ std.do! [ mk-app PsortP [s] Carrier, mk-app PclassP [s] Class, synthesis.under-mixin-src-from-factory.do! Carrier Class [ % just in case.. synthesis.infer-all-gref-deps ParamsOp Carrier (const Poperation) (Body s), std.assert-ok! (coq.typecheck (Body s) (DirtyTy s)) "export-1-operation: Body illtyped", clean-op-ty EXI s (DirtyTy s) (BodyTy s), ], ]), ]. % given an operation (a mixin projection) we generate a constant projection the % same operation out of the package structure (out of the class field of the % structure). We also provide all the other mixin dependencies (other misins) % of the package structure. pred export-1-operation i:mixinname, i:structure, i:term, i:term, i:one-w-params mixinname, i:option constant, i:list prop, o:list prop. export-1-operation _ _ _ _ _ none EX EX :- !. % not a projection, no operation export-1-operation M Struct Psort Pclass MwP (some Poperation) EXI EXO :- !, std.do! [ coq.gref->id (const Poperation) Name, w-params.then MwP mk-fun-prod ignore (operation-body-and-ty EXI Poperation Struct Psort Pclass) (pr Body BodyTy), if-verbose (coq.say {header} "export operation" Name), log.coq.env.add-const-noimplicits Name Body BodyTy @transparent! C, w-params.nparams MwP NP, NImplicits is NP + 1, std.iota NImplicits INI, std.map INI (_\r\ r = maximal) Implicits, @global! => log.coq.arguments.set-implicit (const C) [Implicits], EXO = [exported-op M Poperation C|EXI] ]. % Given a list of mixins, it exports all operations in there pred export-operations.aux i:structure, i:term, i:term, i:one-w-params mixinname, i:list prop, o:list prop. export-operations.aux Struct ProjSort ProjClass MwP EX1 EX2 :- !, std.do! [ w-params_1 MwP (indt M), coq.env.projections M Poperations, std.fold Poperations EX1 (export-1-operation (indt M) Struct ProjSort ProjClass MwP) EX2, ]. pred mixin-not-already-declared i:one-w-params mixinname. mixin-not-already-declared MwP :- w-params_1 MwP M, not(mixin-first-class M _), M = indt _. pred export-operations i:structure, i:term, i:term, i:mixins, i:list prop, o:list prop, o:list mixinname. export-operations Structure ProjSort ProjClass MLwP EX1 EX2 MLToExport :- std.do! [ distribute-w-params MLwP LMwP, std.filter LMwP mixin-not-already-declared LMwPToExport, std.fold LMwPToExport EX1 (export-operations.aux Structure ProjSort ProjClass) EX2, std.map LMwPToExport w-params_1 MLToExport, ]. pred mk-coe-class-body i:factoryname, % From class i:factoryname, % To class i:mixins, % To mixins i:list term, i:term, % Params, T i:list (w-args mixinname), o:term. mk-coe-class-body FC TC TMLwP Params T _ CoeBody :- std.do! [ mk-app (global FC) {std.append Params [T]} Class, list-w-params_list TMLwP TML, std.map TML (from FC) Builders, std.map Builders (x\r\mk-app (global x) Params r) BuildersP, factory-nparams TC TCNP, mk-app (global {get-constructor TC}) {coq.mk-n-holes TCNP} KCHoles, (pi c\ sigma Mixes\ std.map BuildersP (builder\r\ r = app[builder, T, c]) Mixes, mk-app KCHoles [T | Mixes] (ClassCoercion c)), CoeBody = {{ fun (c : lp:Class) => lp:(ClassCoercion c) }} ]. pred mk-coe-structure-body i:structure, % From structure i:structure, % To structure i:factoryname, % To factory (for nparams) i:term, % class coercion i:term, % sort projection i:term, % class projection i:list term, i:term, % Params, T i:list (w-args mixinname), o:term. mk-coe-structure-body StructureF StructureT TC Coercion SortProjection ClassProjection Params _T _ SCoeBody :- std.do! [ mk-app (global StructureF) Params StructureP, mk-app SortProjection Params SortP, mk-app ClassProjection Params ClassP, mk-app Coercion Params CoercionP, factory-nparams TC TCNP, mk-app (global {get-constructor StructureT}) {coq.mk-n-holes TCNP} PackPH, SCoeBody = {{ fun s : lp:StructureP => (* let T := lp:SortP s in*) lp:PackPH (lp:SortP s) (lp:CoercionP (lp:SortP s) (lp:ClassP s)) }}, ]. % [declare-coercion P1 P2 C1 C2] declares a structure and a class coercion % from C1 to C2 given P1 P2 the two projections from the structure of C1 pred declare-coercion i:term, i:term, i:class, i:class. declare-coercion SortProjection ClassProjection (class FC StructureF FMLwP) (class TC StructureT TMLwP) :- std.do! [ gref->modname StructureF 2 "_" ModNameF, gref->modname StructureT 2 "_" ModNameT, CName is ModNameF ^ "_class__to__" ^ ModNameT ^ "_class", SName is ModNameF ^ "__to__" ^ ModNameT, if-verbose (coq.say {header} "declare coercion" SName), w-params.then FMLwP mk-fun mk-fun (mk-coe-class-body FC TC TMLwP) CoeBody, ErrorMessage is "The structures " ^ ModNameF ^ " and " ^ ModNameT ^ " are incompatible: the coercion between them cannot be synthesized", std.assert-ok! (coq.elaborate-skeleton CoeBody Ty CoeBody') ErrorMessage, if-verbose (coq.say {header} "declare coercion hint" CName), log.coq.env.add-const-noimplicits CName CoeBody' Ty @transparent! C, log.coq.coercion.declare (coercion (const C) 1 FC (grefclass TC)), Coercion = global (const C), w-params.then FMLwP mk-fun ignore (mk-coe-structure-body StructureF StructureT TC Coercion SortProjection ClassProjection) SCoeBody, ErrorMessage is "The structures " ^ ModNameF ^ " and " ^ ModNameT ^ " are incompatible: the coercion between them cannot be synthesized", std.assert-ok! (coq.elaborate-skeleton SCoeBody STy SCoeBody') ErrorMessage, if-verbose (coq.say {header} "declare unification hint" SName), log.coq.env.add-const-noimplicits SName SCoeBody' STy @transparent! SC, log.coq.coercion.declare (coercion (const SC) 0 StructureF (grefclass StructureT)), log.coq.CS.declare-instance SC, w-params.nparams FMLwP NparamsSC, acc-clause current (sub-class FC TC SC NparamsSC) ]. pred join-body i:int, i:int, i:structure, i:term, i:term, i:term, i:term, i:term, i:list term, i:name, i:term, i:(term -> A), o:term. join-body N1 N2 S3 S2_Pack S1_sort S3_to_S1 S2_class S3_to_S2 P N _Ty _F (fun N S3P Pack) :- !, mk-app (global S3) P S3P, !, @pi-decl N S3P s\ sigma S3_to_S1_Ps S3_to_S2_Ps S1_sortS3Ps S2_classS3Ps Holes1 Holes2 \ std.do! [ coq.mk-n-holes N2 Holes2, coq.mk-n-holes N1 Holes1, mk-app S3_to_S1 {std.append P [s]} S3_to_S1_Ps, mk-app S1_sort {std.append Holes1 [S3_to_S1_Ps]} S1_sortS3Ps, mk-app S3_to_S2 {std.append P [s]} S3_to_S2_Ps, mk-app S2_class {std.append Holes2 [S3_to_S2_Ps]} S2_classS3Ps , mk-app S2_Pack {std.append Holes2 [S1_sortS3Ps, S2_classS3Ps]} (Pack s) ]. pred declare-join i:class, i:pair class class, o:prop. declare-join (class C3 S3 MLwP3) (pr (class C1 S1 _) (class C2 S2 _)) (join C1 C2 C3) :- Name is "join_" ^ {gref->modname S3 2 "_"} ^ "_between_" ^ {gref->modname S1 2 "_"} ^ "_and_" ^ {gref->modname S2 2 "_"}, get-structure-coercion S3 S2 S3_to_S2, get-structure-coercion S3 S1 S3_to_S1, get-structure-sort-projection S1 S1_sort, get-structure-class-projection S2 S2_class, get-constructor S2 S2_Pack, factory-nparams C1 N1, factory-nparams C2 N2, if-verbose (coq.say {header} "declare unification hint" Name), w-params.fold MLwP3 mk-fun (join-body N1 N2 S3 (global S2_Pack) S1_sort S3_to_S1 S2_class S3_to_S2) JoinBody, std.assert-ok! (coq.typecheck JoinBody Ty) "declare-join: JoinBody illtyped", log.coq.env.add-const-noimplicits Name JoinBody Ty @transparent! J, log.coq.CS.declare-instance J. % TODO: this works under the invariant: we never have two classes that % contain exactly the same mixins. HB.structure should enforce this % and eventually just alias the existing one rather than failing. % TODO: HB.structure should check we are not inserting the class % in the middle of existing ones. Possible fix: always declare all intermediate % possibilities but without proper names (requires the previous TODO about % aliasing already existing stuff). pred declare-unification-hints i:term, i:term, i:class, o:list prop. declare-unification-hints SortProj ClassProj CurrentClass NewJoins :- std.do! [ findall-classes All, std.filter All (sub-class? CurrentClass) AllSuper, std.forall AllSuper (declare-coercion SortProj ClassProj CurrentClass), findall-newjoins CurrentClass AllSuper TodoJoins, std.map TodoJoins (declare-join CurrentClass) NewJoins ]. % For each mixin we declare a field and apply the mixin to its dependencies % (that are previously declared fields recorded via field-for-mixin) pred synthesize-fields i:term, i:list (w-args mixinname), o:record-decl. synthesize-fields _T [] end-record. synthesize-fields T [triple M Args _|ML] (field _ Name MTy Fields) :- std.do! [ Name is {gref->modname M 2 "_"} ^ "_mixin", if-verbose (coq.say {header} "typing class field" M), std.assert! (synthesis.infer-all-gref-deps Args T M MTy) "anomaly: a field type cannot be solved", @pi-decl `m` MTy m\ mixin-src T M m => synthesize-fields T ML (Fields m) ]. pred synthesize-fields.body i:list term, i:term, i:list (w-args mixinname), o:indt-decl. synthesize-fields.body _Params T ML (record "axioms_" {{ Type }} "Class" FS) :- synthesize-fields T ML FS. pred mk-record+sort-field i:sort, i:name, i:term, i:(term -> record-decl), o:indt-decl. mk-record+sort-field Sort _ T F (record "type" (sort Sort) "Pack" (field _ "sort" T F)). pred mk-class-field i:classname, i:list term, i:term, i:list (w-args mixinname), o:record-decl. mk-class-field ClassName Params T _ (field [canonical ff] "class" (app [global ClassName|Args]) _\end-record) :- std.append Params [T] Args. % Builds the axioms record and the factories from this class to each mixin pred declare-class+structure i:mixins, i:sort, o:factoryname, o:structure, o:term, o:term, o:list prop, o:prop. declare-class+structure MLwP Sort (indt ClassInd) (indt StructureInd) SortProjection ClassProjection AllFactories (structure-key SortP ClassP (indt StructureInd)):- std.do! [ if-verbose (coq.say {header} "declare axioms record"MLwP ), w-params.then MLwP (mk-parameter explicit) (mk-parameter explicit) synthesize-fields.body ClassDeclaration, std.assert-ok! (coq.typecheck-indt-decl ClassDeclaration) "declare-class: illtyped", (@primitive! => log.coq.env.add-indt ClassDeclaration ClassInd), coq.env.projections ClassInd Projs, % TODO: put this code in a named clause w-params.nparams MLwP NParams, std.map2 {list-w-params_list MLwP} Projs (m\ p\ r\ sigma P\ std.assert! (p = some P) "BUG: we build a class with an anonymous field", r = from (indt ClassInd) m (const P)) Factories, AllFactories = [factory-nparams (indt ClassInd) NParams | Factories], if-verbose (coq.say {header} "declare type record"), w-params.then MLwP (mk-parameter explicit) (mk-record+sort-field Sort) (mk-class-field (indt ClassInd)) StructureDeclaration, std.assert-ok! (coq.typecheck-indt-decl StructureDeclaration) "declare: illtyped", if (get-option "primitive" tt) (@primitive! => log.coq.env.add-indt StructureDeclaration StructureInd) (log.coq.env.add-indt StructureDeclaration StructureInd), coq.env.projections StructureInd [some SortP, some ClassP], global (const SortP) = SortProjection, global (const ClassP) = ClassProjection, ]. % Declares "sort" as a Coercion Proj : Structurename >-> CoeClass. pred declare-sort-coercion i:class, i:structure, i:term. declare-sort-coercion CoeClass StructureName (global Proj) :- if-verbose (coq.say {header} "declare sort coercion"), log.coq.coercion.declare (coercion Proj 0 StructureName CoeClass). pred if-class-already-exists-error i:id, i:list class, i:list mixinname. if-class-already-exists-error _ [] _. if-class-already-exists-error N [class _ S ML1wP|CS] ML2 :- list-w-params_list ML1wP ML1, if (std.list-eq-set ML1 ML2) (coq.error "Structure" {nice-gref->string S} "contains the same mixins as" N) (if-class-already-exists-error N CS ML2). pred export-mixin-coercion i:classname, i:option constant. export-mixin-coercion _ none. export-mixin-coercion ClassName (some C) :- coq.env.typeof (const C) CTy, coq.prod-tgt->gref CTy MixinGR, if-verbose (coq.say {header} "export class to mixin coercion for mixin" {nice-gref->string MixinGR}), log.coq.coercion.declare (coercion (const C) _ ClassName (grefclass MixinGR)). pred mc-compat-structure i:string, i:modpath, i:list mixinname, i:int, i:term, i:gref, i:option gref. mc-compat-structure ModuleName _Module NewMixins CNParams ClassProjection GRPack Axioms :- std.do! [ CompatModuleName is "MathCompCompat" ^ ModuleName, log.coq.env.begin-module CompatModuleName none, % to avoid collisions log.coq.env.begin-module ModuleName none, if (Axioms = some GR) (@global! => log.coq.notation.add-abbreviation "axiom" 0 (global GR) ff _) true, if (NewMixins = [NewMixin]) (std.do! [ if-verbose (coq.say "mc-compat-structure: declaring notations 'axioms', 'mixin_of' and 'Mixin'"), factory-nparams NewMixin NewMixinNP, MArgs is NewMixinNP + 1, mk-eta MArgs {coq.env.typeof NewMixin} (global NewMixin) EtaNewMixin, @global! => log.coq.notation.add-abbreviation "axioms" MArgs EtaNewMixin ff _, @deprecated! "mathcomp 2.0.0" "use the factory instead" => @global! => log.coq.notation.add-abbreviation "mixin_of" MArgs EtaNewMixin ff _, std.assert! (factory-constructor NewMixin FK) "BUG: Factory constructor missing", std.assert! (phant-abbrev FK _ PhAbb) "BUG: missing phant-abbrev", @deprecated! "mathcomp 2.0.0" "use the F.Build instead" => @global! => log.coq.notation.add-abbreviation "Mixin" 0 {coq.notation.abbreviation PhAbb {coq.mk-n-holes MArgs}} ff _, if-verbose (coq.say "mc-compat-structure: declaring pack abbreviation"), @deprecated! "mathcomp 2.0.0" "use native HB Structure.pack instead" => phant.add-abbreviation "mcpack" {phant.of-gref ff GRPack [NewMixin]} _ _, ]) (if-verbose (coq.say "mc-compat-structure: not exactly one new mixin")), if-verbose (coq.say "mc-compat-structure: declaring notation 'class_of'"), std.assert-ok! (coq.typecheck ClassProjection ClassProjectionTy) "wtf", CArgs is CNParams + 1, mk-eta CArgs ClassProjectionTy ClassProjection EtaClassProjection, @global! => log.coq.notation.add-abbreviation "class_of" CArgs EtaClassProjection ff _, log.coq.env.end-module-name ModuleName _, log.coq.env.end-module-name CompatModuleName MCCompat, log.coq.env.export-module CompatModuleName MCCompat, %coq.env.import-module Module, ]. pred clone-phant-body i:factoryname, i:term, i:structure, i:list term, i:term, i:list (w-args mixinname), o:phant-term. clone-phant-body ClassName SortProjection ((indt I) as Structure) PL T _ PhF :- std.do! [ std.assert! (coq.env.indt I _ _ _ _ [PackC] _) "wtf", mk-app (global (indc PackC)) {std.append PL [T]} PackPLT, mk-app (global Structure) PL SPL, (@pi-decl `cT` SPL cT\ mk-app (global ClassName) {std.append PL [T]} CPL, @pi-decl `c` CPL c\ (Ph cT c) = {phant.fun-unify none T {mk-app {mk-app SortProjection PL} [cT]} {phant.fun-unify none cT {mk-app PackPLT [c]} {phant.init {mk-app PackPLT [c]}} }}), PhF = {phant.fun-real `cT` SPL cT\ {phant.fun-implicit `c` CPL c\ Ph cT c }} ]. % [pack-body ClassName P T MLwA B] asserts % B = fun m0 ... mn => Pack P T (Class P T m0 ... mn) % under a context with P and T pred pack-body i:classname, i:list term, i:term, i:list (w-args mixinname), o:term. pack-body ClassName PL T MLwA F :- std.do! [ class-def (class ClassName S _), get-constructor ClassName BuildC, get-constructor S PackS, synthesis.under-mixins.then MLwA mk-fun (pack-body.aux PL T BuildC PackS) F, ]. pack-body.aux PL T BuildC PackS Body :- !, std.do! [ synthesis.infer-all-gref-deps PL T BuildC Class, mk-app (global PackS) {std.append PL [T, Class]} Body ]. pred mk-infer-key i:class, i:term, i:mixins, i:term, o:phant-term. mk-infer-key CoeClass K (w-params.nil ID _ _) St PhK :- @pi-parameter ID St t\ phant.init {mk-app K [t]} (PhKBo t), phant.fun-infer-type CoeClass {coq.id->name ID} St PhKBo PhK. mk-infer-key CoeClass K (w-params.cons ID Ty W) St R :- @pi-parameter ID Ty t\ mk-infer-key CoeClass {mk-app K [t]} (W t) {mk-app St [t]} (PhT t), phant.fun-implicit {coq.id->name ID} Ty PhT R. pred if-coverage-not-good-error i:list mixinname. if-coverage-not-good-error ML :- coq.gref.list->set ML MS, std.forall ML (if-coverage-not-good-error.one MS). pred if-coverage-not-good-error.one i:coq.gref.set, i:mixinname. if-coverage-not-good-error.one MS M :- mixin-first-class M C, !, class-coverage [C] CMS, if (coq.gref.set.subset CMS MS) true (coq.gref.set.elements {coq.gref.set.remove M CMS} MissinFromCurrent, coq.error "HB: the first structure declared in this hierarchy containing" {nice-gref->string M} "is" {nice-gref->string C} "which also contains" {std.map MissinFromCurrent nice-gref->string} "." "\nThe are two ways to fix this problem:" "1) change the current structure to contain" {std.map MissinFromCurrent nice-gref->string} "as well;" "2) amend the hierarchy by declaring a structure before" {nice-gref->string C} "which contains at most" {std.map {coq.gref.set.elements {coq.gref.set.inter CMS MS}} nice-gref->string}). if-coverage-not-good-error.one _ _. % new class is the first covering M pred product->triples i:term, o:list (w-args factoryname), o:bool. product->triples {{ lib:hb.prod lp:A lp:B }} L ClosureCheck :- !, product->triples B GRB ClosureCheck, product->triples A GRA _, std.append GRA GRB L. product->triples {{ True }} [] tt :- !. product->triples {{ False }} [] ff :- !. product->triples A [GR] tt :- std.assert! (factory? A GR) "A structure can only mention known factories". pred sigT->list-w-params i:term, o:list-w-params factoryname, o:bool. sigT->list-w-params (fun N T B) L C :- coq.name->id N ID, % TODO: we should read the ID from the definition type which is an arity containing ids L = w-params.cons ID T Rest, @pi-decl N T p\ sigT->list-w-params (B p) (Rest p) C. sigT->list-w-params {{ lib:@hb.sigT _ lp:{{ fun N Ty B }} }} L C :- coq.name->id N ID, % TODO: we should read the ID from the definition type which is an arity containing ids L = w-params.nil ID Ty Rest, @pi-decl N Ty t\ product->triples (B t) (Rest t) C. }} hierarchy-builder-1.8.1/HB/structures.v000066400000000000000000001402361474513043100200360ustar00rootroot00000000000000(* Support constants, to be kept in sync with shim/structures.v *) From Coq Require Import String ssreflect ssrfun. Export String.StringSyntax. Variant error_msg := NoMsg | IsNotCanonicallyA (x : Type). Definition unify T1 T2 (t1 : T1) (t2 : T2) (s : error_msg) := phantom T1 t1 -> phantom T2 t2. Definition id_phant {T} {t : T} (x : phantom T t) := x. Definition id_phant_disabled {T T'} {t : T} {t' : T'} (x : phantom T t) := Phantom T' t'. Definition nomsg : error_msg := NoMsg. Definition is_not_canonically_a x := IsNotCanonicallyA x. Definition new {T} (x : T) := x. Definition eta {T} (x : T) := x. Definition ignore {T} (x: T) := x. Definition ignore_disabled {T T'} (x : T) (x' : T') := x'. (* ********************* structures ****************************** *) From elpi Require Import elpi. Register unify as hb.unify. Register id_phant as hb.id. Register id_phant_disabled as hb.id_disabled. Register ignore as hb.ignore. Register ignore_disabled as hb.ignore_disabled. Register Coq.Init.Datatypes.None as hb.none. Register nomsg as hb.nomsg. Register is_not_canonically_a as hb.not_a_msg. Register Coq.Init.Datatypes.Some as hb.some. Register Coq.Init.Datatypes.pair as hb.pair. Register Coq.Init.Datatypes.prod as hb.prod. Register Coq.Init.Specif.sigT as hb.sigT. Register Coq.ssr.ssreflect.phant as hb.phant. Register Coq.ssr.ssreflect.Phant as hb.Phant. Register Coq.ssr.ssreflect.phantom as hb.phantom. Register Coq.ssr.ssreflect.Phantom as hb.Phantom. Register Coq.Init.Logic.eq as hb.eq. Register Coq.Init.Logic.eq_refl as hb.erefl. Register new as hb.new. Register eta as hb.eta. #[deprecated(since="HB 1.0.1", note="use #[key=...] instead")] Notation indexed T := T (only parsing). Declare Scope HB_scope. Notation "{ A 'of' P & .. & Q }" := (sigT (fun A => (prod P .. (prod Q True) ..)%type)) (at level 0, A at level 99) : HB_scope. Notation "{ A 'of' P & .. & Q & }" := (sigT (fun A => (prod P .. (prod Q False) ..)%type)) (at level 0, A at level 99) : HB_scope. Global Open Scope HB_scope. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** This data represents the hierarchy and some other piece of state to implement the commands of this file *) #[interp] Elpi Db hb.db lp:{{ typeabbrev mixinname gref. typeabbrev classname gref. typeabbrev factoryname gref. typeabbrev structure gref. typeabbrev (w-args A) (triple A (list term) term). kind w-params type -> type. type w-params.cons id -> term -> (term -> w-params A) -> w-params A. type w-params.nil id -> term -> (term -> A) -> w-params A. typeabbrev (list-w-params A) (w-params (list (w-args A))). typeabbrev (one-w-params A) (w-params (w-args A)). typeabbrev mixins (list-w-params mixinname). typeabbrev factories (list-w-params mixinname). typeabbrev (w-mixins A) (pair mixins (w-params A)). %%%%% Classes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (class C S ML) represents a class C packed in S containing mixins ML. % Example: % % HB.mixin Record IsZmodule V := { ... } % HB.mixin Record Zmodule_IsLmodule (R : ringType) V of Zmodule V := { ... } % HB.structure Definition Lmodule R := {M of Zmodule M & Zmodule_IsLmodule R M} % % The class description for Lmodule would be: % % class (indt «Lmodule.axioms») /* The record with all mixins */ % (indt «Lmodule.type») /* The record with sort and class */ % (w-params.cons "R" {{ Ring.type }} P \ /* The first parameter, named "R" */ % w-params.nil "M" {{ Type }} T \ /* The key of the structure */ % [..., /* deps of IsZmodule.mixin */ % triple (indt «IsZmodule.mixin») [] T, /* a mixins with its params */ % triple (indt «Zmodule_IsLmodule.mixin») [P] T ]) /* another mixins */ % % If some mixin parameters depend on other mixins (through a canonical instance that % can be inferred from them). Since our structure does not account for dependencies % between mixins (the list in the end is flat), we compensate by replacing canonical % instances by calls to `S.Pack T {{lib:elpi.hole}}`, and extending the reconstruction % mecanism of mixins to also reinfer these holes. kind class type. type class classname -> structure -> mixins -> class. % class-def contains all the classes ever declared pred class-def o:class. %%%%% Builders %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [from FN MN F] invariant: % "F : forall p1 .. pn T LMN, FN p1 .. pn T LMN1 -> MN c1 .. cm T LMN2" where % - LMN1 and LMN2 are sub lists of LMN % - c1 .. cm are terms built using p1 .. pn and T % - [factory-requires FN LMN] % [from _ M _] tests whether M is a declared mixin. pred from o:factoryname, o:mixinname, o:gref. %%%%% Abbreviations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [phant-abbrev Cst AbbrevCst Abbrev] % Stores phantom abbreviation Abbrev associated with Cst % AbbrevCst is the constant that serves as support % e.g. Definition AbbrevCst := fun t1 t2 (phant_id t1 t2) => Cst t2. % Notation Abbrev t1 := (AbbrevCst t1 _ idfun). pred phant-abbrev o:gref, o:gref, o:abbreviation. % [factory-alias->gref X GR] when X is already a factory X = GR % however, when X is a phantom abbreviated gref, we find the underlying % factory gref GR associated to it. pred factory-alias->gref i:gref, o:gref, o: diagnostic. factory-alias->gref PhGR GR ok :- phant-abbrev GR PhGR _, !. factory-alias->gref GR GR ok :- phant-abbrev GR _ _, !. factory-alias->gref GR _ (error Msg) :- !, Msg is {coq.term->string (global GR)} ^ " is not a factory or its library (" ^ { std.string.concat "." {std.drop-last 1 {coq.gref->path GR} } } ^ ") was not correctly imported". %%%%% Cache of known facts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [factory-constructor F K] means K is a constructor for % the factory F. pred factory-constructor o:factoryname, o:gref. % [factory-nparams F N] says that F has N parameters pred factory-nparams o:factoryname, o:int. % [is-structure GR] tests if GR is a known structure pred is-structure o:gref. % [factory-builder-nparams Build N] states that when the user writes % the [F.Build T] abbreviation the term behind it has N arguments before T pred factory-builder-nparams o:constant, o:int. % [sub-class C1 C2 Coercion12 NparamsCoercion] C1 is a sub-class of C2, % see also sub-class? which computes it on the fly :index (2 2 1) pred sub-class o:classname, o:classname, o:constant, o:int. % [gref-deps GR MLwP] is a (pre computed) list of dependencies of a know global % constant. The list is topologically sorted :index(2) pred gref-deps o:gref, o:mixins. % [join C1 C2 C3] means that C3 inherits from both C1 and C2 pred join o:classname, o:classname, o:classname. % Section local memory of names for mixins, so that we can reuse them % and build terms with simpler conversion problems (less unfolding % in order to discover two mixins are the same) pred mixin-mem i:term, o:gref. %%%%%% Memory of exported mixins (HB.structure) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Operations (named mixin fields) need to be exported exactly once, % but the same mixin can be used in many structure, hence this memory % to keep the invariant. % Also we remember which is the first class/structure that includes % a given mixin, assuming the invariant that this first class is also % the minimal class that includes this mixin. % [mixin-first-class M C] states that C is the first/minimal class % that contains the mixin M pred mixin-first-class o:mixinname, o:classname. % memory of exported operations (TODO: document fiels) pred exported-op o:mixinname, o:constant, o:constant. % memory of factory sort coercion pred factory-sort o:coercion. % memory of canonical projections for a structure (X.sort, X.class, X.type) pred structure-key o:constant, o:constant, o:structure. %%%%%% Membership of mixins to a class %%%%%%%%%%%%%%%% % [mixin-class M C] means M belongs to C pred mixin-class o:mixinname, o:classname. %% database for HB.context %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [mixin-src T M X] states that X can be used to reconstruct % an instance of the mixin [M T …], directly or through a builder. % Since HB.builders sections can declare canonical instances of % mixins that do not yet form a structure, we cannot resort to % Coq's CS database (which is just for structures). pred mixin-src o:term, o:mixinname, o:term. % [has-mixin-instance K M G] states that G is a reference to an instance % of mixin M for subject K pred has-mixin-instance o:cs-pattern, o:mixinname, o:gref. %% database for HB.builders %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [builder N TheFactory TheMixin S] is used to % remember that the user run [HB.instance S] hence [HB.end] has to % synthesize builders from TheFactory to TheMixin mixins generated by S. % N is a timestamp. kind builder type. type builder int -> factoryname -> mixinname -> gref -> builder. pred builder-decl o:builder. %% database for builder-local canonical instances %%%%%%%%%%%%%%%%%%%%%%% pred local-canonical o:constant. % To tell HB.end what we are doing kind declaration type. % TheType, TheFactory and it's name and the name of the module encloding all that type builder-from term -> term -> factoryname -> id -> declaration. type no-builder declaration. pred current-mode o:declaration. %% database for HB.export / HB.reexport %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % library, nice-name, object pred module-to-export o:string, o:id, o:modpath. pred instance-to-export o:string, o:id, o:constant. pred abbrev-to-export o:string, o:id, o:gref. pred clause-to-export o:string, o:prop. %% database for HB.locate and HB.about %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pred decl-location o:gref, o:loc. % [docstring Loc Doc] links a location in the source text and some doc pred docstring o:loc, o:string. }}. (* This database is used by the parsing phase only *) #[synterp] Elpi Db export.db lp:{{ pred module-to-export o:string, o:modpath. }}. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** This is like Locate but tells you the file and line at which the constant or inductive was generated. *) #[arguments(raw)] Elpi Command HB.locate. Elpi Accumulate Db hb.db. (* Since it can become rather large, accumulating the DB is often by far the most expensive accumulation. It is then worth sharing its cache between the commands. To this end, we accumulate the DB first in each command to ensure the same dependencies and maximize cache hits. For instance, this can save a few (2 or 3) percents of total compilation time on MathComp. *) Elpi Accumulate lp:{{ :name "start" main [str S] :- !, if (decl-location {coq.locate S} Loc) (coq.say "HB: synthesized in file" Loc) (coq.say "HB" S "not synthesized by HB"). main _ :- coq.error "Usage: HB.locate .". }}. Elpi Typecheck. Elpi Export HB.locate. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** This is like About but understands HB generated stuff, namely - structures, eg Foo.type - classes, eg Foo - factories, eg Bar - factory constructors, eg Bar.Build - canonical projections, eg Foo.sort - canonical value, eg Z, prod, ... *) #[arguments(raw)] Elpi Command HB.about. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". Elpi Accumulate File "HB/common/log.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/about.elpi". Elpi Accumulate lp:{{ :name "start" main [str S] :- !, with-attributes (with-logging (about.main S)). main _ :- coq.error "Usage: HB.about .". }}. Elpi Typecheck. Elpi Export HB.about. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.howto (T) Foo.type d] prints possible sequences of factories to equip a type [T] with a structure [Foo.type], taking into account structures already instantiated on [T]. The search depth [d] is the maximum length of the sequences, 3 by default. The first argument [T] is optional, when ommited [Foo.type] is built from scratch. Finally, the first argument can be another structure [Bar.type], in which case [Foo.type] is built starting from [Bar.type]. *) #[arguments(raw)] Elpi Command HB.howto. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/about.elpi". Elpi Accumulate File "HB/howto.elpi". Elpi Accumulate lp:{{ :name "start" main [trm T, str STgt] :- !, with-attributes (with-logging (howto.main-trm T STgt none)). main [trm T, str STgt, int Depth] :- !, with-attributes (with-logging (howto.main-trm T STgt (some Depth))). main [str T, str STgt] :- !, with-attributes (with-logging (howto.main-str T STgt none)). main [str T, str STgt, int Depth] :- !, with-attributes (with-logging (howto.main-str T STgt (some Depth))). main [str STgt] :- !, with-attributes (with-logging (howto.main-from [] STgt none)). main [str STgt, int Depth] :- !, with-attributes (with-logging (howto.main-from [] STgt (some Depth))). main _ :- coq.error "Usage: HB.howto [()|] [].". }}. Elpi Typecheck. Elpi Export HB.howto. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** This command prints the status of the hierarchy (Debug) *) #[arguments(raw)] Elpi Command HB.status. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". Elpi Accumulate File "HB/common/log.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/status.elpi". Elpi Accumulate lp:{{ :name "start" main [] :- !, status.print-hierarchy. main _ :- coq.error "Usage: HB.status.". }}. Elpi Typecheck. Elpi Export HB.status. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** This command prints the hierarchy to a dot file. You can use [[ tred file.dot | xdot - ]] to visualize file.dot *) #[arguments(raw)] Elpi Command HB.graph. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/graph.elpi". Elpi Accumulate lp:{{ :name "start" main [str File] :- with-attributes (with-logging (graph.to-file File)). main _ :- coq.error "Usage: HB.graph .". }}. Elpi Typecheck. Elpi Export HB.graph. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.mixin] declares a mixin Syntax to create a mixin [MixinName] with requirements [Factory1] .. [FactoryN]: [[ HB.mixin Record MixinName T of Factory1 T & … & FactoryN T := { op : T -> … … property : forall x : T, op … … } ]] Synthesizes: - [MixinName T] abbreviation for the type of the (degenerate) factory - [MixinName.Build T] abbreviation for the constructor of the factory Note: [T of f1 T & … & fN T] is ssreflect syntax for [T (_ : f1 T) … (_ : fN T)] Supported attributes: - [#[primitive]] experimental attribute to make the mixin/factory primitive, - [#[verbose]] for a verbose output. *) #[arguments(raw)] Elpi Command HB.mixin. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/common/phant-abbreviation.elpi". Elpi Accumulate File "HB/instance.elpi". Elpi Accumulate File "HB/context.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate File "HB/factory.elpi". Elpi Accumulate lp:{{ :name "start" main [A] :- with-attributes (with-logging (factory.declare-mixin A)). }}. #[synterp] Elpi Accumulate File "HB/common/utils-synterp.elpi". #[synterp] Elpi Accumulate Db export.db. #[synterp] Elpi Accumulate lp:{{ shorten coq.env.{ begin-module, end-module, begin-section, end-section, export-module }. pred actions i:id. actions N :- begin-module N none, begin-section N, end-section, begin-module "Exports" none, end-module E, end-module _, export-module E, coq.env.current-library File, coq.elpi.accumulate current "export.db" (clause _ _ (module-to-export File E)). main [indt-decl D] :- record-decl->id D N, with-attributes (actions N). main _ :- coq.error "Usage: HB.mixin Record T of F A & … := { … }.". }}. Elpi Typecheck. Elpi Export HB.mixin. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.pack] and [HB.pack_for] are tactic-in-term synthesizing a structure instance. In the middle of a term, in a context expecting a [Structure.type], you can write [HB.pack T F] to use factory [F] to equip type [T] with [Structure]. If [T] is already a rich type, eg [T : OtherStructure.type] or if [T] is a global constant with canonical structure instances attached to it, then this piece of info is used to infer a [Structure]. If the context does not impose a [Structure.type] typing constraint, then you can use [HB.pack_for Structure.type T F]. You can pass zero or more factories like [F] but they must all typecheck in the current context (the type is not enriched progressively). Structure instances are projected to their class in order to obtain a factory. Examples: [[ pose Fa : IsSomething T := IsSomething.Build T ... pose A : A.type := HB.pack T Fa. pose Fb : IsMore A := IsMore.Build ... pose B := HB.pack_for B.type T A Fb. ]] If [Structure.type] as parameters [P1..Pn] then you should use [HB.pack T F1..Fn] or [HB.pack_for (Structure.type P1..Pn) T F1..Fn] *) Elpi Tactic HB.pack_for. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/pack.elpi". Elpi Accumulate lp:{{ :name "start" solve (goal _ _ S _ [trm Ty | Args] as G) GLS :- with-attributes (with-logging (std.do! [ pack.main Ty Args InstanceSkel, std.assert-ok! (coq.elaborate-skeleton InstanceSkel S Instance) "HB.pack_for: the instance does not solve the goal", log.refine.no_check Instance G GLS, ])). }}. Elpi Typecheck. Elpi Export HB.pack_for. Elpi Tactic HB.pack. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/pack.elpi". Elpi Accumulate lp:{{ :name "start" solve (goal _ _ Ty _ Args as G) GLS :- with-attributes (with-logging (std.do! [ pack.main Ty Args InstanceSkel, std.assert-ok! (coq.elaborate-skeleton InstanceSkel Ty Instance) "HB.pack: the instance does not solve the goal", log.refine.no_check Instance G GLS, ])). }}. Elpi Typecheck. Elpi Export HB.pack. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.structure] declares a packed structure. Syntax to declare a structure combing the axioms from [Factory1] … [FactoryN]. The second syntax has a trailing [&] to pull in factory requirements silently. [[ HB.structure Definition StructureName params := { A of Factory1 … A & … & FactoryN … A }. HB.structure Definition StructureName params := { A of Factory1 … A & … & FactoryN … A & }. ]] Synthesizes: - [StructureName A] the type of the class that regroups all the factories [Factory1 … A] … [FactoryN … A]. - [StructureName.type params] the structure type that packs together [A] and its class. - [StructureName.sort params] the first projection of the previous structure, - [StructureName.clone params T cT] a legacy repackaging function that eta expands the canonical [StructureName.type] of [T], using [cT] if provided. - [StructureName.class sT : StructureName sT] projects out the class of [sT : StructureName.type params], - [StructureName.copy T T' : StructureName T] returns the class of the canonical [StructureName.type] of [T], and gives it the type [Structure T]. It is thus ready to use in combination with HB.instance, as in [[ (* Cloning a structure from another one, given by the user *) HB.instance Definition _ := StructureName.copy T cT. ]] - [StructureName.on T : StructureName T] infers the class of the canonical [StructureName.type] of [T]. This is a shortcut for [StructureName.Copy T T], and it will succeeds if a reduction of [T] is canonically a [StructureName.type]. Disclaimer: any function other that the ones described above, including pattern matching (using Gallina [match], [let] or tactics ([case], [elim], etc)) is an internal and must not be relied upon. Also hand-crafted [Canonical] declarations of such structures will break the hierarchy. Use [HB.instance] instead. Supported attributes: - [#[mathcomp]] attempts to generate a backward compatibility layer with mathcomp: trying to infer the right [StructureName.pack], - [#[arg_sort]] defines an alias [StructureName.arg_sort] for [StructureName.sort], and declares it as the main coercion. [StructureName.sort] is still declared as a coercion but the only reason is to make sure Coq does not print it. Cf ##[fingroup.v]##. - [#[short(type="shortName")]] produces the abbreviation [shortName] for [Structure.type] - [#[short(pack="shortName")]] produces the abbreviation [shortName] for [HB.pack_for Structure.type] - [#[primitive]] experimental attribute to make the structure a primitive record, - [#[verbose]] for a verbose output. *) #[arguments(raw)] Elpi Command HB.structure. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/common/phant-abbreviation.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate File "HB/instance.elpi". Elpi Accumulate File "HB/context.elpi". Elpi Accumulate File "HB/factory.elpi". Elpi Accumulate File "HB/structure.elpi". Elpi Accumulate lp:{{ :name "start" main [const-decl N (some B) Arity] :- std.do! [ % compute the universe for the structure (default ) prod-last {coq.arity->term Arity} Ty, if (ground_term Ty) (Sort = Ty) (Sort = {{Type}}), sort Univ = Sort, with-attributes (with-logging (structure.declare N B Univ)), ]. }}. #[synterp] Elpi Accumulate File "HB/common/utils-synterp.elpi". #[synterp] Elpi Accumulate Db export.db. #[synterp] Elpi Accumulate lp:{{ shorten coq.env.{ begin-module, end-module, begin-section, end-section, import-module, export-module }. pred actions i:id. actions N :- begin-module N none, begin-module "Exports" none, end-module E, import-module E, end-module _, export-module E, begin-module {calc (N ^ "ElpiOperations")} none, end-module O, export-module O, coq.env.current-library File, coq.elpi.accumulate current "export.db" (clause _ _ (module-to-export File E)), coq.elpi.accumulate current "export.db" (clause _ _ (module-to-export File O)), if (get-option "mathcomp" tt ; get-option "mathcomp.axiom" _) (actions-compat N) true. pred actions-compat i:id. actions-compat ModuleName :- CompatModuleName is "MathCompCompat" ^ ModuleName, begin-module CompatModuleName none, begin-module ModuleName none, end-module _, end-module O, export-module O, % is this a bug? % coq.env.current-library File, % coq.elpi.accumulate current "export.db" (clause _ _ (module-to-export File O)). true. main [const-decl N _ _] :- !, with-attributes (actions N). main _ :- coq.error "Usage: HB.structure Definition := { A of A & … & A }". }}. Elpi Typecheck. Elpi Export HB.structure. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* [HB.saturate [key]] saturates all instances (of all known keys, if key is not given) w.r.t. the current hierarchy. When two (unrelated) files are imported it might be that the instances declared in one file are sufficient to instantiate structures declared in the other file. This command reconsiders all types with a canonical structure instance and see if the they are also equipped with new ones. *) #[arguments(raw)] Elpi Command HB.saturate. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/common/phant-abbreviation.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate File "HB/instance.elpi". Elpi Accumulate File "HB/context.elpi". Elpi Accumulate File "HB/factory.elpi". Elpi Accumulate lp:{{ main [] :- !, with-attributes (with-logging (instance.saturate-instances _)). main [str "Type"] :- !, with-attributes (with-logging (instance.saturate-instances (cs-sort _))). main [str K] :- !, coq.locate K GR, with-attributes (with-logging (instance.saturate-instances (cs-gref GR))). main [trm T] :- !, term->cs-pattern T P, with-attributes (with-logging (instance.saturate-instances P)). main _ :- coq.error "Usage: HB.saturate [key]". }}. Elpi Typecheck. Elpi Export HB.saturate. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.instance] associates to a type all the structures that can be obtained from the provided factory inhabitant. Syntax for declaring a canonical instance: [[ HB.instance Definition N Params := Factory.Build Params T … ]] Supported attributes: - [#[export]] to flag the instance so that it is redeclared by [#[HB.reexport]] - [#[local]] to indicate that the instance should not survive the section. - [#[non_forgetful_inheritance]] allows non forgetful inheritance, i.e. inheritance via an instance declaration rather than via dependencies. See tests/non_forgetful_inheritance.v and "Competing inheritance paths in dependent type theory" (https://hal.inria.fr/hal-02463336) - [#[verbose]] for a verbose output. - [#[hnf] to compute the head normal form of CS instances before declaring them *) #[arguments(raw)] Elpi Command HB.instance. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/context.elpi". Elpi Accumulate File "HB/instance.elpi". Elpi Accumulate lp:{{ :name "start" main [const-decl Name (some BodySkel) TyWPSkel] :- !, with-attributes (with-logging (instance.declare-const Name BodySkel TyWPSkel _ _)). main [T0, F0] :- !, coq.warning "HB" "HB.deprecated" "The syntax \"HB.instance Key FactoryInstance\" is deprecated, use \"HB.instance Definition\" instead", with-attributes (with-logging (instance.declare-existing T0 F0)). }}. #[synterp] Elpi Accumulate lp:{{ shorten coq.env.{ begin-section, end-section }. main [const-decl _ _ (arity _)] :- !. main [const-decl _ _ (parameter _ _ _ _)] :- !, SectionName is "hb_instance_" ^ {std.any->string {new_int} }, begin-section SectionName, end-section. main [_, _] :- !. main _ :- coq.error "Usage: HB.instance Definition := T ...". }}. Elpi Typecheck. Elpi Export HB.instance. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.factory] declares a factory. It has the same syntax of [HB.mixin] *) #[arguments(raw)] Elpi Command HB.factory. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/common/phant-abbreviation.elpi". Elpi Accumulate File "HB/instance.elpi". Elpi Accumulate File "HB/context.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate File "HB/factory.elpi". Elpi Accumulate lp:{{ :name "start" main [A] :- with-attributes (with-logging (factory.declare A)). }}. #[synterp] Elpi Accumulate File "HB/common/utils-synterp.elpi". #[synterp] Elpi Accumulate Db export.db. #[synterp] Elpi Accumulate lp:{{ shorten coq.env.{ begin-module, end-module, begin-section, end-section, export-module }. pred actions i:id. actions N :- begin-module N none, begin-section N, end-section, begin-module "Exports" none, end-module E, end-module _, export-module E, coq.env.current-library File, coq.elpi.accumulate current "export.db" (clause _ _ (module-to-export File E)). main [indt-decl D] :- record-decl->id D N, with-attributes (actions N). main [const-decl N _ _] :- with-attributes (actions N). main _ :- coq.error "Usage: HB.factory Record T of F A & … := { … }.\nUsage: HB.factory Definition T of F A := t.". }}. Elpi Typecheck. Elpi Export HB.factory. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.builders] starts a section to declare the builders associated to a factory. [HB.end] ends that section. Syntax to declare builders for factory [Factory]: [[ HB.builders Context A (f : Factory A). … HB.instance A someFactoryInstance. … HB.end. ]] [HB.builders] starts a section (inside a module of unspecified name) where: - [A] is a type variable - all the requirements of [Factory] were postulated as variables - [f] is variable of type [Factory A] - all classes whose requirements can be obtained from [Factory] are declared canonical on [A] - for each operation [op] and property [prop] (named fields) of [Factory A] a [Notation] named [op] and [property] for the partial application of [op] and [property] to the variable [f] The former [op] and [property] are aliased [Super.op] and [Super.property] [HB.end] ends the section and closes the module and synthesizes - for each structure inhabited via [HB.instance] it defined all builders to known mixins Supported attributes: - [#[verbose]] for a verbose output. *) #[arguments(raw)] Elpi Command HB.builders. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/common/phant-abbreviation.elpi". Elpi Accumulate File "HB/instance.elpi". Elpi Accumulate File "HB/context.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate File "HB/factory.elpi". Elpi Accumulate File "HB/builders.elpi". Elpi Accumulate lp:{{ :name "start" main [ctx-decl C] :- with-attributes (with-logging (builders.begin C)). }}. #[synterp] Elpi Accumulate File "HB/common/utils-synterp.elpi". #[synterp] Elpi Accumulate lp:{{ shorten coq.env.{ begin-module, end-module, begin-section }. pred actions i:id. actions N :- begin-module N none, begin-module "Super" none, end-module _, begin-section N. main [ctx-decl _] :- !, with-attributes (actions {calc ("Builders_" ^ {std.any->string {new_int} })}). main _ :- coq.error "Usage: HB.builders Context A (f : F1 A).". }}. Elpi Typecheck. Elpi Export HB.builders. #[arguments(raw)] Elpi Command HB.end. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/instance.elpi". Elpi Accumulate File "HB/context.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate File "HB/builders.elpi". Elpi Accumulate lp:{{ :name "start" main [] :- with-attributes (with-logging builders.end). }}. #[synterp] Elpi Accumulate File "HB/common/utils-synterp.elpi". #[synterp] Elpi Accumulate Db export.db. #[synterp] Elpi Accumulate lp:{{ shorten coq.env.{ end-module, end-section, begin-module, end-module, export-module }. pred actions. actions :- end-section, begin-module {calc ("Builders_Export_" ^ {std.any->string {new_int} })} none, end-module M, end-module _, export-module M, coq.env.current-library File, coq.elpi.accumulate current "export.db" (clause _ _ (module-to-export File M)). main [] :- !, with-attributes actions. main _ :- coq.error "Usage: HB.end.". }}. Elpi Typecheck. Elpi Export HB.end. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.export Modname] does the work of [Export Modname] but also schedules [Modname] to be exported later on, when [HB.reexport] is called. [HB.export Constname] does nothing, but schedules [Constname] to be made available via a Notation at HB.reexport time. Note that the list of things to be exported is stored in the current module, hence the recommended way to do is [[ Module Algebra. HB.mixin .... HB.structure ... Module MoreExports. ... End MoreExports. HB.export MoreExports. ... HB.builders ... Lemma aux_fact : .... HB.export aux_fact. ... HB.end. ... Module Export. HB.reexport. End Exports. End Algebra. Export Algebra.Exports. ]] Supported attributes: - [#[verbose]] for a verbose output. *) #[arguments(raw)] Elpi Command HB.export. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate lp:{{ :name "start" main [str M] :- !, with-attributes (with-logging (export.any M)). main _ :- coq.error "Usage: HB.export M.". }}. #[synterp] Elpi Accumulate File "HB/common/utils-synterp.elpi". #[synterp] Elpi Accumulate Db export.db. #[synterp] Elpi Accumulate lp:{{ shorten coq.env.{ export-module }. pred actions i:list located. actions [loc-modpath MP] :- !, export-module MP, coq.env.current-library File, coq.elpi.accumulate current "export.db" (clause _ _ (module-to-export File MP)). actions []. main [str M] :- !, with-attributes (actions {coq.locate-all M}). main _ :- coq.error "Usage: HB.export M.". }}. Elpi Typecheck. Elpi Export HB.export. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.reexport] Exports all modules, canonical instances and constants that were previously exported via [HB.export]. It is useful to create one big module with all exports at the end of a file. It optionally takes the name of a module or a component of the current module path (a module which is not closed yet) *) #[arguments(raw)] Elpi Command HB.reexport. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate lp:{{ :name "start" main [] :- !, with-attributes (with-logging (export.reexport-all-modules-and-CS none)). main [str M] :- !, with-attributes (with-logging (export.reexport-all-modules-and-CS (some M))). main _ :- coq.error "Usage: HB.reexport.". }}. #[synterp] Elpi Accumulate File "HB/common/utils-synterp.elpi". #[synterp] Elpi Accumulate Db export.db. #[synterp] Elpi Accumulate lp:{{ shorten coq.env.{ export-module }. pred module-in-module i:list string, i:prop. module-in-module PM (module-to-export _ M) :- coq.modpath->path M PC, std.appendR PM _ PC. % sublist pred actions i:option id. actions Filter :- coq.env.current-library File, compute-filter Filter MFilter, std.findall (module-to-export File Module_) ModsCL, std.filter {list-uniq ModsCL} (module-in-module MFilter) ModsCLFiltered, std.forall ModsCLFiltered (x\sigma mp\x = module-to-export _ mp, export-module mp). main [] :- !, with-attributes (actions none). main [str M] :- !, with-attributes (actions (some M)). main _ :- coq.error "Usage: HB.reexport.". }}. Elpi Typecheck. Elpi Export HB.reexport. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) From elpi.apps Require Import locker. Elpi Export mlock As HB.lock. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* Inactive command: [HB.declare] This command populates the current section with canonical instances. Syntax: [[ HB.declare Context (p1 : P1) ... (pn : Pn) (t : T) of F0 ... Fk. ]] Effect: [[ Variables (p1 : P1) ... (pn : Pn) (t : T). Variable m0 : M0 ... T. HB.instance Definition _ : M0 ... T := m0. .. Variable mk : Ml ... T. HB.instance Definition _ : Ml ... T := ml. ]] where: - factories F0 .. Fk produce mixins M0 .. Ml. Supported attributes: - [#[verbose]] for a verbose output. *) #[arguments(raw)] Elpi Command HB.declare. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate File "HB/common/synthesis.elpi". Elpi Accumulate File "HB/common/phant-abbreviation.elpi". Elpi Accumulate File "HB/export.elpi". Elpi Accumulate File "HB/instance.elpi". Elpi Accumulate File "HB/context.elpi". Elpi Accumulate File "HB/factory.elpi". Elpi Accumulate lp:{{ :name "start" main [Ctx] :- Ctx = ctx-decl _, !, with-attributes (with-logging ( factory.argument->w-mixins Ctx (pr FLwP _), context.declare FLwP _ _ _ _ _)). main _ :- coq.error "Usage: HB.declare Context ". }}. Elpi Typecheck. Elpi Export HB.declare. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** [HB.check T] acts like [Check T] but supports the attribute [#[skip="rex"]] that skips the action on Coq version matches rex. It also understands the [#[fail]] attribute. *) #[arguments(raw)] Elpi Command HB.check. Elpi Accumulate Db hb.db. Elpi Accumulate File "HB/common/stdpp.elpi". Elpi Accumulate File "HB/common/database.elpi". #[skip="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_all.elpi". #[only="8.1[56].*"] Elpi Accumulate File "HB/common/compat_acc_clauses_816.elpi". #[skip="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_all.elpi". #[only="8.1[89].*"] Elpi Accumulate File "HB/common/compat_add_secvar_18_19.elpi". Elpi Accumulate File "HB/common/utils.elpi". Elpi Accumulate File "HB/common/log.elpi". Elpi Accumulate lp:{{ :name "start" main [trm Skel] :- !, with-attributes (with-logging (check-or-not Skel)). main _ :- coq.error "usage: HB.check (term).". pred check-or-not i:term. check-or-not Skel :- coq.version VersionString _ _ _, if (get-option "skip" R, rex_match R VersionString) (coq.warning "HB" "HB.skip" {get-option "elpi.loc"} "Skipping test on Coq" VersionString "as requested") (log.coq.check Skel Ty T Result, if (Result = error Msg) (if (get-option "fail" tt) (coq.say "The command did fail as expected with message:" Msg) (coq.error "HB.check:" Msg)) (if (get-option "fail" tt) (coq.error "The command did not fail") (coq.say "HB.check:" {coq.term->string T} ":" {coq.term->string Ty}))). }}. Elpi Typecheck. Elpi Export HB.check. (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (** Technical notations from /Canonical Structures for the working Coq user/ *) Notation "`Error_cannot_unify: t1 'with' t2" := (unify t1 t2 None) (at level 0, format "`Error_cannot_unify: t1 'with' t2", only printing) : form_scope. Notation "`Error: t `is_not_canonically_a T" := (unify t _ (Some (is_not_canonically_a, T))) (at level 0, T at level 0, format "`Error: t `is_not_canonically_a T", only printing) : form_scope. Notation "`Error: t msg T" := (unify t _ (Some (msg%string, T))) (at level 0, msg, T at level 0, format "`Error: t msg T", only printing) : form_scope. Global Open Scope string_scope. hierarchy-builder-1.8.1/LICENSE000066400000000000000000000017771474513043100161460ustar00rootroot00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. hierarchy-builder-1.8.1/Makefile000066400000000000000000000106661474513043100165760ustar00rootroot00000000000000# -*- Makefile -*- ###################################################################### # USAGE: # # # # make all: Build the MathComp library entirely, # # make test-suite: Run the test suite, # # make only TGTS="...vo": Build the selected libraries of MathComp. # # # # The rules this-config::, this-build::, this-only::, # # this-test-suite::, this-distclean::, this-clean:: # # and __always__:: may be extended. # # # # Additionally, the following variables may be customized: # SUBDIRS?= COQBIN?=$(dir $(shell which coqtop)) COQMAKEFILE?=$(COQBIN)coq_makefile COQDEP?=$(COQBIN)coqdep COQPROJECT?=_CoqProject COQMAKEOPTIONS?= COQMAKEFILEOPTIONS?= V?= VERBOSE?=V TGTS?= ###################################################################### # local context: ----------------------------------------------------- .PHONY: all config build only test-suite clean distclean __always__ .SUFFIXES: H:= $(if $(VERBOSE),,@) # not used yet TOP = $(dir $(lastword $(MAKEFILE_LIST))) COQMAKE = $(MAKE) -f Makefile.coq $(COQMAKEOPTIONS) COQMAKE_TESTSUITE = $(MAKE) -f Makefile.test-suite.coq $(COQMAKEOPTIONS) BRANCH_coq:= $(shell $(COQBIN)coqtop -v | head -1 | grep -E '(trunk|master)' \ | wc -l | sed 's/ *//g') # coq version: ifneq "$(BRANCH_coq)" "0" COQVVV:= dev else COQVVV:=$(shell $(COQBIN)coqtop --print-version | cut -d" " -f1) endif COQV:= $(shell echo $(COQVVV) | cut -d"." -f1) COQVV:= $(shell echo $(COQVVV) | cut -d"." -f1-2) ifneq "$(DESTDIR)" "" HB_INSTALLDIR := $(DESTDIR)/bin else HB_INSTALLDIR := $(dir $(shell which $(COQBIN)coqc)) endif # export to sub- targets export COQBIN export COQMAKEFILE export COQV export COQVV export COQVVV # all: --------------------------------------------------------------- all: $(MAKE) config $(MAKE) build $(MAKE) test-suite # Makefile.coq: ------------------------------------------------------ Makefile.coq: $(COQPROJECT) Makefile $(COQMAKEFILE) $(COQMAKEFILEOPTIONS) -f $(COQPROJECT) -o Makefile.coq # Test suite --------------------------------------------------------- Makefile.test-suite.coq: $(COQPROJECT).test-suite Makefile $(COQMAKEFILE) $(COQMAKEFILEOPTIONS) -f $(COQPROJECT).test-suite -o Makefile.test-suite.coq # Global config, build, clean and distclean -------------------------- config: sub-config this-config build: sub-build this-build only: sub-only this-only test-suite: sub-test-suite this-test-suite clean: sub-clean this-clean distclean: sub-distclean this-distclean # Local config, build, clean and distclean --------------------------- .PHONY: this-config this-build this-only this-test-suite this-distclean this-clean this-config:: __always__ this-build:: this-config Makefile.coq +$(COQMAKE) this-only:: this-config Makefile.coq +$(COQMAKE) only "TGTS=$(TGTS)" this-test-suite:: build Makefile.test-suite.coq +$(COQMAKE_TESTSUITE) this-distclean:: this-clean rm -f Makefile.coq Makefile.coq.conf rm -f Makefile.test-suite.coq Makefile.test-suite.coq.conf this-clean:: __always__ @if [ -f Makefile.coq ]; then $(COQMAKE) cleanall; fi @if [ -f Makefile.test-suite.coq ]; then $(COQMAKE_TESTSUITE) cleanall; fi # Install target ----------------------------------------------------- .PHONY: install install: __always__ Makefile.coq $(COQMAKE) install install -d $(HB_INSTALLDIR) # counting lines of Coq code ----------------------------------------- .PHONY: count COQFILES = $(shell grep '.v$$' $(COQPROJECT)) count: @coqwc $(COQFILES) | tail -1 | \ awk '{printf ("%d (spec=%d+proof=%d)\n", $$1+$$2, $$1, $$2)}' # Additionally cleaning backup (*~) files ---------------------------- this-distclean:: rm -f $(shell find . -name '*~') # Make in SUBDIRS ---------------------------------------------------- ifdef SUBDIRS sub-%: __always__ @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $(@:sub-%=%); done else sub-%: __always__ @true endif # Make of individual .vo --------------------------------------------- structures.vo : %.vo: __always__ Makefile.coq +$(COQMAKE) $@ $(addsuffix o,$(wildcard examples/*.v examples/*/*.v tests/*.v tests/unit/*.v)): __always__ config build Makefile.test-suite.coq +$(COQMAKE_TESTSUITE) $@ hierarchy-builder-1.8.1/Makefile.coq.local000066400000000000000000000003771474513043100204460ustar00rootroot00000000000000# Coq does not know about Elpi Accumulate File, so we declare the dependency here HB/structures.vo : $(wildcard HB/*.elpi HB/common/*.elpi) clean:: $(SHOW)'CLEAN *.hb *.hb.old' $(HIDE) find . -name \*.hb -delete $(HIDE) find . -name \*.hb.old -delete hierarchy-builder-1.8.1/Makefile.test-suite.coq.local000066400000000000000000000020771474513043100225520ustar00rootroot00000000000000COQ_MINOR=$(shell echo $(COQ_VERSION) | cut -d . -f 2 | cut -d + -f 1) output_for=`\ if [ -e $(1).out.$(COQ_MINOR) ]; then\ echo $(1).out.$(COQ_MINOR);\ else\ echo $(1).out;\ fi` DIFF=\ @if [ -z "$$COQ_ELPI_ATTRIBUTES" ]; then \ echo OUTPUT DIFF $(1);\ $(COQTOP) $(COQFLAGS) $(COQLIBS) -topfile $(1) \ < $(1) 2>&1 \ | sed 's/Coq < *//g' \ | sed 's/Rocq < *//g' \ | grep -v '^$$' \ | grep -v -e "Skipping rcfile" -e "is declared" -e "is defined" -e "Loading ML file" -e "Welcome to Coq" -e "Welcome to Rocq" \ | sed 's/characters \([0-9]\+\)-[0-9]\+/character \1/' \ > $(1).out.aux;\ diff -u --strip-trailing-cr $(call output_for,$(1)) $(1).out.aux;\ fi post-all:: $(call DIFF, tests/err_missin_subject.v) $(call DIFF, tests/compress_coe.v) $(call DIFF, tests/about.v) $(call DIFF, tests/howto.v) $(call DIFF, tests/err_miss_key.v) $(call DIFF, tests/missing_join_error.v) $(call DIFF, tests/not_same_key.v) $(call DIFF, tests/hnf.v) $(call DIFF, tests/err_miss_dep.v) $(call DIFF, tests/err_bad_mix.v) $(call DIFF, tests/err_instance_nop.v) hierarchy-builder-1.8.1/README.md000066400000000000000000000153131474513043100164070ustar00rootroot00000000000000[![Actions Status](https://github.com/math-comp/hierarchy-builder/workflows/CI/badge.svg)](https://github.com/math-comp/hierarchy-builder/actions) [![project chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://coq.zulipchat.com/#narrow/stream/237868-Hierarchy-Buidlder) # Hierarchy Builder Hierarchy Builder (HB) provides high level commands to declare a hierarchy of algebraic structure (or interfaces if you prefer the glossary of computer science) for the Coq system. Given a structure one can develop its theory, and that theory becomes automatically applicable to all the examples of the structure. One can also declare alternative interfaces, for convenience or backward compatibility, and provide glue code linking these interfaces to the structures part of the hierarchy. HB commands compile down to Coq modules, sections, records, coercions, canonical structure instances and notations following the *packed classes* discipline which is at the core of the [Mathematical Components](https://github.com/math-comp/math-comp) library. All that complexity is hidden behind a few concepts and a few declarative Coq commands. ## Example ```coq From HB Require Import structures. From Coq Require Import ssreflect ZArith. HB.mixin Record IsAddComoid A := { zero : A; add : A -> A -> A; addrA : forall x y z, add x (add y z) = add (add x y) z; addrC : forall x y, add x y = add y x; add0r : forall x, add zero x = x; }. HB.structure Definition AddComoid := { A of IsAddComoid A }. Notation "0" := zero. Infix "+" := add. Check forall (M : AddComoid.type) (x : M), x + x = 0. ``` This is all we need to do in order to declare the `AddComoid` structure and write statements in its signature. We proceed by declaring how to obtain an Abelian group out of the additive, commutative, monoid. ```coq HB.mixin Record IsAbelianGrp A of IsAddComoid A := { opp : A -> A; addNr : forall x, opp x + x = 0; }. HB.structure Definition AbelianGrp := { A of IsAbelianGrp A & IsAddComoid A }. Notation "- x" := (opp x). ``` Abelian groups feature the operations and properties given by the `IsAbelianGrp` mixin (and its dependency `IsAddComoid`). ```coq Lemma example (G : AbelianGrp.type) (x : G) : x + (- x) = - 0. Proof. by rewrite addrC addNr -[LHS](addNr zero) addrC add0r. Qed. ``` We proceed by showing that `Z` is an example of both structures, and use the lemma just proved on a statement about `Z`. ```coq HB.instance Definition Z_CoMoid := IsAddComoid.Build Z 0%Z Z.add Z.add_assoc Z.add_comm Z.add_0_l. HB.instance Definition Z_AbGrp := IsAbelianGrp.Build Z Z.opp Z.add_opp_diag_l. Lemma example2 (x : Z) : x + (- x) = - 0. Proof. by rewrite example. Qed. ``` ## Documentation This [paper](https://hal.inria.fr/hal-02478907) describes the language in details, and the corresponding talk [is available on youtube](https://www.youtube.com/watch?v=F6iRaTlQrlo). The [wiki](https://github.com/math-comp/hierarchy-builder/wiki) gathers some tricks and FAQs. If you want to work on the implementation of HB, this [recorded hacking session](https://www.youtube.com/watch?v=gmaJjCbzqO0) may be relevant to you. ### Installation & availability
(click to expand)

- You can install HB via OPAM ```shell opam repo add coq-released https://coq.inria.fr/opam/released opam install coq-hierarchy-builder ``` - You can use it in nix with the attribute `coqPackages_8_XX.hierarchy-builder` e.g. via `nix-shell -p coq_8_13 -p coqPackages_8_13.hierarchy-builder`

### Key concepts
(click to expand)

- a *mixin* is a bare bone building block of the hierarchy, it packs operations and axioms. - a *factory* is a package of operations and properties that is elaborated by HB to one or more mixin. A mixin is hence a trivial factory. - a *structure* is declared by attaching zero or more factories to a type. - a *builder* is a user provided piece of code capable of building one or more mixins from a factory. - an *instance* is an example of a structure: it provides all operation and fulfills all axioms.

### The commands of HB
(click to expand)

- HB core commands: - `HB.mixin` declares a mixin, - `HB.structure` declares a structure, - `HB.factory` declares a factory, - `HB.builders` and `HB.end` declare a set of builders, - `HB.instance` declares a structure instance, - `HB.declare` declares a context with parameters, key and mixins. - `HB.saturate` reconsiders all mixin instances to see if some newly declared structure can be inhabited - HB core tactic-in-term: - `HB.pack` to synthesize a structure instance in the middle of a term. - HB utility commands: - `HB.export` exports a module and schedules it for re-export - `HB.reexport` exports all modules, instances and constants scheduled for re-export - `HB.lock` locks a definition behind an opaque symbol and an unfolding equation using Coq module system - HB queries: - `HB.about` is similar to `About` but prints more info on HB structures, like the known instances and where they are declared - `HB.locate` is similar to `Locate`, prints file name and line of any global constant synthesized by HB - `HB.graph` prints the structure hierarchy to a dot file - `HB.howto` prints sequences of factories to equip a type with a given structure - HB debug commands: - `HB.status` dumps the contents of the hierarchy (debug purposes) - `HB.check` is similar to `Check` (testing purposes) The documentation of all commands can be found in the comments of [structures.v](structures.v), search for `Elpi Command` and you will find them. All commands can be prefixed with the attribute `#[verbose]` to get an idea of what they are doing. For debugging and teaching purposes, passing the attributes `#[log]` or `#[log(raw)]` to a HB command prints Coq commands which are *almost* equivalent to its effect. Hence, copy-pasting the displayed commands into your source file is not expected to work, and we strongly recommend against it.

### Demos
(click to expand)

- [demo1](examples/demo1/) and [demo3](examples/demo3/) declare and evolve a hierarchy up to rings with various clients that are tested not to break when the hierarchy evolves - [demo2](examples/demo2/) describes the subtle triangular interaction between groups, topological space and uniform spaces. Indeed, 1. all uniform spaces induce a topology, which makes them topological spaces, but 2. all topological groups (groups that are topological spaces such that the addition and opposite are continuous) induce a uniformity, which makes them uniform spaces. We solve this seamingly mutual dependency using HB.

hierarchy-builder-1.8.1/_CoqProject000066400000000000000000000002521474513043100172570ustar00rootroot00000000000000HB/structures.v -arg -w -arg -elpi.accumulate-syntax -arg -w -arg +elpi.typecheck -arg -w -arg -elpi.typecheck-syntax -Q HB HB -R tests HB.tests -R examples HB.examples hierarchy-builder-1.8.1/_CoqProject.test-suite000066400000000000000000000046461474513043100213770ustar00rootroot00000000000000-arg -w -arg -redundant-canonical-projection -arg -w -arg -projection-no-head-constant -arg -w -arg -abstract-large-number -arg -w -arg -disj-pattern-notation -arg -w -arg -notation-overridden -arg -w -arg +elpi.typecheck examples/readme.v examples/hulk.v examples/demo1/hierarchy_0.v examples/demo1/hierarchy_1.v examples/demo1/hierarchy_2.v examples/demo1/hierarchy_3.v examples/demo1/hierarchy_4.v examples/demo1/hierarchy_5.v examples/demo1/test_0_0.v examples/demo1/test_1_0.v examples/demo1/test_2_0.v examples/demo1/test_3_0.v examples/demo1/test_3_3.v examples/demo1/test_4_0.v examples/demo1/test_4_3.v examples/demo1/test_5_0.v examples/demo1/test_5_3.v examples/demo2/classical.v examples/demo2/stage10.v examples/demo2/stage11.v examples/demo3/hierarchy_0.v examples/demo3/hierarchy_1.v examples/demo3/hierarchy_2.v examples/demo3/test_0_0.v examples/demo3/test_1_0.v examples/demo3/test_2_0.v examples/demo4/hierarchy_0.v examples/demo5/hierarchy_0.v examples/FSCD2020_material/V1.v examples/FSCD2020_material/V2.v examples/FSCD2020_material/V3.v examples/FSCD2020_material/V4.v examples/FSCD2020_talk/V1.v examples/FSCD2020_talk/V2.v examples/FSCD2020_talk/V3.v examples/Coq2020_material/CoqWS_demo.v examples/Coq2020_material/CoqWS_abstract.v examples/Coq2020_material/CoqWS_expansion/withHB.v examples/Coq2020_material/CoqWS_expansion/withoutHB.v # examples/cat/cat.v tests/type_of_exported_ops.v tests/duplicate_structure.v tests/instance_params_no_type.v tests/test_CS_db_filtering.v tests/subtype.v tests/exports.v tests/exports2.v tests/log_impargs_record.v tests/compress_coe.v tests/funclass.v tests/grefclass.v tests/local_instance.v tests/lock.v tests/interleave_context.v tests/not_same_key.v #tests/factory_sort.v tests/hb_pack.v tests/declare.v tests/short.v tests/instance_before_structure.v tests/primitive_records.v tests/non_forgetful_inheritance.v tests/fix_loop.v tests/test_synthesis_params.v tests/hnf.v tests/fun_instance.v tests/issue284.v tests/issue287.v tests/two_hier.v tests/instance_merge_with_param.v tests/instance_merge_with_distinct_param.v tests/instance_merge.v tests/unit/enrich_type.v tests/unit/mixin_src_has_mixin_instance.v tests/unit/mk_src_map.v tests/unit/close_hole_term.v tests/unit/struct.v tests/factory_when_notation.v tests/saturate_on.v tests/bug_435.v tests/bug_447.v tests/unimported_relevant_class.v tests/unimported_irrelevant_class.v -R tests HB.tests -R examples HB.examples -Q HB HB hierarchy-builder-1.8.1/build-support/000077500000000000000000000000001474513043100177365ustar00rootroot00000000000000hierarchy-builder-1.8.1/build-support/coq/000077500000000000000000000000001474513043100205205ustar00rootroot00000000000000hierarchy-builder-1.8.1/build-support/coq/extra-lib.nix000066400000000000000000000077721474513043100231440ustar00rootroot00000000000000{ lib }: with builtins; with lib; recursiveUpdate lib (rec { versions = let truncate = n: v: concatStringsSep "." (take n (splitVersion v)); opTruncate = op: v0: v: let n = length (splitVersion v0); in op (truncate n v) (truncate n v0); in rec { /* Get string of the first n parts of a version string. Example: - truncate 2 "1.2.3-stuff" => "1.2" - truncate 4 "1.2.3-stuff" => "1.2.3.stuff" */ inherit truncate; /* Get string of the first three parts (major, minor and patch) of a version string. Example: majorMinorPatch "1.2.3-stuff" => "1.2.3" */ majorMinorPatch = truncate 3; /* Version comparison predicates, - isGe v0 v <-> v is greater or equal than v0 [*] - isLe v0 v <-> v is lesser or equal than v0 [*] - isGt v0 v <-> v is strictly greater than v0 [*] - isLt v0 v <-> v is strictly lesser than v0 [*] - isEq v0 v <-> v is equal to v0 [*] - range low high v <-> v is between low and high [**] [*] truncating v to the same number of digits as v0 [**] truncating v to low for the lower bound and high for the upper bound Examples: - isGe "8.10" "8.10.1" => true - isLe "8.10" "8.10.1" => true - isGt "8.10" "8.10.1" => false - isGt "8.10.0" "8.10.1" => true - isEq "8.10" "8.10.1" => true - range "8.10" "8.11" "8.11.1" => true - range "8.10" "8.11+" "8.11.0" => false - range "8.10" "8.11+" "8.11+beta1" => false */ isGe = opTruncate versionAtLeast; isGt = opTruncate (flip versionOlder); isLe = opTruncate (flip versionAtLeast); isLt = opTruncate versionOlder; isEq = opTruncate pred.equal; range = low: high: pred.inter (versions.isGe low) (versions.isLe high); }; /* Returns a list of list, splitting it using a predicate. This is analoguous to builtins.split sep list, with a predicate as a separator and a list instead of a string. Type: splitList :: (a -> bool) -> [a] -> [[a]] Example: splitList (x: x == "x") [ "y" "x" "z" "t" ] => [ [ "y" ] "x" [ "z" "t" ] ] */ splitList = pred: l: # put in file lists let loop = (vv: v: l: if l == [] then vv ++ [v] else let hd = head l; tl = tail l; in if pred hd then loop (vv ++ [ v hd ]) [] tl else loop vv (v ++ [hd]) tl); in loop [] [] l; pred = { /* Predicate intersection, union, and complement */ inter = p: q: x: p x && q x; union = p: q: x: p x || q x; compl = p: x: ! p x; true = p: true; false = p: false; /* predicate "being equal to y" */ equal = y: x: x == y; }; /* Emulate a "switch - case" construct, instead of relying on `if then else if ...` */ /* Usage: ```nix switch-if [ if-clause-1 .. if-clause-k ] default-out ``` where a if-clause has the form `{ cond = b; out = r; }` the first branch such as `b` is true */ switch-if = c: d: (findFirst (getAttr "cond") {} c).out or d; /* Usage: ```nix switch x [ simple-clause-1 .. simple-clause-k ] default-out ``` where a simple-clause has the form `{ case = p; out = r; }` the first branch such as `p x` is true or ```nix switch [ x1 .. xn ] [ complex-clause-1 .. complex-clause-k ] default-out ``` where a complex-clause is either a simple-clause or has the form { cases = [ p1 .. pn ]; out = r; } in which case the first branch such as all `pi x` are true if the variables p are not functions, they are converted to a equal p if out is missing the default-out is taken */ switch = var: clauses: default: with pred; let compare = f: if isFunction f then f else equal f; combine = cl: var: if cl?case then compare cl.case var else all (equal true) (zipListsWith compare cl.cases var); in switch-if (map (cl: { cond = combine cl var; inherit (cl) out; }) clauses) default; }) hierarchy-builder-1.8.1/build-support/coq/meta-fetch/000077500000000000000000000000001474513043100225355ustar00rootroot00000000000000hierarchy-builder-1.8.1/build-support/coq/meta-fetch/default.nix000066400000000000000000000057311474513043100247070ustar00rootroot00000000000000{ lib, stdenv, fetchzip }@args: let lib' = lib; in let lib = import ../extra-lib.nix {lib = lib';}; in with builtins; with lib; let default-fetcher = {domain ? "github.com", owner ? "", repo, rev, name ? "source", sha256 ? null, ...}@args: let ext = if args?sha256 then "zip" else "tar.gz"; fmt = if args?sha256 then "zip" else "tarball"; pr = match "^#(.*)$" rev; url = switch-if [ { cond = isNull pr && !isNull (match "^github.*" domain); out = "https://${domain}/${owner}/${repo}/archive/${rev}.${ext}"; } { cond = !isNull pr && !isNull (match "^github.*" domain); out = "https://api.${domain}/repos/${owner}/${repo}/${fmt}/pull/${head pr}/head"; } { cond = isNull pr && !isNull (match "^gitlab.*" domain); out = "https://${domain}/${owner}/${repo}/-/archive/${rev}/${repo}-${rev}.${ext}"; } { cond = !isNull (match "(www.)?mpi-sws.org" domain); out = "https://www.mpi-sws.org/~${owner}/${repo}/download/${repo}-${rev}.${ext}";} ] (throw "meta-fetch: no fetcher found for domain ${domain} on ${rev}"); fetch = x: if args?sha256 then fetchzip (x // { inherit sha256; }) else fetchTarball x; in fetch { inherit url ; }; in { fetcher ? default-fetcher, location, release ? {}, releaseRev ? (v: v), }: let isVersion = x: isString x && match "^/.*" x == null && release?${x}; shortVersion = x: if (isString x && match "^/.*" x == null) then findFirst (v: versions.majorMinor v == x) null (sort versionAtLeast (attrNames release)) else null; isShortVersion = x: shortVersion x != null; isPathString = x: isString x && match "^/.*" x != null && pathExists x; in arg: switch arg [ { case = isNull; out = { version = "broken"; src = ""; broken = true; }; } { case = isPathString; out = { version = "dev"; src = arg; }; } { case = pred.union isVersion isShortVersion; out = let v = if isVersion arg then arg else shortVersion arg; in let given-sha256 = release.${v}.sha256 or ""; sha256 = if given-sha256 == "" then lib.fakeSha256 else given-sha256; rv = release.${v} // { inherit sha256; }; in { version = rv.version or v; src = rv.src or fetcher (location // { rev = releaseRev v; } // rv); }; } { case = isString; out = let splitted = filter isString (split ":" arg); rev = last splitted; has-owner = length splitted > 1; version = "dev"; in { inherit version; src = fetcher (location // { inherit rev; } // (optionalAttrs has-owner { owner = head splitted; })); }; } { case = isAttrs; out = let { version = arg.version or "dev"; src = (arg.fetcher or fetcher) (location // (arg.location or {})); }; } { case = isPath; out = { version = "dev" ; src = builtins.path {path = arg; name = location.name or "source";}; }; } ] (throw "not a valid source description") hierarchy-builder-1.8.1/coq-hierarchy-builder.opam000066400000000000000000000022601474513043100221650ustar00rootroot00000000000000opam-version: "2.0" name: "coq-hierarchy-builder" version: "dev" maintainer: "Enrico Tassi " authors: [ "Cyril Cohen" "Kazuhiko Sakaguchi" "Enrico Tassi" ] license: "MIT" homepage: "https://github.com/math-comp/hierarchy-builder" bug-reports: "https://github.com/math-comp/hierarchy-builder/issues" dev-repo: "git+https://github.com/math-comp/hierarchy-builder" build: [ [ make "build"] [ make "test-suite" ] {with-test} ] install: [ make "install" ] depends: [ ("coq" {>= "8.18" & < "8.20~"} & "coq-elpi" {>= "2.0"} | "coq" {>= "8.20" | = "dev"} & "coq-elpi" {>= "2.4" | = "dev"}) ] conflicts: [ "coq-hierarchy-builder-shim" ] synopsis: "High level commands to declare and evolve a hierarchy based on packed classes" description: """ Hierarchy Builder is a high level language to build hierarchies of algebraic structures and make these hierarchies evolve without breaking user code. The key concepts are the ones of factory, builder and abbreviation that let the hierarchy developer describe an actual interface for their library. Behind that interface the developer can provide appropriate code to ensure retro compatibility. """ tags: [ "logpath:HB" ] hierarchy-builder-1.8.1/default.nix000066400000000000000000000006611474513043100172740ustar00rootroot00000000000000{ config ? {}, withEmacs ? false, print-env ? false, do-nothing ? false, update-nixpkgs ? false, ci-matrix ? false, override ? {}, ocaml-override ? {}, global-override ? {}, bundle ? null, job ? null, inNixShell ? null, src ? ./., }@args: let auto = fetchGit { url = "https://github.com/coq-community/coq-nix-toolbox.git"; ref = "master"; rev = import .nix/coq-nix-toolbox.nix; }; in import auto ({inherit src;} // args) hierarchy-builder-1.8.1/examples/000077500000000000000000000000001474513043100167435ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/Coq2020_material/000077500000000000000000000000001474513043100216475ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/Coq2020_material/CoqWS_abstract.v000066400000000000000000000054151474513043100247220ustar00rootroot00000000000000(* Accompanying material to Coq workshop presentation *) From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. HB.mixin Record CMonoid_of_Type A := { (* The set of axioms making A a commutative monoid. *) zero : A; add : A -> A -> A; addrA : associative add; (* `add` is associative *) addrC : commutative add; (* `add` is commutative *) add0r : left_id zero add; (* `zero` is a neutral element *) }. HB.structure Definition CMonoid := { A of CMonoid_of_Type A }. (* The structure thereof. *) Notation "0" := zero. Infix "+" := add. (* The type of the operations and axioms depend on a CMonoid.type structure. *) Check addrC. (* ?M : CMonoid.type |- commutative (@add ?M) *) HB.mixin Record AbelianGrp_of_CMonoid A of CMonoid A := { opp : A -> A; (* We can write `add` here since A is a CMonoid *) addNr : left_inverse zero opp add; (* `opp` is the additive inverse *) }. HB.structure Definition AbelianGrp := { A of AbelianGrp_of_CMonoid A }. Notation "- x" := (opp x). Notation "x - y" := (add x (opp y)). HB.mixin Record SemiRing_of_CMonoid A of CMonoid A := { one : A; mul : A -> A -> A; mulrA : associative mul; (* `mul` is associative *) mul1r : left_id one mul; (* `one` is left neutral *) mulr1 : right_id one mul; (* `one` is right neutral *) mulrDl : left_distributive mul add; (* `mul` distributes over *) mulrDr : right_distributive mul add; (* `add` on both sides *) mul0r : left_zero zero mul; (* `zero` is absorbing `mul` *) mulr0 : right_zero zero mul; (* on both sides *) }. HB.structure Definition SemiRing := { A of SemiRing_of_CMonoid A }. Notation "1" := one. Infix "*" := mul. (* We need no additional mixin to declare the Ring structure. *) HB.structure Definition Ring := { A of SemiRing_of_CMonoid A & AbelianGrp_of_CMonoid A }. (* An example statement in the signature of an Abelian group G, combining 0 and -. *) Check forall G : AbelianGrp.type, forall x : G, x - x = 0. (* An example statement in the signature of a Semiring S, combining 0, +, and *. *) Check forall S : SemiRing.type, forall x : S, x * 1 + 0 = x. (* An example statement in the signature of a Ring R, combining -, 1 and *. *) Check forall R : Ring.type, forall x y : R, x * - (1 * y) = - x * y. HB.instance Definition Z_CMonoid := CMonoid_of_Type.Build Z 0%Z Z.add Z.add_assoc Z.add_comm Z.add_0_l. HB.instance Definition Z_AbelianGrp := AbelianGrp_of_CMonoid.Build Z Z.opp Z.add_opp_diag_l. HB.instance Definition Z_SemiRing := SemiRing_of_CMonoid.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l Z.mul_0_l Z.mul_0_r. (* An example statement in the signature of the Z ring, combining Z, 0, +, -, 1 and * *) Check forall x : Z, x * - (1 + x) = 0 + 1. hierarchy-builder-1.8.1/examples/Coq2020_material/CoqWS_demo.v000066400000000000000000000145471474513043100240510ustar00rootroot00000000000000(* Accompanying material to Coq workshop presentation *) From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. Set Warnings "-redundant-canonical-projection". (* ****************************************************** *) (* ******** 1. Building the hierarchy ********** *) (* ****************************************************** *) (* ******************************************************** The set of axioms that turn a naked type A into a Commutative Monoid. This would be the puzzle piece. *) HB.mixin (* an HB command *) Record CMonoid_of_Type A := { (* and its argument *) zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. (* ******************************************************** The structure of Commutative Monoids This would be the blue dotted box Note: { A of ... } is just a notation for a sigma type *) HB.structure Definition CMonoid := { A of CMonoid_of_Type A }. (* ******************************************************** Monoid playground *) (* Operations are now available *) Check add. (* Axioms are also there *) Check addrC. (* We can develop the abstract theory of CMonoid *) Notation "0" := zero. Infix "+" := add. Lemma silly : forall (M : CMonoid.type) (x : M), x + 0 = 0 + x. Proof. by move=> M x; rewrite addrC. Qed. (* ******************************************************** The puzzle piece on the right and the AbelianGrp str. Note: it requires A to be a monoid, indeed the property talk about both add and opp *) HB.mixin Record AbelianGrp_of_CMonoid A of CMonoid A := { opp : A -> A; addNr : left_inverse zero opp add; }. HB.structure Definition AbelianGrp := { A of AbelianGrp_of_CMonoid A }. Notation "- x" := (opp x). Notation "x - y" := (add x (opp y)). (* Quick check that - and + and 0 are compatible *) Check forall x y, x - (y + 0) = x. (* ******************************************************** The puzzle piece on the left and the SemiRing str. *) HB.mixin Record SemiRing_of_CMonoid A of CMonoid A := { one : A; mul : A -> A -> A; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; mul0r : left_zero zero mul; mulr0 : right_zero zero mul; }. HB.structure Definition SemiRing := { A of SemiRing_of_CMonoid A & }. Notation "1" := one. Infix "*" := mul. (* Quick check that + and 1 and * are compatible *) Check forall x y, 1 + x = y * x. (* ******************************************************** Can I mix * and - in the same expression? *) Fail Check forall x y, 1 * x = y - x. (* ******************************************************** The missing structure, no puzzle piece is missing *) HB.structure Definition Ring := { A of SemiRing A & AbelianGrp A }. Check forall (R : Ring.type) (x y : R), 1 * x = y - x. Check forall x y, 1 * x = y - x. (* ****************************************************** *) (* ******** 2. Declaring instances ******** *) (* ****************************************************** *) (* ****************************************************** Inhabiting the puzzle pieces with Z *) Module Z_instances. HB.instance Definition Z_CMonoid := CMonoid_of_Type.Build Z 0%Z Z.add Z.add_assoc Z.add_comm Z.add_0_l. HB.instance Definition Z_AbelianGrp := AbelianGrp_of_CMonoid.Build Z Z.opp Z.add_opp_diag_l. HB.instance Definition Z_SemiRing := SemiRing_of_CMonoid.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l Z.mul_0_l Z.mul_0_r. (* Now Z is recognized as a Ring *) Check forall x : Z, x * - (1 + x) = 0 + 1. End Z_instances. (* ****************************************************** *) (* ********** 3. Being nice with users ******** *) (* ****************************************************** *) (* ******************************************************** Crafting special builders We provide an API to build a ring directly. A factory is a ''virtual'' puzzle piece that can be ''compiled'' to other puzzle pieces. *) HB.factory Record Ring_of_Type A := { zero : A; add : A -> A -> A; opp : A -> A; one : A; mul : A -> A -> A; addrA : associative add; (*addrC : commutative add; *) add0r : left_id zero add; addr0 : right_id zero add; (* new *) addNr : left_inverse zero opp add; addrN : right_inverse zero opp add; (* new *) mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; mul0r : left_zero zero mul; mulr0 : right_zero zero mul; }. (* The ''compilation'' of a factory *) HB.builders Context A of Ring_of_Type A. (* We are in a Context with a type A that with operations and properties, but which is not yet known to be a Ring *) Check add. Local Infix "+" := add. (* We prove commutativity as per Hankel 1867 *) Lemma addrC : commutative add. Proof. have innerC (a b : A) : a + b + (a + b) = a + a + (b + b). by rewrite -[a + b]mul1r -mulrDl mulrDr !mulrDl !mul1r. have addKl (a b c : A) : a + b = a + c -> b = c. apply: can_inj (add a) (add (opp a)) _ _ _. by move=> x; rewrite addrA addNr add0r. have addKr (a b c : A) : b + a = c + a -> b = c. apply: can_inj (add ^~ a) (add ^~ (opp a)) _ _ _. by move=> x; rewrite /= -addrA addrN addr0. move=> x y; apply: addKl (x) _ _ _; apply: addKr (y) _ _ _. by rewrite -!addrA [in RHS]addrA innerC !addrA. Qed. HB.instance Definition A_CMonoid := CMonoid_of_Type.Build A zero add addrA addrC add0r. HB.instance Definition A_AbelianGrp := AbelianGrp_of_CMonoid.Build A opp addNr. HB.instance Definition A_SemiRing := SemiRing_of_CMonoid.Build A one mul mulrA mul1r mulr1 mulrDl mulrDr mul0r mulr0. HB.end. (* Let's use the new builder *) Module Z_instances_again. HB.instance Definition Z_Ring := Ring_of_Type.Build Z 0%Z Z.add Z.opp 1%Z Z.mul Z.add_assoc (* Z.add_comm *) Z.add_0_l Z.add_0_r Z.add_opp_diag_l Z.add_opp_diag_r Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l Z.mul_0_l Z.mul_0_r. Check forall x : Z, x * - (1 + x) = 0 + 1. End Z_instances_again. hierarchy-builder-1.8.1/examples/Coq2020_material/CoqWS_expansion/000077500000000000000000000000001474513043100247275ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/Coq2020_material/CoqWS_expansion/withHB.v000066400000000000000000000011701474513043100263020ustar00rootroot00000000000000(* Accompanying material to Coq workshop presentation *) From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. Set Warnings "-redundant-canonical-projection". HB.mixin Record CMonoid_of_Type A := { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. HB.structure Definition CMonoid := { A of CMonoid_of_Type A }. HB.mixin Record AbelianGrp_of_CMonoid A of CMonoid A := { opp : A -> A; addNr : left_inverse zero opp add; }. HB.structure Definition AbelianGrp := { A of AbelianGrp_of_CMonoid A & }. hierarchy-builder-1.8.1/examples/Coq2020_material/CoqWS_expansion/withoutHB.v000066400000000000000000000076611474513043100270450ustar00rootroot00000000000000(* Accompanying material to Coq workshop presentation *) From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. Set Warnings "-redundant-canonical-projection". (* Helpers *) Notation "[unify t1 'with' t2 ]" := (unify _ _ t1 t2 _) (at level 0, format "[unify t1 'with' t2 ]", only printing). Notation "[unify t1 'with' t2 ]" := (unify _ _ t1 t2 NoMsg) (at level 0, format "[unify t1 'with' t2 ]", only parsing). Module CMonoid_of_Type. Section CMonoid_of_Type. Variable (A : Type). Record axioms_ : Type := Axioms_ { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add }. Definition phant_Build (zero : A) (add : A -> A -> A) (addrA : associative add) (addrC : commutative add) := [eta CMonoid_of_Type.Axioms_ zero add addrA addrC]. Definition phant_axioms := CMonoid_of_Type.axioms_. End CMonoid_of_Type. Notation Build A := (phant_Build A). Notation axioms A := (phant_axioms A). Module Exports. Notation CMonoid_of_Type A := (axioms A). End Exports. End CMonoid_of_Type. Export CMonoid_of_Type.Exports. Module CMonoid. Record axioms (A : Type) : Type := Class { CMonoid_of_Type_mixin : CMonoid_of_Type.axioms_ A }. Record type : Type := Pack { sort : Type; class : axioms sort }. Module Exports. Coercion sort : type >-> Sortclass. Definition zero {s : type} := CMonoid_of_Type.zero _ (CMonoid_of_Type_mixin _ (class s)). Definition add {s : type} (x y : s) : s := CMonoid_of_Type.add _ (CMonoid_of_Type_mixin _ (class s)) x y. Definition addrA {s : type} : associative add := CMonoid_of_Type.addrA _ (CMonoid_of_Type_mixin _ (class s)). Definition addrC {s : type} : commutative add := CMonoid_of_Type.addrC _ (CMonoid_of_Type_mixin _ (class s)). Definition add0r {s : type} : left_id zero add := CMonoid_of_Type.add0r _ (CMonoid_of_Type_mixin _ (class s)). End Exports. End CMonoid. Export CMonoid.Exports. Module AbelianGrp_of_CMonoid. Section AbelianGrp_of_CMonoid. Variable (A : Type). Notation M m := (CMonoid.Pack A (CMonoid.Class A m)). Record axioms_ (m : CMonoid_of_Type.axioms_ A) := Axioms_ { opp : A -> A; addNr : left_inverse (@zero (M m)) opp (@add (M m)) }. Definition phant_Build := fun (s : CMonoid.type) of [unify A with CMonoid.sort s] => fun (c : CMonoid.axioms A) of [unify s with CMonoid.Pack A c] => fun (m : CMonoid_of_Type.axioms_ A) of [unify c with CMonoid.Class A m] => fun (opp : A -> A) (addNr : left_inverse (@zero (M m)) opp (@add (M m))) => Axioms_ m opp addNr. Definition phant_axioms := fun (s : CMonoid.type) of [unify A with CMonoid.sort s] => fun (c : CMonoid.axioms A) of [unify s with CMonoid.Pack A c] => fun (m : CMonoid_of_Type.axioms_ A) of [unify c with CMonoid.Class A m] => axioms_ m. End AbelianGrp_of_CMonoid. Notation Build A := (phant_Build A _ id_phant _ id_phant _ id_phant). Notation axioms A := (phant_axioms A _ id_phant _ id_phant _ id_phant). Module Exports. Notation AbelianGrp_of_CMonoid A := (axioms A). End Exports. End AbelianGrp_of_CMonoid. Export AbelianGrp_of_CMonoid.Exports. Module AbelianGrp. Record axioms (A : Type) : Type := Class { CMonoid_of_Type_mixin : CMonoid_of_Type.axioms_ A; AbelianGrp_of_CMonoid_mixin : AbelianGrp_of_CMonoid.axioms_ A CMonoid_of_Type_mixin }. Record type : Type := Pack { sort : Type; class : axioms sort }. Module Exports. Coercion sort : type >-> Sortclass. Coercion AbelianGrp_class_to_CMonoid_class (A : Type) (c : axioms A) := CMonoid.Class A (CMonoid_of_Type_mixin A c). Coercion AbelianGrp_to_CMonoid (A : AbelianGrp.type) := CMonoid.Pack A (class A). Canonical AbelianGrp_to_CMonoid. Definition opp {s : type} (x : s) : s := AbelianGrp_of_CMonoid.opp _ _ (AbelianGrp_of_CMonoid_mixin _ (class s)) x. Definition addNr {s : type} : left_inverse (@zero s) opp (@add s) := AbelianGrp_of_CMonoid.addNr _ _ (AbelianGrp_of_CMonoid_mixin _ (class s)). End Exports. End AbelianGrp. Export AbelianGrp.Exports. hierarchy-builder-1.8.1/examples/Coq2020_material/diagram.pdf000066400000000000000000001200731474513043100237510ustar00rootroot00000000000000%PDF-1.5 % 4 0 obj << /Length 5 0 R /Filter /FlateDecode >> stream xͮ%=%6c8' x`{8vZ{*у[YcAKp 1PǑtc]*X_sjm k|ԭDF)PDr>T݀(HYpɾo$¸>uNA!$ Lm"ŧoq& tσ*&[$AR˔Nɐ[^M ]eIe3{/.νՋYگA+~Ĵb@nbHww^|R,z`ʱ9s>aReLƙ"s:6Z7F] rSqэERȕV{)2x'Q=jj96~e~!_2M濯 7* #qb7"o㰈<5?}qꏤGb:>TD6}^C`8,nE7l$\j~C<5֘$2;g#uԚAb>T~XCe:Y qRԶc  {E^zl0Ńs܇.>($剨f~~¡yi.m)?p/N!cC22Jڰs1?bGj{y !  YC`Ё _z2?f,8#pPcoiN~FG-84gMXjz.g/b(z8C^LqM8T~~Gߏ+5r6<~A㠔pCE<`!bgOq_5q|:A`qo!ZcM{VQ )1f3?QzL8KIastkZq|vBUרu@ iGϿ؂w_|3%"0]~]ۯ:lExw< R_cVii> ^\oqAyh濅om^zğ韛uL'u5o6jc97@-e!;w\̫O ~g&˓jL^iY$&ω[{UX?78v >bNJo{(ٖ^6Z}trR_m%0FeF fI2T F4Ws?j"}<k<i K3)~.8 QwgA_m}2j'xE噋 ݤbKA>.+~G\W*tT? G1dRLm]hvہ nMB8[0kώrl!sJ'bh }kP7{sWv f sXx]_Lqk[]lnt -mT C o`<7"e1N/z:fÉvk~y:ܾ=Qkk^)\HD ~]_U:q~]#?>WeMΪ q!!CnT7mGpϴR?3t\]OCd 0!6Ƥn3& .x́+f/8*l SyǣɒY@-n@\Ϧ 6xep^XӾ7ܜ \yxȐ-1%Yo׶??Wܺ?iՆqDx,W|AF7WV[vsuGvE/z(!ؑTն 3!f;7 .06ϥ+;pȿG+}~8ۼϣX4]p gKɿa&n57c*l`!^ دZCbQQ6_Oe~wž!iSc5eYzcI )5t"Qvar|OHkD9c_Ͻ .*+}OG̼(:gl!; +iS%Ox@IC:=Oy5o0\c@TnV/*L9зߘ01{VO3bT}"9Z( \ⰅR柤Z摭8M un8ڐa\OjWºvql#JsNOa)aO\Vڄ_ڞǯ/0kA9x.&kX yZKV5;~{d(?:!H,3*`.z=AfW 0"8C]8Q|=ʐ\ l]"!ɏ Q}2OCҢ@rrzGi?>PaÇa~mLfAW]chTG]nxOء+u#Bt: &3%א8+K!γ?d^1h\+z햰~bqlC2@̏2~0Q~bxgeE\W#[|S|~zSf)'5jv5> ?w/e)_-i{ցVֶk57zk߯1K~Uݳ}ndGds:`]Fp@ 6d8,_g޸mlПǹHpcl0q >gҪ07̝,tW:iGBFvk4!N [6r 1TB5: L8g5&;b'*j9π /ù\\)}2Cv C.qܩ4EިJ?We\cC}%%h2}/ tYs 70hUVOPqtx.O:w"R،aqzJ}NdUکVw a17CQ2ކZ^qLOJPx+9D}%SaGX\J1$x>idvZYdaǭe}-Y6VR"W'c<{cOCڥvTv#o-O[[lZr,"[1% n0n%4#4A%i =>}c,ch @;A>?N-G5Z<9O@c'su1Xܘ>-8^\_  SjUGΏV,Aɸ`Z Y4?PrQEC.j8"-`lȠs3Ŀh8"M<mb@cim_i~t;%4] z-0Wd\KlO\HVTn: KVQ\(A6ЯjlE5 wEy1qKIj*xsˀ;yߝ{aCr!/p>2t1 đqȠk2`{(X1m_6BޏDr#Z?Q1Ȃb9E+wFQapxl,\{\q n47 G"'a/*͙=Νؖ-RX - q>˨M߈AX9h[xpLEƾ{URht+i8@틼sk T4d$RtD6rl;!0*85T-%(8]|A߿ a5$b")Ʀms&<!L&s͉p,+%)3YYZA_{k_͊ bqȕ&sG\G[ N:Z|/OՌ-_EZW}4v*\fHO%Rn(kc8sV@V$2.8X)5+ 1wL:r_}Gguđc2 kJ<$^Gnp0g,C!9\H~T8nބz"i.}8(_‚ `7Fx} aϠncȼnkSScU¼!r" ֍gn9v^^:@N=ز4H`V:25ΞDLk]r F;$mApnjC+;6e&"A+gH +$*O0펃J?:(5 !L`١Q7ՎH;5W򎉊N$փd0&ʖ>ɗ_CNݗӢE[61N\6^Nj=ݮv>-gS.ï5>]RR'(](ƒ- r]M l-e[fuI<~?{Zkq*i)NԪ: AUPt,3F|1#M*=i `($Cnʼn_Z59SqA֋bCyxuH6ɡ CW4O萼iڹ!M['gy(T pOt΄5@tK/mefR+͌N.ql  Wwjs0Jϕ_7<}yk};~> >PnU0~8Ԣñ4OHKzĎ0{ ʟ48n&pݼ󌌐hBq"NW.6fg͡K]JKu`Կ UvCFtʌX6Bj\qf烉|Qo?IDHg$;e(VqHǜ~XjPqŚ+ĺ0HC#fsQO`I1a$#fƞ/fq?eI<$[Ma/N:Y$P.n4FI*'1']!F9\^, (> |]?6\Vډ*Xah^0/E.,h%m 6707L0%rQT)Y_M(YI? H ZQ0ՍfKYͽ /K#lS5drU|(F #i_iIΝAr$ M  $ic6OE=O4 f,p߽Yh>+Ӽͪ@d^ph:kMC ;IriAAl^ .b5 ͑K%)m%|Mj"l FY+˗Յ(XY3& uFR|Q2lGAڂ3`!+,VD&1>֊9? ĬW_o:ƏT=4)~Uऋ &p|mnj&|Rq G bH,Ck,,W`<5 ;@6+1ÿp`/4I;P6TGOzPƖnȮ[:@\-oZא QQSAUBjDntq4\&KDY{AYDLUFjUM$:/,혹(K `nݽj02FH:0J wQ$y5R_Чf)?t7\^0ղ:`861!v{Ee=2+z'LfK sĀjNƄc]є+PdW`<[trn1?6?_e @[gLKelnI r^c,؛G1Wq9e&[\iѭ \ur2 ǘT\.{ O#R~Ф9%329hrG5X!-Wi.% YU,[YmpjtLKfEjrՠ(v぀~dv2Xki7Ō,b7ɬNeͩ*z%aL8fJ'1ry7ͪAf/59]=f3M4uHf{EiIvyEk՘~yuXo718ۮy"Tl )~8^ ,w"Lu-SE7EqRU?`*I>T(vk{GhƞTqa[SU a<ᢺg'yNWc,Odt4_k^5lI;Ft4;Ų=ȫg2x7!;j|1b,UXKd> "x5;nEn 㙖l$n:3A(z_D g)%ڝI}4:at =a<_Gi'̇aG&3"`7ډ !C|ODtH_qX& ʂje ^T2͝W7 Hrѧ ^2P1gpkn@_ʃA9f KCCQ/UaD y"Hgɾk]d~5KX28E.S298GL}0(ۭW_Huixo NtN0C|Oa_Lf^ݎ88G;yw }CgzIcG<1uDJ'rnv穚WdWފadJ +1i4m9qzP?ro'g&HrP&?/431s8Kż6iubL 8-A FuiY8:`Fj#灝Sl2%~{AmڮhxC=sP=ZzlyWJ~A_nֹn[fCw@F gY7ݥgw_LE PzM&wrTAj2FNc"c<7MC@p]^&@[&fW4'Gˇ(ևv*lo?[aN!s즬"Fmk,pX'j&x ksQp:_9B~DU}UK7#0;[ cJXV\]ҵnć%My4*fyW7_xŭ<̤D.AaVLuB2f  Q A~Et9(,wDž:Щ{5f5;@VmA$l~go2v}.u vS`Kla(-˻EVsҀ9e ;huSV9lvhw'Rpnb\~ޔh فztó}|ԉzּhy @3SWO"@K$Y!AٺG&zo鴝zAG+WcI ե?0Uup% )b{,.O,z;%S;z"% 0|`H=xjZxLR%ʽ/"JZW5KRMY`ac4@9(gcHy ' Xߡ"[4S|94mgÙFO:]nq-)Q>{D 0}X!>+HׄdKs.`u=ZeX'g)~(^$b`l ,jyx;T1@j.̱Tض*(Fi7{oǂ%%MUs3}ր5,vwi߄08q,u8MZᆄja@P  E;Z7WdBn5zZh=d _"m4ȁ&i zZuJ늟+OFgH~ z[cmӳI:8|bN}hJj^:fr`֒&H[rl6]kIS~Q@tG3d-ko#Z R N;5r^[0K&/  MNqWWb*:fP#)GRJ ;F5k]g{R\QCq.Y0Dhgk[M\`ZUXM[\dYrhEi(v"@^]Fo91cjh0fO9z?Yy7sW0+R!`j4ŌiOq<;%Z*(Y$Гt@Fa䘽mC}VogF#^< 8H K;a\ a4wPlrz1%muR7jYS"B.] ueG6CQN̡m⛬b]huu'+5E1A%c}j7Ӄlw(qk4%~׉*].@ Cq?7릥(Oo߬;;zqՇB sάި͓Ӹz'f|K]c'wDʺ!=^'ēzl'|X!穔a;D-K)M~b)'q+ `WR~FZh|iZAGՠ{8.~} de%HG.z(tQ;22w*="zѥ4Rf%C >V 0{Bw!Ev]+uqea nm&)$4@}:㲋]$qSXs2tZU @<J2MUr{C5(ĵ L(4l${KvPi9ȏɋz?1`, ]2X*.]e!!(7{̟q`u3[k#e@A>9X0&<8q ,ҼjNSL>Aa=p]o2!|Q9$WmsݔSJ@IoRL׊!_9X: WI38tH}G@ ɤ!2C5\l*eʝFaEx@T^yHOS<XΨ / (,KT85}Qw̵sj b K MPsȰV熽ZDi]^vVE{@ȊK SX\p+'+}>W3 a *f-AIP1/{NH,Uk{qOVNm )MFn X x4(B{ku6nhʦ}Sq鮨̤e~g8+';9&b X#OgiKCԼ1IB齃U eSє jNUʶ~^Ep $RJW[0z8j ~@(g$WZ c(]lS!{H| ->_ COm^%M)BO;d \H/Gl3ʤ[=[:!a2Q[*1#򐹮eK<0 W#hTeKtd|ZzmWK=ihKJ &m9vgp.E"}N|Bny n{DΧoYq o{^wFkiص]@ڵnhռ OˎU30X #i뙐cm).m٭uin_|٤K'^tU8,t?dg~ v> tTw]('h#yLBUa,;fl2i?RfFIV#N>[B>(RѿfpJ8.TQ13iRQjiT~LZФ)j=NE-D4 X쪓7%|RDq,^DNsF&P,v܁8حܢ -o[Id+{3a6$ 6}(0QHE$ȪvbG3F<",Ѣ[r L\R"EϲMs8n6@d'ʲޭ&".|$nw.E.S^S:E].[8nAjV@J<[S(*Sd0V;&boU-+$CX oe-^/H@äE Sxlf5SfE`dYEL;FRb #n0 9ƆUF)k:}D2:" t$,n ۳Sa1I:dI9.[^Ft[$2)8_`t^YPS] vY*ʲ -ٺCg7?UbQ9Y71^Qɟz-(4:q4J+{ߡNv%+bٛ m`0P&Dsg$_v$⸜'JOęBaqzv5{Asݴ*bRBv]f쾯!Z/ ([\h]+H7)UI{=/X.$ՆiӘ/P"ui!IY^h<疲B\qE}II Gbx+GD[7p8X8o>EG!-`eB]!~Mze"Rb;xt O X1ʪpRbW,)ኚ)̢c)b ~ޅW5ϑ-" RDↃ\i*n?t61`ӛԬ"t/ko>".U$)LԐd;M$= R"/q!l &YIII%CZ)N8.t7T ͞B䰉6m樋TkMlF똚eSPH‡[ޏx&6`/i*oT祿9jq^Yȵk0AQ4 ~ӄ%it\|ڠ,@u 0U2ͰHWܲp:ML|3Ujw^…[i,P*K  S!Z`{*WpCe)vRfez^_ m:Ix)2gff,-n&NYĸ28w=1 21?%e6=\y=Ut(S4#ac]N +b$Y"EnZ'BZ'C0Qa)Z");nhFgfk톰q,k0BxRjWМ]l=xҫehىHȈ/ %[~t~Bp錛JgK^UH!\432⥺HgG,g=kKX3;,(d&vq]&{bn]Qң&Z뮥zG:C:-UgݤU{Ft)g *0L`W:R ˮUϖ)' bZō*QŒ(b S#KJxbk}Q}rz6^Vlbn}۲m sG@O_gOFKߖnϲ}( 1eWQ5sh.Z67dFj9L5?\Va(XlU˘r6k^u~$-v>$(ya,+QbVaZ1ɲS~zn8. Lp@G*p^Y/qR^5Gt@> |WqTS"ßPz0r5 U0ykBD$3M@k%;pbL*J檗7zz$LF>tZghddYr&jNA@Af)'JL5>XorRRßG,uy[58K9b>١oIx9Y8^r-"\4"2CFkW6bC<]77`{첏ʡ}(ڳ 'eȉU.㞺%WZ+-M8\ w&d>= <{㥵!^[R+nN;i̪ unBYVU"ل8:~d%< +|Ae%KeijYyV&y&V DZ&4Eԡ1 ̀h;%GS1iy+~[;s^K~m=׵UzCx>n8 6ʆa(y ~]D`*z>c|<=x[H+C 2W#V_SFEfWK3Q՟xljBuD6.a%|wBLy;BXa"_u!rM6OYíλ BӻDբ<w*H{)o%9hn,:!2o|Gf}*'.MƍIw WKTqTN.W MˣZ!ŽB)ll opYKavݡK&}Y+PQ;:{E{o|>%\w%~e6=m7[6( rRJg~YP͉>c5һ2[!WYҫ2kv5b(p[֓5{d(5avv?&/#|Sj/+|8mV|h̙#:|Ŗo_:6H%ph u$銥)ָ> 6C&H m~\DTH9ֲTN/Bg%bکv(0>yo4UuPE GuR:ܹen ,o1&3׮'AtIDI^=c_ tbW۫X|Z, {fs5Bc0WhPNK0 ١XS xƹ3}xH#Gˇy2An:[\ĨKU<T ,$!Hv^{"$Y E˃nL5ML.cW>ᮁ{z+_J'f6#r9ң/36bz"wO뀁KǦ0t5@~ߑ靚+ z\JE/ql 1?NH zc?Oo큸w,$m /ؘ+du~@DznV m1흐]~|YY5DAgtr[1851)>l - 0i}EՔ=dO2uHؿ2 Rao۳Ky_bҢ?zSbj7YQ '0Zp$ʃ\Ӯ1S`kiM/,s7JĮDr@Q|\e<'W%m VYфQ"fE've$tqĆ#A m(V3p׉BI^G{P%/jܤSn>M>5 qADsG6p WxI,`,Uf>;Bh\3*PBrD)':iǔ>RJ.UsX&ݼO9z<#%fr#zQtaKmv8X}GbH >`5y2fVdT>cfnݲt;uؚ#t˸e ȕS*p7:8³QeA :QՑWLuW-RTg( dב'ۑ",bR`‘ɔq% Oe-Q^r'qWll4O$N^@&iQŒS'=.KEOO,?B/>X 7iQ#{p}b A(SNAH񯅎:4CmX@%SEO'M܈}Q5{un|Jvr{[|i09psQ&$5^~W( ;D7M@r3!p]b2LWQokz3#p71fJkzb:̅Rc5v}ʃrj|!4.ܖESpR@Pqq?ҟR&X$jQO cw,{72W9S{DSEQ-cp.UYC)zՋ\zTJD nj( %'{1/Iس5"c!n-mr2(Y\J+`H/3)n"+Sx($Va/M=^僋 {b1W!}STcc-tn ̦xUa];HQZ]*y| HJF\= (x~l/U49%#]0P |'s TD fojQp--+?&G3 ę0&d+EJod˿ZB w. r(MwErrCIɊfm[wumyAؑ>"8gӲl.괚o&&*X3payXd~b7lkb!#v#IMOdtVI!^N&㴶/:f&WF.)r /Eѓ=ZӠ"7 `r&ʫnቿlF)_T|7!F||H:Jx6Tt{D~P2K]g>6=iGrf3h'aWkS㠮+`#ñ8((r<{VFeXUԕ#7cb9Sr[1J*a D?||o"p\J͒n y۔^y){&|0M]zdZX tm l2wK0mzt-l-.ccУ"3ɧwriۉg"v;-Tj9zZ+Sw/=nO;(/ł<8_xV9DM WC0%eHG7ASNǔMusآϩS7+y`+x-r`5!lS5EeQ,_Ig_҉{cWt"(zچ\SY~ʋD#f)c١Om#eۚ1Eg D)+] ^r B~#Y{XÚ6GOk\%9at`FN)&{u&[R3~}*+L)TtA?Yb05=h?zHChZsNZfm..;YjRli=b6+0.S1d,q<&6!^<[fMz}P8ub#BVwVU&\-07!<Qf{,rgcmwI.b;U3B3qiB9%ElN8hӒmw4]N%0cև(xy\v>Ǫǎ0=n1mgvpRv%> R)zR }Iy7tE7"s=0b0*d3x5"0f2FZ iYߖ.(CP 1~vs=5BHɔ5z-~1a LׇMY}0Xr9]떝H߮Di7`deCт;jh"NfE8E ?L&0 8 ΜB?붴VEx>QjFtn"B:FtKJ@{D8ƇڦObK#XUAΪăмMhԒvAv\e&`=uNɬϦP%4E}3ٌ\͆d37<8L}~N9ϿCLƢbם"}"OUvG(6`3ٿ2Mpd132FO[^40Ve^s}b fFCnGCo:>Fۧ[2MKgr^9g%"aƌ ΢ٻ^FL3/pp̸U=Px_\8+;B vp]{JPSeԶ ZOsMm|TI;j\=E*}ۮ ܜҧműLiPo>MM4zTawo#, pd!E T[ %Nj}2OX <up(Pv(  x)'H\k$/0nY'eg1%EvzJtKaIFt|,_-?3<ѕU+՟ ]pgc]g)5AI_W8;Zau1B6SϻRܟJ|)ŀ0 7@3sDR1t~MzHj5?m'Y,mu4NUOSmgAQw{:C|`-7Co4|m@9M=:\@79zU LU{U=+@[D D<I<<Ώ-I2fc V@>YqP}' F+tXLIHYy>L,Bd#;9pkU;d`Yx2 ~\^bk"= _+{J~ҋk6VVtTC>NLlAS]7RӉ9r|,#i3UQ8W,J#4[u0089k^7cf{lB6)Yil፟ ud,ة@0}ZjvٻNP׍I+Ocue\xE4 yGhK#ztQ ՐKqƻx 0XRH!։GJB~unRr+X)G&LJW{LXڇLo^'_"!:1Lg657M2N]V=7%5m(fQ֯0ܥselu@_?6>q_K-n i|dpl B{k3mxDu ,_lMͶ)7V̾mSR@Bmsmt"Ͷ8pml6 >XeuEol[\|N4MBx2kN1]^﵆|mIIl=õZ~bm!Ixæ9mhmt$l]ΚYHL4BO\eO,Eݶyw&Vb4KI"> -[MF}څeڅZ,eMa=%|?C8BAma[7-Ѷn*г>m|Z4{e;=yLLZw_X*b_. JrCv!t +-QC}b X1-(yPۆΪ؆Ы>cfB> -_`:Ch/n¤oD>w[œO 3vvɇf=1c;j' ^_D/4ek':Um.9e)wnV#V..|ډT\Iډ8XTaJ ډNyFtV:߈tS>[.xy8`6i17(b{՞c۽)jF2[O|2?n ,V[~8o7۔}PW|n.R!K1~R  p<~d׊g,| VvCu5*3iɖA> eѝiA+ iU&/PZ q+LF$Df}e*ICٙ t~ǺY({qě+)y91_MmvNCrv_mc;^ۭ~@ƤY!y`w Qw}'#K2SLILBk6 Bah0`h@x9{#͝ Sb,s1Ia ˌ$Ɯ\!+nvr ]#6unY} OD>K|6l&pr˄#c]oOCp \I8XgyGX|&Gk#?)w=ޣv#<$But1*$4lvSs611| !ǛyMpm6$O29n:w2v }nybp۝>^0TB%&uM+Şu 1O$6_ vOm0w_9VAe Eūi2oe*2g^}&O93Pnܜ^'ӜR^[ jD,71#ۗ'״4sK\s(Ru, 8V)kތ c4XOo156ֿC 0R /jcCCo0&]1oԔH\ً)!!Q?ile ))S/n|k/!fN43Jnᡴ3D9/]/tg07?p!٧GzW+Xo!cjbt󓻯fŐ1/zO4ue,pb,lD*C߉\S~e*lni1PB4U!*Hʹx=s@0j*El)J.EZe(WOӦ;T\ ,h KaG YMܛlˌRG%{vS~Z'SY`xځWKr$ׂ2|C.sOO3̃<2z±/1^? }h ip*D8ENTPeqgKP'M+etCɁ]q֔i ̎wc/yScE%/grCuh!xF$$]q)}oݕ;2 O݀iiJLO"hۋ̂uTc@ӮԼ] -≍<ʽYy<14ʪhz2KAl kpQ K?agwE0!0*$ dʄ& n9{KWղbgƲF cheR1 <@Ӡ؋O 23'ň 0YW%mA+ z @Z[/QJ_*^du񇺥tϑl:7٠}7uDKu(yÓO([`k lki۵G S3wYeD4104ŨPiD`փYYxMJ2j7`v+$oJ_}j~/|&}  岐O_٨j٬$bȐ7ibZI=IL=뎃ѠaR5v#v},Ӎ|OO3CzDŽO8QXCs>>̇fNBp3.A7Y$5bk(͈mCGw ;kM`ĊF}ne˓=IUtzFG껙fbWFR2Unc|^b7 ߧ_p8Kt-[)6n,)`xSqZ M^)JaEo2^Ynvy3d%*,e҈%|l8U81I,FP4.ߧ4!TL'i6;1LSg{91fy*,%Z/e_+9l9*2 W-D jT/ƌt#5sbk4Zsx4$m''Oף8g#_i>aty'a/Kfrǖ~%^apLf4G|9,UGɩWK?1cޫ"=a{/qI3aESœp-nKn)6EӢѱ59qs<襫fW䢃>趟ƚޭJ}ULw Beʿ{g6'0J3y ]Gd6zUZ K!Zt)DOZ esRX?<þYҲAny>IDžf뱈\$XE[ Ez±1Xb>tꩰ"ch\Ԝ} #Ij$3|͗͜Ͱ#.Qܔ*q!Vӳ>q%ls7~c{M77ĂˍMר2x=_!EmkAk;}:otJnWŮ/vD~ϯ0I'P#bzSURae!;uCRSRsy:5=^}X`,~VyD_/-/`(h6Q ,me5f,⏧cǒ< ˲jmoĒ30cA;6B85pcA2,E`݁D"x0cYe}y޽ +XyD7 >Kr-y^=6'c(Sx޽h&YV Py,i6WA?&,@d9e͸T$X@5edq6m}$,۸@ a@zp;dhcb|R~x󒴁< VZᕇx_</顝rP-!m@n#xe,YJ ,%6,e#>0/ %耺g'G_>8磬 $V5˰20ʐڛauTYfN1^F:IƐiڌb׮ $@ADoD,BFo5;썞) 'gJ@1P?z蒭T¨Α:%dTA,zכ*唝 M])7Se2WJW`ԝk{+VaK-B ka1HHFI'/Z"O֙s é1 : @b{KArflniם ,z`c}/qv_/C*sˍV g뿅:^2([p8Xf 00s! Vp-W*@eL!t0R$\?S9^7qYa!ݾXًm9`2rNKd㗻ŸQOٰâgEQ#d`mj݀u?s>P K O{<,iMʵba]сA<'wFV CD&g?q" 3`WEfJSêt:<;Bi Xʃ&\DR(*Pqpn C ::~ yY'C9,1+T*4y5~b"dN.29OeBM?[*vck*Hm9z#{b|i^VύZ(c+x`ĦWWh\dJJ ؅%bqclO|amI;t&hxPTvh k` NSm둅[ȏwOF$ g@\/{r1;Nb3+um4ߒSV!^g"bSXq_%qCo*3΢K%YeW'74E[YYH9dl~.=zJvKDzb/v) פs PU )}jP^HT+#f'& <3m[cD_ꏇӭjI|k2eסOFjNrԕX~CdXW4vf6P,dXmJ{5^5`stgmT_?X?2'Ҵ /B3P@ ;y]{4ExK/d13 %0b>* 8OF g27ʭ!^ٟ8C?B {2¤0Wq17M#,P2rclLlÇ4# *k9s1ZJSoxr+Rvm30u; >+Үc58Z!da>ʱ}-3 'ӷUa0LVđ:`@^d# {<3ݻl+;Y+;PKH,[G=?7VsJF/'d+kȽ =J'ҳQZg1Q'X^%ȿoVOKA15{X zdG i-4 zUs1㭥?+sNx Eδf6NdwjG(OT wݡ;-L9l6R0'i[f] '"ߴzeVbRJ⡣a[>d{><@!Y(<?v@I39K_[鰙儃&˙rN#f^`{?zpl_sZHԲiԞˏeeޞ Ū]hޛ Bh7qض}IZ&']ܻbŽxwɽWk9r~ڵv#gtuaM_ vvNK^0eN](s;GR0k! b֌d|"CZTQ{2F2 HtS{nʑ]KN^7B9w)^zсV9Gs8> ޥ'GBȹ"^]# Vu0} 6 > ͝Zt-ϽMK{ydv1r;`.l|^|zZ g5G!'!sܹw(n @j_pxMW䈴@%}t.cBSWͷ&1w/CK]ĭE S\J4Xe؀~j52M!dFJĦz(,m0N5[isoڃa#у?EǷťL-[q¹ஃ&(uj/&f90~󑦬$YC58t&xDx@nMP/]h^?  2bKW:$/D-SW>|Mss'ה8cۺ3HӦ~İ,\ r>04%4m282鄶: 5Y |GKwc@E00,;Ff9mKxqN[Q[z-!`X. ˭q?;J}ު(Ĉ& ԧL;siJ[#2u#n}?8)s1x=+w'y9$t|ĈJ/NÊiȷ ДXN["٘v(&ӹKbFgRI6\t@n+;pGf:t8c[fʅcPO Zq3Yh|xެ{`wqQ$ib1Rg s$lbYa}v߯-EeN;6Fۓ~r*'ij" (Σ/1ctY՛HզZ!el8@= 1\t G%+W"VSpˇFa|ӛ CpXHByQ2 cp6hX7s[J}~,΍RJ}VT9ZBB/nV` by B^F"rI:f˳e7ta~8VAgsAh/fwVj2Q~YYW|]Fh=X)'8(ӣ?pD[+)}OG2 x)祖l-ʑQL̗&'SbN}3igz'u(u% uR5lñцD l-B+(ߊOwf{{1dȭQdG|:,/} 9D=ayWzFDHM7KMeZgaCą WrYTP2r2[plzcu[eJ\-Rg =_(if#$~^8Çʛ4%r ,!ȥ6ֶ,OMIjT[DےvgCy2|_1r,\qXhQҁ x)>X36ͥ#8r:^L0YSǗ쒤@jWUǵ#0f΋P'Fbbab~$mY)E5gӟW~"6EtMV3/mQ̾E1G#,HbSKSM XQ 5c9\]3]=1zyxW " GrYؤ1BWJ"I+RlR̯I1abTӤXG̣1Ztgh<ŷ5ĥ֊ȵT^jəTRr"3fr|}8 }WLEKr xj4cbVz͍7_b8"sT8i6z9 ֜gL =^̮>941"0`B+CO!}@s55 {/>\, ^8*eU3F /x^kY` /jqyT=nE=IH|nE#F+!В\N! %;*֝fU]`YO'l4*mk3%3Km(}"|+| ʈa ZS`W'jEF^!?ӳZMoj'׭z` )#$GѳL"}"`.:p*at.RڙJҲ)tmg(%QC`"m_/ʀJZ~e|6!p$0A$N GEbϓYHfq%b%FPVcfD $bG"> '4ɞq$&'=6'l&zrޥNȦnfcHhDp*'Ϻe3yaA3 ?b>Ŷ7*l{(+\܈ō[5 'merF-aF6݈m7eى>DÉ#]e>DP aP1"&>ąC">UC-p2ڏ;~K14D39cFCwrfJ!~AF]78}ݙboٵՁf󕞯0iEbdo3 zZ*h23Z,Qv F d#{$R$@t٭Dg9CtS΢+h|3q%r"ٕS,W3()#swP"<؉wdP r-lEWϢ>1m ⯤FrdǢ eYh} Ú~eqIY({Oʙy?Z\X\ ENfxTeD @X C("Opc1k<;IuJU}=8(]FY4R\2*BP4Ad;a1?SX2nJDI^C6*Yde2#/2h-wI:1 (NCVCI9ID;-`+F@Nxq.(DsYOˇ$nVcR03(Z @V;/4YU&욭zΣi8MQ9钾H`1nk!EEj"',𢘄_a襺[?(<H43cOTWE'jЌs-1ዊR,jIO^aW+v^ {Np|!{po³dC+OB!y7bV7+Hbnd j8Wv%tJEṋ&إex 򒒀k,t=S辍ϭ|1(~ ` KS´ Gp|m#Y;RjI !YI=3ohE%⥮]UT8W297vq꒺DxݨrX5#70X>uU?SSdoSNPfACNvAhZҶ1qZ`!"[9~C0Q4Yџ5SZtFW>a—NRB6Lڟ߈]&cbI4fUNcNͭ[=ZdkM7(`tlIj]ZfE)Mؼ}էORPۗ dCm$7̭1J蹊kPoq֏Pա_bڃSu;} rʟ[יs7\"p#];M7H^K l̍˓$WĕOWe_)zD7)A7CQc'3UG Sg0qEi }OMpA:aFw!'dյk@,Av y/kλdTk;K ld'Jd])]ɐ[) nY$ 1ŋBUu I{s7r{fWhؿiem >AP;kZ);4q(XI?⢧%J-* m+oko*;{z瓪y^s\d=ukz?P[N_|ٓ>IfVt Ip"Brއ!޹3&*ʵF/iOQjɇxv藃/I.Gt! b|k/Z umR]+CEOGvU^: L3 TPuk8#Pnp{D^Hu\rUK|9u{$OB׶&(ޢ 'FlW٥):d)h^Scho:ŎoT/3N)Ɔ?q?FN؂Dt؃ VR޻idsBDACDCbX5~tce3剀M(@Ԥ1}*o`O5i޴+@kBiva0mHf@ G|X[0Wig3 #hȨ?y4BMD/aAi~OT`$xr ޺gԽO*؅bI 0tRIb~q, / >G`T]L` %aFr&tl)Ґ~I :Hq9 1_dV'DN~T1(4d_:4͇27/Mt)AgOko;+~!@ |zv!X*nc9dyn< XL.l.R3 3 [pnmiujUz_$a*۠BOg  Hq `t^ h nYi#am-$ШLs0pdV2҅dbC5 jɭC\ =%a˽OG0tڍox?2KF^[so5Hд7-?w*F܏4m15VIEql9P^UpvĹs~|p*᭰RA H>2Rr0`XZVBGLK8la٫kE2-9~fF1(6Q)lT/V x50P3x雝 푔3VRkbPhHOabDw Mځ}aZ#h0aoBXZ`qJC0$ G 8E(a'dm.&6L ް}'a_q"W{\yt k"Zݶ{MD^#F^(hF•CFpl*Cl68ӟ4z8e=$ψ0M=.t8g0e1CYF 35w> >> >> endobj 2 0 obj << /Type /Page % 1 /Parent 1 0 R /MediaBox [ 0 0 200.204224 302.29306 ] /Contents 4 0 R /Group << /Type /Group /S /Transparency /I true /CS /DeviceRGB >> /Resources 3 0 R >> endobj 1 0 obj << /Type /Pages /Kids [ 2 0 R ] /Count 1 >> endobj 6 0 obj << /Producer (cairo 1.15.10 (http://cairographics.org)) /Creator /CreationDate (D:20200702143407+02'00) >> endobj 7 0 obj << /Type /Catalog /Pages 1 0 R >> endobj xref 0 8 0000000000 65535 f 0000040384 00000 n 0000040153 00000 n 0000040081 00000 n 0000000015 00000 n 0000040057 00000 n 0000040449 00000 n 0000040724 00000 n trailer << /Size 8 /Root 7 0 R /Info 6 0 R >> startxref 40776 %%EOF hierarchy-builder-1.8.1/examples/Coq2020_material/diagram.svg000066400000000000000000014363761474513043100240200ustar00rootroot00000000000000 image/svg+xml Structure Mixin Factory Packager Builder V1 Monoid Ring V2 Monoid Ring AbGroup V3 to_AbGroup_of_Monoid Monoid Ring AbGroup to_Ring_of_AbGroup SemiRing CMonoid Ring AbelianGrp SemiRing_of_CMonoid CMonoid_of_Type AbelianGrp_of_CMonoid The puzzle pieces (mixins) Ring_of_Type The "virtual" puzzle pieces (factories) The hierarchy of structures hierarchy-builder-1.8.1/examples/FSCD2020_material/000077500000000000000000000000001474513043100216445ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/FSCD2020_material/V1.v000066400000000000000000000047611474513043100223310ustar00rootroot00000000000000(* Accompanying material to https://hal.inria.fr/hal-02478907 *) From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. Declare Scope hb_scope. Delimit Scope hb_scope with G. Open Scope hb_scope. (* Bottom mixin in Fig. 1. *) HB.mixin Record Monoid_of_Type M := { zero : M; add : M -> M -> M; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition Monoid := { M of Monoid_of_Type M }. Notation "0" := zero : hb_scope. Infix "+" := (@add _) : hb_scope. (* Left mixin in Fig. 1. *) HB.mixin Record Ring_of_Monoid R of Monoid R := { one : R; opp : R -> R; mul : R -> R -> R; addNr : left_inverse zero opp add; addrN : right_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.structure Definition Ring := { R of Monoid R & Ring_of_Monoid R }. Notation "1" := one : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. Infix "*" := (@mul _) : hb_scope. (********) (* TEST *) (********) Print Monoid.type. (* Monoid.type := { sort : Type; ... } *) Check @add. (* add : forall M : Monoid.type, M -> M -> M *) Check @addNr. (* addNr : forall R : Ring.type, left_inverse zero opp add *) (* https://math.stackexchange.com/questions/346375/commutative-property-of-ring-addition/346682 *) Lemma addrC {R : Ring.type} : commutative (@add R). Proof. have innerC (a b : R) : a + b + (a + b) = a + a + (b + b). by rewrite -[a+b]mul1r -mulrDl mulrDr !mulrDl !mul1r. have addKl (a b c : R) : a + b = a + c -> b = c. apply: can_inj (add a) (add (opp a)) _ _ _. by move=> x; rewrite addrA addNr add0r. have addKr (a b c : R) : b + a = c + a -> b = c. apply: can_inj (add ^~ a) (add ^~ (opp a)) _ _ _. by move=> x; rewrite /= -addrA addrN addr0. move=> x y; apply: addKl (x) _ _ _; apply: addKr (y) _ _ _. by rewrite -!addrA [in RHS]addrA innerC !addrA. Qed. HB.instance Definition Z_Monoid_axioms : Monoid_of_Type Z := Monoid_of_Type.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r. HB.instance Definition Z_Ring_axioms : Ring_of_Monoid Z := Ring_of_Monoid.Build Z 1%Z Z.opp Z.mul Z.add_opp_diag_l Z.add_opp_diag_r Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Lemma exercise (m n : Z) : (n + m) - n * 1 = m. Proof. by rewrite mulr1 (addrC n) -(addrA m) addrN addr0. Qed. hierarchy-builder-1.8.1/examples/FSCD2020_material/V2.v000066400000000000000000000045571474513043100223350ustar00rootroot00000000000000(* Accompanying material to https://hal.inria.fr/hal-02478907 *) From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. Declare Scope hb_scope. Delimit Scope hb_scope with G. Open Scope hb_scope. (* Bottom mixin in Fig. 1. *) HB.mixin Record Monoid_of_Type M := { zero : M; add : M -> M -> M; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition Monoid := { M of Monoid_of_Type M }. Notation "0" := zero : hb_scope. Infix "+" := (@add _) : hb_scope. (* Bottom right mixin in Fig. 1. *) HB.mixin Record AbelianGroup_of_Monoid A of Monoid A := { opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; }. HB.structure Definition AbelianGroup := { A of Monoid A & AbelianGroup_of_Monoid A }. Notation "- x" := (@opp _ x) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Top right mixin in Fig. 1. *) HB.mixin Record Ring_of_AbelianGroup R of AbelianGroup R := { one : R; mul : R -> R -> R; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.structure Definition Ring := { R of AbelianGroup R & Ring_of_AbelianGroup R }. Notation "1" := one : hb_scope. Infix "*" := (@mul _) : hb_scope. Lemma addrN {R : AbelianGroup.type} : right_inverse (zero : R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. (********) (* TEST *) (********) Print Monoid.type. (* Monoid.type := { sort : Type; ... } *) Check @add. (* add : forall M : Monoid.type, M -> M -> M *) Check @addNr. (* addNr : forall R : Ring.type, left_inverse zero opp add *) Check @addrC. (* is now an axiom of abelian groups *) (* addrC : forall R : AbelianGroup.type, commutative add *) HB.instance Definition Z_Monoid_axioms : Monoid_of_Type Z := Monoid_of_Type.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r. (********************************************************) (* This test from V1 FAILS in V2, and is repaired in V3 *) (********************************************************) Fail Definition Z_Ring_axioms : Ring_of_Monoid Z := Ring_of_Monoid.Build Z 1%Z Z.opp Z.mul Z.add_opp_diag_l Z.add_opp_diag_r Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. hierarchy-builder-1.8.1/examples/FSCD2020_material/V3.v000066400000000000000000000072211474513043100223250ustar00rootroot00000000000000(* Accompanying material to https://hal.inria.fr/hal-02478907 *) From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. Declare Scope hb_scope. Delimit Scope hb_scope with G. Open Scope hb_scope. (* Bottom mixin in Fig. 1. *) HB.mixin Record Monoid_of_Type M := { zero : M; add : M -> M -> M; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition Monoid := { M of Monoid_of_Type M }. Notation "0" := zero : hb_scope. Infix "+" := (@add _) : hb_scope. (* Bottom right mixin in Fig. 1. *) HB.mixin Record AbelianGroup_of_Monoid A of Monoid A := { opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; }. HB.structure Definition AbelianGroup := { A of Monoid A & AbelianGroup_of_Monoid A }. Notation "- x" := (@opp _ x) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Top right mixin in Fig. 1. *) HB.mixin Record Ring_of_AbelianGroup R of AbelianGroup R := { one : R; mul : R -> R -> R; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.structure Definition Ring := { R of AbelianGroup R & Ring_of_AbelianGroup R }. Notation "1" := one : hb_scope. Infix "*" := (@mul _) : hb_scope. Lemma addrN {R : AbelianGroup.type} : right_inverse (zero : R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. (* Left factory in Fig. 1. *) HB.factory Record Ring_of_Monoid R of Monoid R := { one : R; opp : R -> R; mul : R -> R -> R; addNr : left_inverse zero opp add; addrN : right_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context (R : Type) (f : Ring_of_Monoid R). Lemma addrC : commutative (add : R -> R -> R). Proof. have innerC (a b : R) : a + b + (a + b) = a + a + (b + b). by rewrite -[a+b]mul1r -mulrDl mulrDr !mulrDl !mul1r. have addKl (a b c : R) : a + b = a + c -> b = c. apply: can_inj (add a) (add (opp a)) _ _ _. by move=> x; rewrite addrA addNr add0r. have addKr (a b c : R) : b + a = c + a -> b = c. apply: can_inj (add ^~ a) (add ^~ (opp a)) _ _ _. by move=> x; rewrite /= -addrA addrN addr0. move=> x y; apply: addKl (x) _ _ _; apply: addKr (y) _ _ _. by rewrite -!addrA [in RHS]addrA innerC !addrA. Qed. (* Builder to the bottom right mixin. *) HB.instance Definition to_AbelianGroup_of_Monoid := AbelianGroup_of_Monoid.Build R opp addrC addNr. (* Builder to the top right mixin. *) HB.instance Definition to_Ring_of_AbelianGroup := Ring_of_AbelianGroup.Build R one mul mulrA mul1r mulr1 mulrDl mulrDr. HB.end. (********) (* TEST *) (********) Print Monoid.type. (* Monoid.type := { sort : Type; ... } *) Check @add. (* add : forall M : Monoid.type, M -> M -> M *) Check @addNr. (* addNr : forall R : AbelianGroup.type, left_inverse 0 opp add *) Check @addrC. (* is still an axiom of abelian groups *) (* addrC : forall R : AbelianGroup.type, commutative add *) HB.instance Definition Z_Monoid_axioms : Monoid_of_Type Z := Monoid_of_Type.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r. HB.instance Definition Z_Ring_axioms : Ring_of_Monoid Z := Ring_of_Monoid.Build Z 1%Z Z.opp Z.mul Z.add_opp_diag_l Z.add_opp_diag_r Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Lemma exercise (m n : Z) : (n + m) - n * 1 = m. Proof. by rewrite mulr1 (addrC n) -(addrA m) addrN addr0. Qed. hierarchy-builder-1.8.1/examples/FSCD2020_material/V4.v000066400000000000000000000122201474513043100223210ustar00rootroot00000000000000(* Accompanying material to https://hal.inria.fr/hal-02478907 *) From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. Declare Scope hb_scope. Delimit Scope hb_scope with G. Open Scope hb_scope. (* Bottom mixin in Fig. 2. *) HB.mixin Record Monoid_of_Type M := { zero : M; add : M -> M -> M; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition Monoid := { M of Monoid_of_Type M }. Notation "0" := zero : hb_scope. Infix "+" := (@add _) : hb_scope. (* Bottom right mixin in Fig. 2. *) HB.mixin Record AbelianGroup_of_Monoid A of Monoid A := { opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; }. HB.structure Definition AbelianGroup := { A of Monoid A & AbelianGroup_of_Monoid A }. Notation "- x" := (@opp _ x) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Bottom left mixin in Fig. 2. *) HB.mixin Record SemiRing_of_Monoid S of Monoid S := { one : S; mul : S -> S -> S; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; mul0r : left_zero zero mul; mulr0 : right_zero zero mul; }. HB.structure Definition SemiRing := { S of Monoid S & SemiRing_of_Monoid S }. Notation "1" := one : hb_scope. Infix "*" := (@mul _) : hb_scope. Lemma addrN {A : AbelianGroup.type} : right_inverse (zero : A) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. (* Top right factory in Fig. 2. *) HB.factory Record Ring_of_AbelianGroup R of AbelianGroup R := { one : R; mul : R -> R -> R; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. (* Builder arrow from top right to bottom left in Fig. 2. *) HB.builders Context (R : Type) (f : Ring_of_AbelianGroup R). Fact mul0r : left_zero zero mul. Proof. move=> x; rewrite -[LHS]add0r addrC. rewrite -{2}(addNr (mul x x)) (addrC (opp _)) addrA. by rewrite -mulrDl add0r addrC addNr. Qed. Fact mulr0 : right_zero zero mul. Proof. move=> x; rewrite -[LHS]add0r addrC. rewrite -{2}(addNr (mul x x)) (addrC (opp _)) addrA. by rewrite -mulrDr add0r addrC addNr. Qed. HB.instance Definition to_SemiRing_of_Monoid := SemiRing_of_Monoid.Build R _ mul mulrA mul1r mulr1 mulrDl mulrDr mul0r mulr0. HB.end. HB.structure Definition Ring := { R of AbelianGroup R & Ring_of_AbelianGroup R }. (* Top left factory in Fig. 2. *) (* It is an exact copy of the bottom right mixin. *) HB.factory Definition Ring_of_SemiRing R of SemiRing R := AbelianGroup_of_Monoid R. (* The corresponding builder is the identity. *) HB.builders Context (R : Type) (f : Ring_of_SemiRing R). HB.instance Definition to_AbelianGroup_of_Monoid : AbelianGroup_of_Monoid R := f. HB.end. (* Right-most factory in Fig. 2. *) HB.factory Record Ring_of_Monoid R of Monoid R := { one : R; opp : R -> R; mul : R -> R -> R; addNr : left_inverse zero opp add; addrN : right_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context (R : Type) (f : Ring_of_Monoid R). Lemma addrC : commutative (add : R -> R -> R). Proof. (* Exactly the same as in Appendix B. *) have innerC (a b : R) : a + b + (a + b) = a + a + (b + b). by rewrite -[a+b]mul1r -mulrDl mulrDr !mulrDl !mul1r. have addKl (a b c : R) : a + b = a + c -> b = c. apply: can_inj (add a) (add (opp a)) _ _ _. by move=> x; rewrite addrA addNr add0r. have addKr (a b c : R) : b + a = c + a -> b = c. apply: can_inj (add ^~ a) (add ^~ (opp a)) _ _ _. by move=> x; rewrite /= -addrA addrN addr0. move=> x y; apply: addKl (x) _ _ _; apply: addKr (y) _ _ _. by rewrite -!addrA [in RHS]addrA innerC !addrA. Qed. (* Builder to the bottom right mixin. *) HB.instance Definition to_AbelianGroup_of_Monoid := AbelianGroup_of_Monoid.Build R opp addrC addNr. (* Builder to the top right factory, which is compiled to the bottom left mixin. *) HB.instance Definition to_Ring_of_AbelianGroup := Ring_of_AbelianGroup.Build R one mul mulrA mul1r mulr1 mulrDl mulrDr. HB.end. (********) (* TEST *) (********) Print Monoid.type. (* Monoid.type := { sort : Type; ... } *) Check @add. (* add : forall M : Monoid.type, M -> M -> M *) Check @addNr. (* addNr : forall R : AbelianGroup.type, left_inverse 0 opp add *) Check @addrC. (* is still an axiom of abelian groups *) (* addrC : forall R : AbelianGroup.type, commutative add *) HB.instance Definition Z_Monoid_axioms : Monoid_of_Type Z := Monoid_of_Type.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r. HB.instance Definition Z_Ring_axioms : Ring_of_Monoid Z := Ring_of_Monoid.Build Z 1%Z Z.opp Z.mul Z.add_opp_diag_l Z.add_opp_diag_r Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Lemma exercise (m n : Z) : (n + m) - n * 1 = m. Proof. by rewrite mulr1 (addrC n) -(addrA m) addrN addr0. Qed. hierarchy-builder-1.8.1/examples/FSCD2020_talk/000077500000000000000000000000001474513043100210015ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/FSCD2020_talk/V1.v000066400000000000000000000007611474513043100214620ustar00rootroot00000000000000Require Import ZArith ssreflect ssrfun. From HB Require Import structures. HB.mixin Record is_monoid (M : Type) := { zero : M; add : M -> M -> M; addrA : associative add; (* add is associative. *) add0r : left_id zero add; (* zero is the neutral *) addr0 : right_id zero add; (* element wrt add. *) }. HB.structure Definition Monoid := { M & is_monoid M }. HB.instance Definition Z_is_monoid : is_monoid Z := is_monoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r. hierarchy-builder-1.8.1/examples/FSCD2020_talk/V2.v000066400000000000000000000010531474513043100214560ustar00rootroot00000000000000Require Import ZArith ssreflect ssrfun. From HB Require Import structures. HB.mixin Record is_semigroup (S : Type) := { add : S -> S -> S; addrA : associative add; }. HB.structure Definition SemiGroup := { S & is_semigroup S }. HB.mixin Record monoid_of_semigroup (M : Type) & is_semigroup M := { zero : M; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition Monoid := { M & monoid_of_semigroup M }. (* is_monoid does not exist anymore *) Fail Check is_monoid. HB.mixin Record xxxx P A := { F : bool }. hierarchy-builder-1.8.1/examples/FSCD2020_talk/V3.v000066400000000000000000000017601474513043100214640ustar00rootroot00000000000000Require Import ZArith ssreflect ssrfun. From HB Require Import structures. HB.mixin Record is_semigroup (S : Type) := { add : S -> S -> S; addrA : associative add; }. HB.structure Definition SemiGroup := { S & is_semigroup S }. HB.mixin Record monoid_of_semigroup (M : Type) & is_semigroup M := { zero : M; add0r : left_id zero add; addr0 : right_id zero add; }. HB.factory Record is_monoid (M : Type) := { zero : M; add : M -> M -> M; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.builders Context (M : Type) (f : is_monoid M). HB.instance Definition is_monoid_semigroup : is_semigroup M := is_semigroup.Build M add addrA. HB.instance Definition is_monoid_monoid : monoid_of_semigroup M := monoid_of_semigroup.Build M zero add0r addr0. HB.end. HB.structure Definition Monoid := { M & is_monoid M }. HB.instance Definition Z_is_monoid : is_monoid Z := is_monoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r. hierarchy-builder-1.8.1/examples/GReTA_talk/000077500000000000000000000000001474513043100206605ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/GReTA_talk/V1.v000066400000000000000000000007621474513043100213420ustar00rootroot00000000000000Require Import ZArith ssreflect ssrfun. From HB Require Import structures. HB.mixin Record is_monoid (M : Type) := { zero : M; add : M -> M -> M; addrA : associative add; (* add is associative. *) add0r : forall x, add zero x = x; (* zero is neutral *) addr0 : forall x, add x zero = x; (* wrt add. *) }. HB.structure Definition Monoid := { M of is_monoid M }. HB.instance Definition Z_is_monoid : is_monoid Z := is_monoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r.hierarchy-builder-1.8.1/examples/GReTA_talk/V2.v000066400000000000000000000012651474513043100213420ustar00rootroot00000000000000Require Import ZArith ssreflect ssrfun. From HB Require Import structures. HB.mixin Record is_semigroup (S : Type) := { add : S -> S -> S; addrA : associative add; }. HB.structure Definition SemiGroup := { S of is_semigroup S }. HB.mixin Record semigroup_is_monoid M of is_semigroup M := { zero : M; add0r : forall x, add zero x = x; addr0 : forall x, add x zero = x; }. HB.structure Definition Monoid := { M of is_semigroup M & semigroup_is_monoid M }. (* is_monoid does not exist anymore *) Fail Check is_monoid. HB.instance Definition Z_is_monoid : is_monoid Z := is_monoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r. HB.mixin Record xxxx P A := { F : bool }. hierarchy-builder-1.8.1/examples/GReTA_talk/V3.v000066400000000000000000000017411474513043100213420ustar00rootroot00000000000000Require Import ZArith ssreflect ssrfun. From HB Require Import structures. HB.mixin Record is_semigroup (S : Type) := { add : S -> S -> S; addrA : associative add; }. HB.structure Definition SemiGroup := { S & is_semigroup S }. HB.mixin Record semigroup_is_monoid M of is_semigroup M := { zero : M; add0r : forall x, add zero x = x; addr0 : forall x, add x zero = x; }. HB.factory Record is_monoid (M : Type) := { zero : M; add : M -> M -> M; addrA : associative add; add0r : forall x, add zero x = x; addr0 : forall x, add x zero = x; }. HB.builders Context (M : Type) (f : is_monoid M). HB.instance Definition _ : is_semigroup M := is_semigroup.Build M add addrA. HB.instance Definition _ : semigroup_is_monoid M := semigroup_is_monoid.Build M zero add0r addr0. HB.end. HB.structure Definition Monoid := { M & is_monoid M }. HB.instance Definition Z_is_monoid : is_monoid Z := is_monoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r. hierarchy-builder-1.8.1/examples/GReTA_talk/V4.v000066400000000000000000000033001474513043100213340ustar00rootroot00000000000000Require Import ZArith ssreflect ssrfun. From HB Require Import structures. HB.mixin Record is_semigroup (S : Type) := { add : S -> S -> S; addrA : associative add; }. HB.structure Definition SemiGroup := { S & is_semigroup S }. HB.mixin Record semigroup_is_monoid M of is_semigroup M := { zero : M; add0r : forall x, add zero x = x; addr0 : forall x, add x zero = x; }. HB.factory Record is_monoid M := { zero : M; add : M -> M -> M; addrA : associative add; add0r : forall x, add zero x = x; addr0 : forall x, add x zero = x; }. HB.builders Context (M : Type) of is_monoid M. HB.instance Definition _ := is_semigroup.Build M add addrA. HB.instance Definition _ := semigroup_is_monoid.Build M zero add0r addr0. HB.end. HB.structure Definition Monoid := { M & is_monoid M }. HB.mixin Record monoid_is_group G of is_monoid G := { opp : G -> G; subrr : forall x, add x (opp x) = zero; addNr : forall x, add (opp x) x = zero; }. HB.factory Record is_group G := { zero : G; add : G -> G -> G; opp : G -> G; addrA : associative add; add0r : forall x, add zero x = x; (* addr0 : forall x, add x zero = x; (* spurious *) *) subrr : forall x, add x (opp x) = zero; addNr : forall x, add (opp x) x = zero; }. HB.builders Context G of is_group G. Let addr0 : forall x, add x zero = x. Proof. by move=> x; rewrite -(addNr x) addrA subrr add0r. Qed. HB.instance Definition _ := is_monoid.Build G zero add addrA add0r addr0. HB.instance Definition _ := monoid_is_group.Build G opp subrr addNr. HB.end. HB.instance Definition Z_is_group : is_group Z := is_group.Build Z 0%Z Z.add Z.opp Z.add_assoc Z.add_0_l (* Z.add_0_r (*spurious *) *) Z.sub_diag Z.add_opp_diag_l.hierarchy-builder-1.8.1/examples/cat/000077500000000000000000000000001474513043100175125ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/cat/cat.v000066400000000000000000001073051474513043100204560ustar00rootroot00000000000000Require Import ssreflect ssrfun. From HB Require Import structures. Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive. Add Search Blacklist "__canonical__". Declare Scope algebra_scope. Delimit Scope algebra_scope with A. Local Open Scope algebra_scope. Declare Scope cat_scope. Delimit Scope cat_scope with cat. Local Open Scope cat_scope. (* we assume a few axioms to make life easier *) Axiom funext : forall {T : Type} {U : T -> Type} [f g : forall t, U t], (forall t, f t = g t) -> f = g. Axiom propext : forall P Q : Prop, P <-> Q -> P = Q. Axiom Prop_irrelevance : forall (P : Prop) (x y : P), x = y. (* Shortcut *) Notation U := Type. (* Base definition : raw categories = quivers *) HB.mixin Record IsQuiver C := { hom : C -> C -> U }. Unset Universe Checking. #[short(type="quiver")] HB.structure Definition Quiver : Set := { C of IsQuiver C }. Set Universe Checking. Bind Scope cat_scope with quiver. Bind Scope cat_scope with hom. Arguments hom {C} : rename. Notation homs T := (@hom T _ _). Notation "a ~> b" := (hom a b) (at level 99, b at level 200, format "a ~> b") : cat_scope. Notation "a ~>_ C b" := (@hom C a b) (at level 99, C at level 0, only parsing) : cat_scope. (* precategories are quivers + id and comp *) HB.mixin Record Quiver_IsPreCat C of Quiver C := { idmap : forall (a : C), a ~> a; comp : forall (a b c : C), (a ~> b) -> (b ~> c) -> (a ~> c); }. HB.factory Record IsPreCat C := { hom : C -> C -> U; idmap : forall (a : C), hom a a; comp : forall (a b c : C), hom a b -> hom b c -> hom a c; }. HB.builders Context C of IsPreCat C. HB.instance Definition _ := IsQuiver.Build C hom. HB.instance Definition _ := Quiver_IsPreCat.Build C idmap comp. HB.end. Unset Universe Checking. #[short(type="precat")] HB.structure Definition PreCat : Set := { C of IsPreCat C }. Set Universe Checking. Bind Scope cat_scope with precat. Arguments idmap {C} {a} : rename. Arguments comp {C} {a b c} : rename. Notation "f \o g" := (comp g f) : cat_scope. Notation "f \; g :> T" := (@comp T _ _ _ f g) (at level 60, g, T at level 60, format "f \; g :> T", only parsing) : cat_scope. Notation "f \; g" := (comp f g) : cat_scope. Notation "\idmap_ a" := (@idmap _ a) (only parsing, at level 0) : cat_scope. (* categories are precategories + laws *) HB.mixin Record PreCat_IsCat C of PreCat C := { comp1o : forall (a b : C) (f : a ~> b), idmap \; f = f; compo1 : forall (a b : C) (f : a ~> b), f \; idmap = f; compoA : forall (a b c d : C) (f : a ~> b) (g : b ~> c) (h : c ~> d), f \; (g \; h) = (f \; g) \; h }. Unset Universe Checking. #[short(type="cat")] HB.structure Definition Cat : Set := { C of PreCat_IsCat C & IsPreCat C }. Set Universe Checking. Bind Scope cat_scope with cat. Arguments compo1 {C a b} : rename. Arguments comp1o {C a b} : rename. Arguments compoA {C a b c d} : rename. (* the discrete category on a type cannot be the default, we make an alias *) Definition discrete (T : U) := T. HB.instance Definition _ T := @IsPreCat.Build (discrete T) (fun x y => x = y) (fun=> erefl) (@etrans _). Lemma etransA T (a b c d : discrete T) (f : a ~> b) (g : b ~> c) (h : c ~> d) : f \; (g \; h) = (f \; g) \; h. Proof. by rewrite /idmap/comp/=; case: _ / h; case: _ / g. Qed. HB.instance Definition _ T := PreCat_IsCat.Build (discrete T) (@etrans_id _) (fun _ _ _ => erefl) (@etransA _). (* the category of the unit type is the discrete one *) HB.instance Definition _ := Cat.copy unit (discrete unit). HB.instance Definition _ := @IsPreCat.Build U (fun A B => A -> B) (fun a => idfun) (fun a b c (f : a -> b) (g : b -> c) => (g \o f)%FUN). HB.instance Definition _ := PreCat_IsCat.Build U (fun _ _ _ => erefl) (fun _ _ _ => erefl) (fun _ _ _ _ _ _ _ => erefl). Lemma Ucomp (X Y Z : U) (f : X ~> Y) (g : Y ~> Z) : f \; g = (g \o f)%FUN. Proof. by []. Qed. Lemma Ucompx (X Y Z : U) (f : X ~> Y) (g : Y ~> Z) x : (f \; g) x = g (f x). Proof. by []. Qed. Lemma U1 (X : U) : \idmap_X = idfun. Proof. by []. Qed. Lemma U1x (X : U) x : \idmap_X x = x. Proof. by []. Qed. (* a prefunctor is a functor without laws *) HB.mixin Record IsPreFunctor (C D : quiver) (F : C -> D) := { Fhom : forall (a b : C), (a ~> b) -> (F a ~> F b) }. Unset Universe Checking. HB.structure Definition PreFunctor (C D : quiver) : Set := { F of IsPreFunctor C D F }. Set Universe Checking. HB.instance Definition _ := IsQuiver.Build quiver PreFunctor.type. Notation "F ^$" := (@Fhom _ _ F _ _) (at level 1, format "F ^$") : cat_scope. Notation "F <$> f" := (@Fhom _ _ F _ _ f) (at level 58, format "F <$> f", right associativity) : cat_scope. (* prefunctors are equal if their object and hom part are respectively equal *) Lemma prefunctorP (C D : quiver) (F G : C ~> D) (eqFG : F =1 G) : let homF a b F := F a ~> F b in (forall a b f, eq_rect _ (homF a b) (F <$> f) _ (funext eqFG) = G <$> f) -> F = G. Proof. move: F G => [F [[/= Fhom]]] [G [[/= Ghom]]] in eqFG *. case: _ / (funext eqFG) => /= in Ghom * => eqFGhom. congr PreFunctor.Pack; congr PreFunctor.Class; congr IsPreFunctor.Axioms_. by do 3!apply: funext=> ?. Qed. (* a functor is a prefunctor + laws for id and comp *) HB.mixin Record PreFunctor_IsFunctor (C D : precat) (F : C -> D) of @PreFunctor C D F := { F1 : forall (a : C), F <$> \idmap_a = idmap; Fcomp : forall (a b c : C) (f : a ~> b) (g : b ~> c), F <$> (f \; g) = F <$> f \; F <$> g; }. Unset Universe Checking. (* precat and cat have a quiver structure *) HB.structure Definition Functor (C D : precat) : Set := { F of IsPreFunctor C D F & PreFunctor_IsFunctor C D F }. Set Universe Checking. HB.instance Definition _ := IsQuiver.Build precat Functor.type. HB.instance Definition _ := IsQuiver.Build cat Functor.type. (* functor equality is the same as prefunctor because of PI *) Lemma functorP (C D : precat) (F G : C ~> D) (eqFG : F =1 G) : let homF a b F := F a ~> F b in (forall a b f, eq_rect _ (homF a b) (F^$ f) _ (funext eqFG) = G^$ f) -> F = G. Proof. move=> /= /prefunctorP {eqFG}. case: F G => [F [/= Fm Fm']] [G [/= Gm Gm']]//=. move=> [_] /EqdepFacts.eq_sigT_iff_eq_dep eqFG. case: _ / eqFG in Gm' *. congr Functor.Pack; congr Functor.Class. case: Fm' Gm' => [F1 Fc] [G1 Gc]. by congr PreFunctor_IsFunctor.Axioms_; apply: Prop_irrelevance. Qed. (* the identity function is a functor *) HB.instance Definition _ (C : quiver) := IsPreFunctor.Build C C idfun (fun a b => idfun). HB.instance Definition _ (C : precat) := PreFunctor_IsFunctor.Build C C idfun (fun=> erefl) (fun _ _ _ _ _ => erefl). (* the composition of prefunctors *) Section comp_prefunctor. Context {C D E : quiver} {F : C ~> D} {G : D ~> E}. HB.instance Definition _ := IsPreFunctor.Build C E (G \o F)%FUN (fun a b f => G <$> F <$> f). Lemma comp_Fun (a b : C) (f : a ~> b) : (G \o F)%FUN <$> f = G <$> (F <$> f). Proof. by []. Qed. End comp_prefunctor. Section comp_functor. Context {C D E : precat} {F : C ~> D} {G : D ~> E}. Lemma comp_F1 (a : C) : (G \o F)%FUN <$> \idmap_a = idmap. Proof. by rewrite !comp_Fun !F1. Qed. Lemma comp_Fcomp (a b c : C) (f : a ~> b) (g : b ~> c) : (G \o F)%FUN <$> (f \; g) = (G \o F)%FUN <$> f \; (G \o F)%FUN <$> g. Proof. by rewrite !comp_Fun !Fcomp. Qed. HB.instance Definition _ := PreFunctor_IsFunctor.Build C E (G \o F)%FUN comp_F1 comp_Fcomp. End comp_functor. (* precat and cat have a precategory structure *) HB.instance Definition _ := Quiver_IsPreCat.Build precat (fun=> idfun) (fun C D E (F : C ~> D) (G : D ~> E) => (G \o F)%FUN). HB.instance Definition _ := Quiver_IsPreCat.Build cat (fun=> idfun) (fun C D E (F : C ~> D) (G : D ~> E) => (G \o F)%FUN). Lemma funext_frefl A B (f : A -> B) : funext (frefl f) = erefl. Proof. exact: Prop_irrelevance. Qed. (* precategories and categories form a category *) Definition precat_cat : PreCat_IsCat precat. Proof. by split=> [C D F|C D F|C D C' D' F G H]; apply/functorP => a b f /=; rewrite funext_frefl. Qed. HB.instance Definition _ := precat_cat. Definition cat_cat : PreCat_IsCat cat. Proof. by split=> [C D F|C D F|C D C' D' F G H]; apply/functorP => a b f /=; rewrite funext_frefl. Qed. HB.instance Definition _ := cat_cat. Check (cat : cat). (* concrete categories *) HB.mixin Record Quiver_IsPreConcrete T of Quiver T := { concrete : T -> U; concrete_fun : forall (a b : T), (a ~> b) -> concrete a -> concrete b; }. Unset Universe Checking. #[short(type="preconcrete_quiver")] HB.structure Definition PreConcreteQuiver : Set := { C of Quiver_IsPreConcrete C & IsQuiver C }. Set Universe Checking. Coercion concrete : PreConcreteQuiver.sort >-> Sortclass. HB.mixin Record PreConcrete_IsConcrete T of PreConcreteQuiver T := { concrete_fun_inj : forall (a b : T), injective (concrete_fun a b) }. Unset Universe Checking. #[short(type="concrete_quiver")] HB.structure Definition ConcreteQuiver : Set := { C of PreConcreteQuiver C & PreConcrete_IsConcrete C }. Set Universe Checking. HB.instance Definition _ (C : ConcreteQuiver.type) := IsPreFunctor.Build _ _ (concrete : C -> U) concrete_fun. HB.mixin Record PreCat_IsConcrete T of ConcreteQuiver T & PreCat T := { concrete1 : forall (a : T), concrete <$> \idmap_a = idfun; concrete_comp : forall (a b c : T) (f : a ~> b) (g : b ~> c), concrete <$> (f \; g) = ((concrete <$> g) \o (concrete <$> f))%FUN; }. Unset Universe Checking. #[short(type="concrete_precat")] HB.structure Definition ConcretePreCat : Set := { C of PreCat C & ConcreteQuiver C & PreCat_IsConcrete C }. #[short(type="concrete_cat")] HB.structure Definition ConcreteCat : Set := { C of Cat C & ConcreteQuiver C & PreCat_IsConcrete C }. Set Universe Checking. HB.instance Definition _ (C : concrete_precat) := PreFunctor_IsFunctor.Build C U concrete (@concrete1 _) (@concrete_comp _). HB.instance Definition _ (C : ConcreteCat.type) := PreFunctor_IsFunctor.Build C U concrete (@concrete1 _) (@concrete_comp _). HB.instance Definition _ := Quiver_IsPreConcrete.Build U (fun _ _ => id). HB.instance Definition _ := PreConcrete_IsConcrete.Build U (fun _ _ _ _ => id). HB.instance Definition _ := PreCat_IsConcrete.Build U (fun=> erefl) (fun _ _ _ _ _ => erefl). Unset Universe Checking. HB.instance Definition _ := Quiver_IsPreConcrete.Build quiver (fun _ _ => id). HB.instance Definition _ := Quiver_IsPreConcrete.Build precat (fun _ _ => id). HB.instance Definition _ := Quiver_IsPreConcrete.Build cat (fun _ _ => id). Lemma quiver_concrete_subproof : PreConcrete_IsConcrete quiver. Proof. constructor=> C D F G FG; apply: prefunctorP. by move=> x; congr (_ x); apply: FG. by move=> *; apply: Prop_irrelevance. Qed. HB.instance Definition _ := quiver_concrete_subproof. Lemma precat_concrete_subproof : PreConcrete_IsConcrete precat. Proof. constructor=> C D F G FG; apply: functorP. by move=> x; congr (_ x); apply: FG. by move=> *; apply: Prop_irrelevance. Qed. HB.instance Definition _ := precat_concrete_subproof. Lemma cat_concrete_subproof : PreConcrete_IsConcrete cat. Proof. constructor=> C D F G FG; apply: functorP. by move=> x; congr (_ x); apply: FG. by move=> *; apply: Prop_irrelevance. Qed. HB.instance Definition _ := cat_concrete_subproof. HB.instance Definition _ := PreCat_IsConcrete.Build precat (fun=> erefl) (fun _ _ _ _ _ => erefl). HB.instance Definition _ := PreCat_IsConcrete.Build cat (fun=> erefl) (fun _ _ _ _ _ => erefl). Set Universe Checking. (* constant functor *) Definition cst (C D : quiver) (c : C) := fun of D => c. Arguments cst {C} D c. HB.instance Definition _ {C D : precat} (c : C) := IsPreFunctor.Build D C (cst D c) (fun _ _ _ => idmap). HB.instance Definition _ {C D : cat} (c : C) := PreFunctor_IsFunctor.Build D C (cst D c) (fun=> erefl) (fun _ _ _ _ _ => esym (compo1 idmap)). (* opposite category *) Definition catop (C : U) : U := C. Notation "C ^op" := (catop C) (at level 10, format "C ^op") : cat_scope. HB.instance Definition _ (C : quiver) := IsQuiver.Build (C^op) (fun a b => hom b a). HB.instance Definition _ (C : precat) := Quiver_IsPreCat.Build (C^op) (fun=> idmap) (fun _ _ _ f g => g \; f). HB.instance Definition _ (C : cat) := PreCat_IsCat.Build (C^op) (fun _ _ _ => compo1 _) (fun _ _ _ => comp1o _) (fun _ _ _ _ _ _ _ => esym (compoA _ _ _)). HB.instance Definition _ {C : precat} {c : C} := IsPreFunctor.Build C _ (hom c) (fun a b f g => g \; f). Lemma hom_Fhom_subproof (C : cat) (x : C) : PreFunctor_IsFunctor _ _ (hom x). Proof. by split=> *; apply/funext => h; [apply: compo1 | apply: compoA]. Qed. HB.instance Definition _ {C : cat} {c : C} := hom_Fhom_subproof c. Check fun (C : cat) (x : C) => hom x : C ~>_cat U. Lemma hom_op {C : quiver} (c : C^op) : hom c = (@hom C)^~ c. Proof. reflexivity. Qed. Lemma homFhomx {C : precat} (a b c : C) (f : a ~> b) (g : c ~> a) : (hom c <$> f) g = g \; f. Proof. reflexivity. Qed. (* nary product of categories *) Definition dprod {I : U} (C : I -> U) := forall i, C i. Section hom_dprod. Context {I : U} (C : I -> quiver). Definition dprod_hom_subdef (a b : dprod C) := forall i, a i ~> b i. HB.instance Definition _ := IsQuiver.Build (dprod C) dprod_hom_subdef. End hom_dprod. Arguments dprod_hom_subdef /. Section precat_dprod. Context {I : U} (C : I -> precat). Definition dprod_idmap_subdef (a : dprod C) : a ~> a := fun=> idmap. Definition dprod_comp_subdef (a b c : dprod C) (f : a ~> b) (g : b ~> c) : a ~> c := fun i => f i \; g i. HB.instance Definition _ := IsPreCat.Build (dprod C) dprod_idmap_subdef dprod_comp_subdef. End precat_dprod. Arguments dprod_idmap_subdef /. Arguments dprod_comp_subdef /. Section cat_dprod. Context {I : U} (C : I -> cat). Local Notation type := (dprod C). Lemma dprod_is_cat : PreCat_IsCat type. Proof. split=> [a b f|a b f|a b c d f g h]; apply/funext => i; [exact: comp1o | exact: compo1 | exact: compoA]. Qed. HB.instance Definition _ := dprod_is_cat. End cat_dprod. (* binary product *) Section hom_prod. Context {C D : quiver}. Definition prod_hom_subdef (a b : C * D) := ((a.1 ~> b.1) * (a.2 ~> b.2))%type. HB.instance Definition _ := IsQuiver.Build (C * D)%type prod_hom_subdef. End hom_prod. Section precat_prod. Context {C D : precat}. HB.instance Definition _ := IsPreCat.Build (C * D)%type (fun=> (idmap, idmap)) (fun a b c (f : a ~> b) (g : b ~> c) => (f.1 \; g.1, f.2 \; g.2)). End precat_prod. Section cat_prod. Context {C D : cat}. Local Notation type := (C * D)%type. Lemma prod_is_cat : PreCat_IsCat type. Proof. split=> [[a1 a2] [b1 b2] [f1 f2]|[a1 a2] [b1 b2] [f1 f2]| [a1 a2] [b1 b2] [c1 c2] [d1 d2] [f1 f2] [g1 g2] [h1 h2]]; congr (_, _) => //=; by [exact: comp1o | exact: compo1 | exact: compoA]. Qed. HB.instance Definition _ := prod_is_cat. End cat_prod. (* naturality *) HB.mixin Record IsNatural (C D : precat) (F G : C ~>_quiver D) (n : forall c, F c ~> G c) := { natural : forall (a b : C) (f : a ~> b), F <$> f \; n b = n a \; G <$> f }. Unset Universe Checking. HB.structure Definition Natural (C D : precat) (F G : C ~>_quiver D) : Set := { n of @IsNatural C D F G n }. Set Universe Checking. HB.instance Definition _ (C D : precat) := IsQuiver.Build (PreFunctor.type C D) (@Natural.type C D). HB.instance Definition _ (C D : cat) := IsQuiver.Build (Functor.type C D) (@Natural.type C D). Arguments natural {C D F G} n [a b] f : rename. Check fun (C D : cat) (F G : C ~> D) => F ~>_(C ~>_cat D) G. Lemma naturalx (C : precat) (D : concrete_precat) (F G : C ~>_quiver D) (n : F ~> G) (a b : C) (f : a ~> b) g : (concrete <$> n b) ((concrete <$> F <$> f) g) = (concrete <$> G <$> f) ((concrete <$> n a) g). Proof. have /(congr1 (fun h => (concrete <$> h) g)) := natural n f. by rewrite !Fcomp. Qed. Arguments naturalx {C D F G} n [a b] f. Lemma naturalU (C : precat) (F G : C ~>_quiver U) (n : F ~> G) (a b : C) (f : a ~> b) g : n b (F^$ f g) = G^$ f (n a g). Proof. exact: (naturalx n). Qed. Lemma natP (C D : precat) (F G : C ~>_quiver D) (n m : F ~> G) : Natural.sort n = Natural.sort m -> n = m. Proof. case: n m => [/= n nP] [/= m mP] enm. elim: _ / enm in mP *; congr Natural.Pack. case: nP mP => [[?]] [[?]]; congr Natural.Class. congr IsNatural.Axioms_. exact: Prop_irrelevance. Qed. Notation "F ~~> G" := (F ~>_(homs quiver) G) (at level 99, G at level 200, format "F ~~> G"). Notation "F ~~> G :> C ~> D" := (F ~> G :> (C ~>_quiver D)) (at level 99, G at level 200, C, D at level 0, format "F ~~> G :> C ~> D"). Definition natural_id {C D : precat} (F : C ~>_quiver D) (a : C) := \idmap_(F a). Definition natural_id_natural (C D : cat) (F : C ~>_quiver D) : IsNatural C D F F (natural_id F). Proof. by constructor=> a b f; rewrite /natural_id/= compo1 comp1o. Qed. HB.instance Definition _ C D F := @natural_id_natural C D F. Check fun {C D : cat} (F : C ~>_quiver D) => natural_id F : F ~> F. Definition natural_comp {C D : precat} (F G H : C ~>_quiver D) (m : F ~> G) (n : G ~> H) (a : C) := m a \; n a. Definition natural_comp_natural (C D : cat) (F G H : C ~>_quiver D) m n : IsNatural C D F H (@natural_comp C D F G H m n). Proof. constructor=> a b f; rewrite /natural_comp/=. by rewrite compoA natural -compoA natural compoA. Qed. HB.instance Definition _ C D F G H m n := @natural_comp_natural C D F G H m n. HB.instance Definition _ {C D : cat} := Quiver_IsPreCat.Build (PreFunctor.type C D) natural_id natural_comp. HB.instance Definition _ {C D : cat} := Quiver_IsPreCat.Build (Functor.type C D) natural_id natural_comp. Lemma prefunctor_cat {C D : cat} : PreCat_IsCat (PreFunctor.type C D). Proof. constructor => [F G f|F G f|F G H J f g h]. - by apply/natP/funext => a; rewrite /= /natural_comp comp1o. - by apply/natP/funext => a; rewrite /= /natural_comp compo1. - by apply/natP/funext => a; rewrite /= /natural_comp compoA. Qed. HB.instance Definition _ C D := @prefunctor_cat C D. Lemma functor_cat {C D : cat} : PreCat_IsCat (Functor.type C D). Proof. constructor => [F G f|F G f|F G H J f g h]. - by apply/natP/funext => a; rewrite /= /natural_comp comp1o. - by apply/natP/funext => a; rewrite /= /natural_comp compo1. - by apply/natP/funext => a; rewrite /= /natural_comp compoA. Qed. HB.instance Definition _ C D := @functor_cat C D. Section nat_map_left. Context {C D E : precat} {F G : C ~> D}. Definition nat_lmap (H : D ~>_quiver E) (n : forall c, F c ~> G c) : forall c, (H \o F)%FUN c ~> (H \o G)%FUN c := fun c => H <$> n c. Fail Check fun (H : D ~> E) (n : F ~~> G) => nat_lmap H n : H \o F ~~> H \o G. Lemma nat_lmap_is_natural (H : D ~> E) (n : F ~~> G) : IsNatural C E (H \o F) (H \o G) (nat_lmap H n). Proof. by constructor=> a b f; rewrite /nat_lmap/= -!Fcomp natural. Qed. HB.instance Definition _ H n := nat_lmap_is_natural H n. Check fun (H : D ~> E) (n : F ~~> G) => nat_lmap H n : H \o F ~~> H \o G. End nat_map_left. Notation "F n" := (nat_lmap F n) (at level 58, format "F n", right associativity) : cat_scope. Section nat_map_right. Context {C D E : precat} {F G : C ~> D}. Definition nat_rmap (H : E -> C) (n : forall c, F c ~> G c) : forall c, (F \o H)%FUN c ~> (G \o H)%FUN c := fun c => n (H c). Lemma nat_rmap_is_natural (H : E ~> C :> quiver) (n : F ~~> G) : IsNatural E D (F \o H)%FUN (G \o H)%FUN (nat_rmap H n). Proof. by constructor=> a b f; rewrite /nat_lmap/= natural. Qed. HB.instance Definition _ H n := nat_rmap_is_natural H n. End nat_map_right. Notation "F <$o> n" := (nat_rmap F n) (at level 58, format "F <$o> n", right associativity) : cat_scope. Definition delta (C D : cat) : C -> (D ~> C) := cst D. Arguments delta C D : clear implicits. Definition map_delta {C D : cat} (a b : C) (f : a ~> b) : delta C D a ~> delta C D b. Proof. apply: (@Natural.Pack _ _ (cst D a) (cst D b) (fun x => f)). apply: Natural.Class; apply: (IsNatural.Build _ _ _ _ _). by move=> a' b' ?; rewrite compo1 comp1o. Defined. HB.instance Definition _ {C D : cat} := IsPreFunctor.Build C (D ~> C) (delta C D) (@map_delta C D). Lemma delta_functor {C D : cat} : PreFunctor_IsFunctor _ _ (delta C D). Proof. by constructor=> [a|a b c f g]; exact/natP. Qed. HB.instance Definition _ C D := @delta_functor C D. HB.mixin Record IsMonad (C : precat) (M : C -> C) of @PreFunctor C C M := { unit : idfun ~~> M; join : (M \o M)%FUN ~~> M; bind : forall (a b : C), (a ~> M b) -> (M a ~> M b); bindE : forall a b (f : a ~> M b), bind a b f = M <$> f \; join b; unit_join : forall a, (M <$> unit a) \; join _ = idmap; join_unit : forall a, join _ \; (M <$> unit a) = idmap; join_square : forall a, M <$> join a \; join _ = join _ \; join _ }. #[short(type="premonad")] HB.structure Definition PreMonad (C : precat) := {M of @PreFunctor C C M & IsMonad C M}. #[short(type="monad")] HB.structure Definition Monad (C : precat) := {M of @Functor C C M & IsMonad C M}. HB.factory Record IsJoinMonad (C : precat) (M : C -> C) of @PreFunctor C C M := { unit : idfun ~~> M; join : (M \o M)%FUN ~~> M; unit_join : forall a, (M <$> unit a) \; join _ = idmap; join_unit : forall a, join _ \; (M <$> unit a) = idmap; join_square : forall a, M <$> join a \; join _ = join _ \; join _ }. HB.builders Context C M of IsJoinMonad C M. HB.instance Definition _ := IsMonad.Build C M (fun a b f => erefl) unit_join join_unit join_square. HB.end. HB.mixin Record IsCoMonad (C : precat) (M : C -> C) of @IsPreFunctor C C M := { counit : M ~~> idfun; cojoin : M ~~> (M \o M)%FUN; cobind : forall (a b : C), (M a ~> b) -> (M a ~> M b); cobindE : forall a b (f : M a ~> b), cobind a b f = cojoin _ \; M <$> f; unit_cojoin : forall a, (M <$> counit a) \; cojoin _ = idmap; join_counit : forall a, cojoin _ \; (M <$> counit a) = idmap; cojoin_square : forall a, cojoin _ \; M <$> cojoin a = cojoin _ \; cojoin _ }. #[short(type="precomonad")] HB.structure Definition PreCoMonad (C : precat) := {M of @PreFunctor C C M & IsCoMonad C M}. #[short(type="comonad")] HB.structure Definition CoMonad (C : precat) := {M of @Functor C C M & IsCoMonad C M}. HB.factory Record IsJoinCoMonad (C : precat) (M : C -> C) of @IsPreFunctor C C M := { counit : M ~~> idfun; cojoin : M ~~> (M \o M)%FUN; unit_cojoin : forall a, (M <$> counit a) \; cojoin _ = idmap; join_counit : forall a, cojoin _ \; (M <$> counit a) = idmap; cojoin_square : forall a, cojoin _ \; M <$> cojoin a = cojoin _ \; cojoin _ }. HB.builders Context C M of IsJoinCoMonad C M. HB.instance Definition _ := IsCoMonad.Build C M (fun a b f => erefl) unit_cojoin join_counit cojoin_square. HB.end. Lemma idFmap (C : cat) (a b : C) (f : a ~> b) : idfun <$> f = f. Proof. by []. Qed. Lemma compFmap (C D E : cat) (F : C ~> D) (G : D ~> E) (a b : C) (f : a ~> b) : (G \o F) <$> f = G <$> F <$> f. Proof. by []. Qed. (* yoneda *) Section hom_repr. Context {C : cat} (F : C ~>_cat U). Definition homF : C -> U := fun c => hom c ~~> F. Section nat. Context (x y : C) (xy : x ~> y). (* Goal hom x ~~> F -> hom y ~~> F *) Context (n : hom x ~~> F). Definition homFhom c : hom y c ~> F c := fun g => n _ (xy \; g). Lemma homFhom_natural_subdef : IsNatural C U (hom y) F homFhom. Proof. by split=> a b f /=; apply/funext => g /=; rewrite /homFhom !Ucompx/= !naturalU/= Fcomp. Qed. HB.instance Definition _ := homFhom_natural_subdef. End nat. Arguments homFhom / : clear implicits. HB.about IsPreFunctor.Build. Check homFhom : forall x y : C, (x ~> y) -> (homF x -> homF y). HB.instance Definition _ := IsPreFunctor.Build _ _ homF homFhom. Lemma homF_functor_subproof : PreFunctor_IsFunctor _ _ homF. Proof. split=> [a|a b c f g]. apply/funext => -[/= f natf]. apply: natP => //=; apply: funext => b; apply: funext => g/=. by rewrite comp1o. apply/funext => -[/= h natf]. apply: natP => //=; apply: funext => d; apply: funext => k/=. by rewrite compoA. Qed. HB.instance Definition _ := homF_functor_subproof. Section pointed. Context (c : C). Definition hom_repr : homF c ~> F c := fun f => f _ idmap. Arguments hom_repr /. Definition repr_hom (fc : F c) a : hom c a ~> F a := fun f => F^$ f fc. Arguments repr_hom / : clear implicits. Lemma repr_hom_subdef (fc : F c) : IsNatural _ _ _ _ (repr_hom fc). Proof. by split=> a b f /=; apply/funext=> x; rewrite !Ucompx/= Fcomp. Qed. HB.instance Definition _ {fc : F c} := repr_hom_subdef fc. Definition repr_hom_nat : F c ~> homF c := repr_hom. Lemma hom_reprK : cancel hom_repr repr_hom_nat. Proof. move=> f; apply/natP; apply/funext => a; apply/funext => g /=. by rewrite -naturalU/=; congr (f _ _); apply: comp1o. Qed. Lemma repr_homK : cancel (repr_hom : F c ~> homF c) hom_repr. Proof. by move=> fc; rewrite /= F1. Qed. End pointed. Arguments hom_repr /. Arguments repr_hom /. Lemma hom_repr_natural_subproof : IsNatural _ _ _ _ hom_repr. Proof. split=> a b f /=; apply/funext => n /=; rewrite !Ucompx/= compo1/=. by rewrite -naturalU/=; congr (n _ _); apply/esym/comp1o. Qed. HB.instance Definition _ := hom_repr_natural_subproof. (* show this from the previous proof *) Lemma hom_natural_repr_subproof : IsNatural _ _ _ _ repr_hom_nat. Proof. split=> a b f /=; apply: funext => fa /=; rewrite !Ucompx/=. apply: natP; apply: funext => c /=; apply: funext => d /=. by rewrite Fcomp Ucompx/=. Qed. HB.instance Definition _ := hom_natural_repr_subproof. Definition hom_repr_nat : homF ~~> F := hom_repr. Definition repr_hom_nat_nat : F ~~> homF := repr_hom_nat. End hom_repr. (* comma categories *) Module comma. Section homcomma. Context {C D E : precat} (F : C ~> E) (G : D ~> E). Definition type := { x : C * D & F x.1 ~> G x.2 }. Definition hom_subdef (a b : type) := { f : tag a ~> tag b & F <$> f.1 \; tagged b = tagged a \; G <$> f.2 }. HB.instance Definition _ := IsQuiver.Build type hom_subdef. End homcomma. Arguments hom_subdef /. Section comma. Context {C D E : cat} (F : C ~> E) (G : D ~> E). Notation type := (type F G). Program Definition idmap_subdef (a : type) : a ~> a := @Tagged _ idmap _ _. Next Obligation. by rewrite !F1 comp1o compo1. Qed. Program Definition comp_subdef (a b c : type) (f : a ~> b) (g : b ~> c) : a ~> c := @Tagged _ (tag f \; tag g) _ _. Next Obligation. by rewrite !Fcomp -compoA (tagged g) compoA (tagged f) compoA. Qed. HB.instance Definition _ := IsPreCat.Build type idmap_subdef comp_subdef. Arguments idmap_subdef /. Arguments comp_subdef /. Lemma comma_homeqP (a b : type) (f g : a ~> b) : projT1 f = projT1 g -> f = g. Proof. case: f g => [f fP] [g +]/= eqfg; case: _ / eqfg => gP. by congr existT; apply: Prop_irrelevance. Qed. Lemma comma_is_cat : PreCat_IsCat type. Proof. by split=> [[a fa] [b fb] [*]|[a fa] [b fb] [*]|*]; apply/comma_homeqP; rewrite /= ?(comp1o, compo1, compoA). Qed. HB.instance Definition _ := comma_is_cat. End comma. End comma. Notation "F `/` G" := (@comma.type _ _ _ F G) (at level 40, G at level 40, format "F `/` G") : cat_scope. Notation "a /` G" := (cst unit a `/` G) (at level 40, G at level 40, format "a /` G") : cat_scope. Notation "F `/ b" := (F `/` cst unit b) (at level 40, b at level 40, format "F `/ b") : cat_scope. Notation "a / b" := (cst unit a `/ b) : cat_scope. (* (* Not working yet *) *) (* HB.mixin Record IsInitial {C : quiver} (i : C) := { *) (* to : forall c, i ~> c; *) (* to_unique : forall c (f : i ~> c), f = to c *) (* }. *) (* #[short(type="initial")] *) (* HB.structure Definition Initial {C : quiver} := {i of IsInitial C i}. *) (* HB.mixin Record IsTerminal {C : quiver} (t : C) := { *) (* from : forall c, c ~> t; *) (* from_unique : forall c (f : c ~> t), f = from c *) (* }. *) (* #[short(type="terminal")] *) (* HB.structure Definition Terminal {C : quiver} := {t of IsTerminal C t}. *) (* #[short(type="universal")] *) (* HB.structure Definition Universal {C : quiver} := *) (* {u of Initial C u & Terminal C u}. *) (* Definition hom' {C : precat} (a b : C) := a ~> b. *) (* (* Bug *) *) (* Identity Coercion hom'_hom : hom' >-> hom. *) (* HB.mixin Record IsMono {C : precat} (b c : C) (f : hom b c) := { *) (* monoP : forall (a : C) (g1 g2 : a ~> b), g1 \; f = g2 \; f -> g1 = g2 *) (* }. *) (* #[short(type="mono")] *) (* HB.structure Definition Mono {C : precat} (a b : C) := {m of IsMono C a b m}. *) (* Notation "a >~> b" := (mono a b) *) (* (at level 99, b at level 200, format "a >~> b") : cat_scope. *) (* Notation "C >~>_ T D" := (@mono T C D) *) (* (at level 99, T at level 0, only parsing) : cat_scope. *) (* HB.mixin Record IsEpi {C : precat} (a b : C) (f : hom a b) := { *) (* epiP : forall (c : C) (g1 g2 : b ~> c), g1 \o f = g2 \o f -> g1 = g2 *) (* }. *) (* #[short(type="epi")] *) (* HB.structure Definition Epi {C : precat} (a b : C) := {e of IsEpi C a b e}. *) (* Notation "a ~>> b" := (epi a b) *) (* (at level 99, b at level 200, format "a ~>> b") : cat_scope. *) (* Notation "C ~>>_ T D" := (@epi T C D) *) (* (at level 99, T at level 0, only parsing) : cat_scope. *) (* #[short(type="iso")] *) (* HB.structure Definition Iso {C : precat} (a b : C) := *) (* {i of @Mono C a b i & @Epi C a b i}. *) (* Notation "a <~> b" := (epi a b) *) (* (at level 99, b at level 200, format "a <~> b") : cat_scope. *) (* Notation "C <~>_ T D" := (@epi T C D) *) (* (at level 99, T at level 0, only parsing) : cat_scope. *) HB.mixin Record IsRightAdjoint (D C : precat) (R : D -> C) of @PreFunctor D C R := { L_ : C ~> D; phi : forall c d, (L_ c ~> d) -> (c ~> R d); psy : forall c d, (c ~> R d) -> (L_ c ~> d); phi_psy c d : (phi c d \o psy c d)%FUN = @id (c ~> R d); psy_phi c d : (psy c d \o phi c d)%FUN = @id (L_ c ~> d) }. #[short(type="right_adjoint")] HB.structure Definition RightAdjoint (D C : precat) := { R of @Functor D C R & IsRightAdjoint D C R }. Arguments L_ {_ _}. Arguments phi {D C s} {c d}. Arguments psy {D C s} {c d}. HB.mixin Record PreCat_IsMonoidal C of PreCat C := { onec : C; prod : (C * C)%type ~>_precat C; }. #[short(type="premonoidal")] HB.structure Definition PreMonoidal := { C of PreCat C & PreCat_IsMonoidal C }. Notation premonoidal := premonoidal. Arguments prod {C} : rename. Notation "a * b" := (prod (a, b)) : cat_scope. Reserved Notation "f <*> g" (at level 40, g at level 40, format "f <*> g"). Notation "f <*> g" := (prod^$ (f, g)) (only printing) : cat_scope. Notation "f <*> g" := (prod^$ ((f, g) : (_, _) ~> (_, _))) (only parsing) : cat_scope. Notation "1" := onec : cat_scope. Definition hom_cast {C : quiver} {a a' : C} (eqa : a = a') {b b' : C} (eqb : b = b') : (a ~> b) -> (a' ~> b'). Proof. now elim: _ / eqa; elim: _ / eqb. Defined. HB.mixin Record PreFunctor_IsMonoidal (C D : premonoidal) F of @PreFunctor C D F := { fun_one : F 1 = 1; fun_prod : forall (x y : C), F (x * y) = F x * F y; }. #[short(type="monoidal_prefunctor")] HB.structure Definition MonoidalPreFunctor C D := { F of @PreFunctor_IsMonoidal C D F }. Arguments fun_prod {C D F x y} : rename. (* Arguments fun_prodF {C D F x x'} f {y y'} g : rename. *) Unset Universe Checking. HB.instance Definition _ := IsQuiver.Build premonoidal MonoidalPreFunctor.type. Set Universe Checking. HB.instance Definition _ (C : quiver) := IsPreFunctor.Build (C * C)%type C fst (fun (a b : C * C) (f : a ~> b) => f.1). HB.instance Definition _ (C : quiver) := IsPreFunctor.Build (C * C)%type C snd (fun (a b : C * C) (f : a ~> b) => f.2). Definition prod3l {C : premonoidal} (x : C * C * C) : C := (x.1.1 * x.1.2) * x.2. HB.instance Definition _ {C : premonoidal} := IsPreFunctor.Build _ C prod3l (fun a b (f : a ~> b) => (f.1.1 <*> f.1.2) <*> f.2). Definition prod3r {C : premonoidal} (x : C * C * C) : C := x.1.1 * (x.1.2 * x.2). HB.instance Definition _ {C : premonoidal} := IsPreFunctor.Build _ C prod3r (fun a b (f : a ~> b) => f.1.1 <*> (f.1.2 <*> f.2)). Definition prod1r {C : premonoidal} (x : C) : C := 1 * x. HB.instance Definition _ {C : premonoidal} := IsPreFunctor.Build C C prod1r (fun (a b : C) (f : a ~> b) => \idmap_1 <*> f). Definition prod1l {C : premonoidal} (x : C) : C := x * 1. HB.instance Definition _ {C : premonoidal} := IsPreFunctor.Build C C prod1l (fun (a b : C) (f : a ~> b) => f <*> \idmap_1). HB.mixin Record PreMonoidal_IsMonoidal C of PreMonoidal C := { prodA : prod3l ~~> prod3r; prod1c : prod1r ~~> idfun; prodc1 : prod1l ~~> idfun; prodc1c : forall (x y : C), prodA (x, 1, y) \; \idmap_x <*> prod1c y = prodc1 x <*> \idmap_y; prodA4 : forall (w x y z : C), prodA (w * x, y, z) \; prodA (w, x, y * z) = prodA (w, x, y) <*> \idmap_z \; prodA (w, x * y, z) \; \idmap_w <*> prodA (x, y, z); }. Unset Universe Checking. #[short(type="monoidal")] HB.structure Definition Monoidal : Set := { C of PreMonoidal_IsMonoidal C & PreMonoidal C }. Set Universe Checking. HB.mixin Record IsRing A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. #[short(type="ring")] HB.structure Definition Ring := { A of IsRing A }. Bind Scope algebra_scope with Ring.sort. Notation "0" := zero : algebra_scope. Notation "1" := one : algebra_scope. Infix "+" := (@add _) : algebra_scope. Notation "- x" := (@opp _ x) : algebra_scope. Infix "*" := (@mul _) : algebra_scope. Notation "x - y" := (x + - y) : algebra_scope. Lemma addr0 (R : ring) : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. Lemma addrN (R : ring) : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma addKr (R : ring) (x : R) : cancel (add x) (add (- x)). Proof. by move=> y; rewrite addrA addNr add0r. Qed. Lemma addrI (R : ring) (x : R) : injective (add x). Proof. exact: can_inj (addKr _). Qed. Lemma opprK (R : ring) : involutive (@opp R). Proof. by move=> x; apply: (@addrI _ (- x)); rewrite addNr addrN. Qed. HB.mixin Record IsRingHom (A B : ring) (f : A -> B) := { hom1_subproof : f 1%A = 1%A; homB_subproof : {morph f : x y / x - y}; homM_subproof : {morph f : x y / (x * y)%A}; }. HB.structure Definition RingHom A B := { f of IsRingHom A B f }. Lemma id_IsRingHom A : IsRingHom A A idfun. Proof. by []. Defined. HB.instance Definition _ A := id_IsRingHom A. Lemma comp_IsRingHom (A B C : ring) (f : RingHom.type A B) (g : RingHom.type B C) : IsRingHom A C (f \; g :> U). Proof. by constructor => [|x y|x y]; rewrite /comp/= ?hom1_subproof ?homB_subproof ?homM_subproof. Qed. HB.instance Definition _ A B C f g := @comp_IsRingHom A B C f g. HB.instance Definition _ := IsQuiver.Build ring RingHom.type. HB.instance Definition _ := Quiver_IsPreCat.Build ring (fun _ => idfun) (fun _ _ _ f g => f \; g :> U). HB.instance Definition _ := Quiver_IsPreConcrete.Build ring (fun _ _ => id). Lemma ring_precat : PreConcrete_IsConcrete ring. Proof. constructor => A B [f cf] [g cg]//=; rewrite -[_ = _]/(f = g) => fg. case: _ / fg in cg *; congr {|RingHom.sort := _ ; RingHom.class := _|}. case: cf cg => [[? ? ?]] [[? ? ?]]. by congr RingHom.Class; congr IsRingHom.phant_Build => //=; apply: Prop_irrelevance. Qed. HB.instance Definition _ := ring_precat. Lemma ring_IsCat : PreCat_IsCat ring. Proof. by constructor=> [A B f|A B f|A B C D f g h]; exact: concrete_fun_inj. Qed. HB.instance Definition _ := ring_IsCat. Lemma hom1 (R S : ring) (f : R ~> S) : f 1%A = 1%A. Proof. exact: hom1_subproof. Qed. Lemma homB (R S : ring) (f : R ~> S) : {morph f : x y / x - y}. Proof. exact: homB_subproof. Qed. Lemma homM (R S : ring) (f : R ~> S) : {morph f : x y / (x * y)%A}. Proof. exact: homM_subproof. Qed. Lemma hom0 (R S : ring) (f : R ~> S) : f 0%A = 0%A. Proof. by rewrite -(addrN 1%A) homB addrN. Qed. Lemma homN (R S : ring) (f : R ~> S) : {morph f : x / - x}. Proof. by move=> x; rewrite -[- x]add0r homB hom0 add0r. Qed. Lemma homD (R S : ring) (f : R ~> S) : {morph f : x y / x + y}. Proof. by move=> x y; rewrite -[y]opprK !homB !homN. Qed. HB.mixin Record IsIdeal (R : ring) (I : R -> Prop) := { ideal0 : I 0; idealD : forall x y, I x -> I y -> I (x + y); idealM : forall x y, I y -> I (x * y)%A; }. HB.structure Definition Ideal (R : ring) := { I of IsIdeal R I }. HB.mixin Record Ideal_IsPrime (R : ring) (I : R -> Prop) of IsIdeal R I := { ideal_prime : forall x y : R, I (x * y)%A -> I x \/ I y }. #[short(type="spectrum")] HB.structure Definition PrimeIdeal (R : ring) := { I of Ideal_IsPrime R I & Ideal R I }. hierarchy-builder-1.8.1/examples/demo1/000077500000000000000000000000001474513043100177505ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/demo1/README.md000066400000000000000000000010721474513043100212270ustar00rootroot00000000000000 # Demo1 The files `hierarchy_$N.v` describes a hierarchy that born with just one structure, the one of `Ring`, and evolves to the following one in five steps. ``` AddMonoid ---> AddComoid ----> AddAG ----> Ring \ \ / -> BiNearRing -> SemiRing - ``` The file `user_0.v` describes an early adopter of the hierarchy, the version described in `hierarchy_0.v`. That code works with all version of the hierarchy. The file `user_3.v` describes a user that adopted the `hierarchy_3.v` and that code works up to `hierarchy_5.v`hierarchy-builder-1.8.1/examples/demo1/hierarchy_0.v000066400000000000000000000027171474513043100223430ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. (**************************************************************************) (* Stage 0: +Ring+ *) (**************************************************************************) HB.mixin Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.structure Definition Ring := { A of Ring_of_TYPE A }. (* Notations *) Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. hierarchy-builder-1.8.1/examples/demo1/hierarchy_1.v000066400000000000000000000044611474513043100223420ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. (**************************************************************************) (* Stage 1: +AddComoid+ -> Ring *) (**************************************************************************) (* Begin change *) HB.mixin Record AddComoid_of_TYPE A := { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. HB.structure Definition AddComoid := { A of AddComoid_of_TYPE A }. HB.mixin Record Ring_of_AddComoid A of AddComoid A := { opp : A -> A; one : A; mul : A -> A -> A; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. #[verbose] HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_Ring_of_AddComoid := Ring_of_AddComoid.Build A _ _ _ addNr mulrA mul1r mulr1 mulrDl mulrDr. HB.end. (* End change *) HB.structure Definition Ring := { A of Ring_of_TYPE A }. (* Notations *) Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. hierarchy-builder-1.8.1/examples/demo1/hierarchy_2.v000066400000000000000000000066671474513043100223550ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. (**************************************************************************) (* Stage 2: AddComoid -> +AddAG+ -> Ring *) (**************************************************************************) HB.mixin Record AddComoid_of_TYPE A := { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. HB.structure Definition AddComoid := { A of AddComoid_of_TYPE A }. (* Begin change *) HB.mixin Record AddAG_of_AddComoid A of AddComoid A := { opp : A -> A; addNr : left_inverse zero opp add; }. HB.factory Record AddAG_of_TYPE A := { zero : A; add : A -> A -> A; opp : A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; }. HB.builders Context A (a : AddAG_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.end. HB.structure Definition AddAG := { A of AddAG_of_TYPE A }. HB.mixin Record Ring_of_AddAG A of AddAG A := { one : A; mul : A -> A -> A; mulrA : associative mul; mulr1 : left_id one mul; mul1r : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.structure Definition Ring := { A of Ring_of_AddAG A }. HB.factory Record Ring_of_AddComoid A of AddComoid A := { opp : A -> A; one : A; mul : A -> A -> A; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_AddComoid A). HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.instance Definition to_Ring_of_AddAG := Ring_of_AddAG.Build A _ _ mulrA mul1r mulr1 mulrDl mulrDr. #[verbose] HB.end. (* End change *) HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_Ring_of_AddComoid := Ring_of_AddComoid.Build A _ _ _ addNr mulrA mul1r mulr1 mulrDl mulrDr. HB.end. (* Notations *) Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory.hierarchy-builder-1.8.1/examples/demo1/hierarchy_3.v000066400000000000000000000110351474513043100223370ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. (**************************************************************************) (* Stage 3: AddComoid ----> AddAG -----> Ring *) (* \ / *) (* -> +SemiRing+ - *) (**************************************************************************) HB.mixin Record AddComoid_of_TYPE A := { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. HB.structure Definition AddComoid := { A of AddComoid_of_TYPE A }. HB.mixin Record AddAG_of_AddComoid A of AddComoid A := { opp : A -> A; addNr : left_inverse zero opp add; }. HB.factory Record AddAG_of_TYPE A := { zero : A; add : A -> A -> A; opp : A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; }. HB.builders Context A (a : AddAG_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.end. HB.structure Definition AddAG := { A of AddAG_of_TYPE A }. (* Begin change *) HB.mixin Record SemiRing_of_AddComoid A of AddComoid A := { one : A; mul : A -> A -> A; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; mul0r : left_zero zero mul; mulr0 : right_zero zero mul; }. HB.structure Definition SemiRing := { A of AddComoid A & SemiRing_of_AddComoid A }. HB.factory Record Ring_of_AddAG A of AddAG A := { one : A; mul : A -> A -> A; mulrA : associative mul; mulr1 : left_id one mul; mul1r : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_AddAG A). Fact mul0r : left_zero zero mul. Proof. move=> x; rewrite -[LHS]add0r addrC. rewrite -{2}(addNr (mul x x)) (addrC (opp _)) addrA. by rewrite -mulrDl add0r addrC addNr. Qed. Fact mulr0 : right_zero zero mul. Proof. move=> x; rewrite -[LHS]add0r addrC. rewrite -{2}(addNr (mul x x)) (addrC (opp _)) addrA. by rewrite -mulrDr add0r addrC addNr. Qed. HB.instance Definition to_SemiRing_of_AddComoid := SemiRing_of_AddComoid.Build A _ mul mulrA mulr1 mul1r mulrDl mulrDr mul0r mulr0. HB.end. (* End change *) HB.factory Record Ring_of_AddComoid A of AddComoid A := { opp : A -> A; one : A; mul : A -> A -> A; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_AddComoid A). HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.instance Definition to_Ring_of_AddAG := Ring_of_AddAG.Build A _ _ mulrA mul1r mulr1 mulrDl mulrDr. HB.end. (* End change *) HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_Ring_of_AddComoid := Ring_of_AddComoid.Build A _ _ _ addNr mulrA mul1r mulr1 mulrDl mulrDr. HB.end. HB.structure Definition Ring := { A of Ring_of_TYPE A }. (* Notations *) Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory.hierarchy-builder-1.8.1/examples/demo1/hierarchy_4.v000066400000000000000000000124561474513043100223500ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. (**************************************************************************) (* Stage 4: +AddMonoid+ -> AddComoid ---> AddAG ----> Ring *) (* \ / *) (* -> SemiRing - *) (**************************************************************************) (* Begin change *) HB.mixin Record AddMonoid_of_TYPE S := { zero : S; add : S -> S -> S; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition AddMonoid := { A of AddMonoid_of_TYPE A }. HB.mixin Record AddComoid_of_AddMonoid A of AddMonoid A := { addrC : commutative (add : A -> A -> A); }. HB.factory Record AddComoid_of_TYPE A := { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. HB.builders Context A (a : AddComoid_of_TYPE A). Fact addr0 : right_id zero add. Proof. by move=> x; rewrite addrC add0r. Qed. HB.instance Definition to_AddMonoid_of_TYPE := AddMonoid_of_TYPE.Build A zero add addrA add0r addr0. HB.instance Definition to_AddComoid_of_AddMonoid := AddComoid_of_AddMonoid.Build A addrC. HB.end. HB.structure Definition AddComoid := { A of AddComoid_of_TYPE A }. (* End change *) HB.mixin Record AddAG_of_AddComoid A of AddComoid A := { opp : A -> A; addNr : left_inverse zero opp add; }. HB.factory Record AddAG_of_TYPE A := { zero : A; add : A -> A -> A; opp : A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; }. HB.builders Context A (a : AddAG_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.end. HB.structure Definition AddAG := { A of AddAG_of_TYPE A }. HB.mixin Record SemiRing_of_AddComoid A of AddComoid A := { one : A; mul : A -> A -> A; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; mul0r : left_zero zero mul; mulr0 : right_zero zero mul; }. HB.structure Definition SemiRing := { A of AddComoid A & SemiRing_of_AddComoid A }. HB.factory Record Ring_of_AddAG A of AddAG A := { one : A; mul : A -> A -> A; mulrA : associative mul; mulr1 : left_id one mul; mul1r : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_AddAG A). Fact mul0r : left_zero zero mul. Proof. move=> x; rewrite -[LHS]add0r addrC. rewrite -{2}(addNr (mul x x)) (addrC (opp _)) addrA. by rewrite -mulrDl add0r addrC addNr. Qed. Fact mulr0 : right_zero zero mul. Proof. move=> x; rewrite -[LHS]add0r addrC. rewrite -{2}(addNr (mul x x)) (addrC (opp _)) addrA. by rewrite -mulrDr add0r addrC addNr. Qed. HB.instance Definition to_SemiRing_of_AddComoid := SemiRing_of_AddComoid.Build A _ mul mulrA mulr1 mul1r mulrDl mulrDr (mul0r) (mulr0). HB.end. (* End change *) HB.factory Record Ring_of_AddComoid A of AddComoid A := { opp : A -> A; one : A; mul : A -> A -> A; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_AddComoid A). HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.instance Definition to_Ring_of_AddAG := Ring_of_AddAG.Build A _ _ mulrA mul1r mulr1 mulrDl mulrDr. HB.end. (* End change *) HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_Ring_of_AddComoid := Ring_of_AddComoid.Build A _ _ _ addNr mulrA mul1r mulr1 mulrDl mulrDr. HB.end. HB.structure Definition Ring := { A of Ring_of_TYPE A }. (* Notations *) Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). (* Not general enough anymore, subsumed by Monoid addr0 *) (* Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. *) Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory.hierarchy-builder-1.8.1/examples/demo1/hierarchy_5.v000066400000000000000000000150201474513043100223370ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. (**************************************************************************) (* Stage 5: AddMonoid ---> AddComoid ----> AddAG ----> Ring *) (* \ \ / *) (* -> +BiNearRing+ -> SemiRing - *) (**************************************************************************) HB.mixin Record AddMonoid_of_TYPE S := { zero : S; add : S -> S -> S; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition AddMonoid := { A of AddMonoid_of_TYPE A }. HB.mixin Record AddComoid_of_AddMonoid A of AddMonoid A := { addrC : commutative (add : A -> A -> A); }. HB.factory Record AddComoid_of_TYPE A := { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. HB.builders Context A (a : AddComoid_of_TYPE A). Fact addr0 : right_id zero add. Proof. by move=> x; rewrite addrC add0r. Qed. HB.instance Definition to_AddMonoid_of_TYPE := AddMonoid_of_TYPE.Build A zero add addrA add0r addr0. HB.instance Definition to_AddComoid_of_AddMonoid := AddComoid_of_AddMonoid.Build A addrC. HB.end. HB.structure Definition AddComoid := { A of AddComoid_of_TYPE A }. (* End change *) HB.mixin Record AddAG_of_AddComoid A of AddComoid A := { opp : A -> A; addNr : left_inverse zero opp add; }. HB.factory Record AddAG_of_TYPE A := { zero : A; add : A -> A -> A; opp : A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; }. HB.builders Context A (a : AddAG_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.end. HB.structure Definition AddAG := { A of AddAG_of_TYPE A }. (* Begin changes *) HB.mixin Record BiNearRing_of_AddMonoid A of AddMonoid A := { one : A; mul : A -> A -> A; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; mul0r : left_zero zero mul; mulr0 : right_zero zero mul; }. HB.structure Definition BiNearRing := { A of AddMonoid A & BiNearRing_of_AddMonoid A }. (* this factory is accidentally a duplicate of BiNearRing_of_AddMonoid *) (* we alias it for backward compatilibity and uniformity purposes *) HB.factory Definition SemiRing_of_AddComoid A of AddComoid A := BiNearRing_of_AddMonoid A. HB.builders Context A (a : SemiRing_of_AddComoid A). HB.instance Definition to_BiNearRing_of_AddMonoid : BiNearRing_of_AddMonoid A := a. HB.end. (* End changes *) HB.structure Definition SemiRing := { A of AddComoid A & SemiRing_of_AddComoid A }. Set Implicit Arguments. (* The factory builder will have implicit arguments *) #[doc="Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995)."] HB.factory Record Ring_of_AddAG A of AddAG A := { one : A; mul : A -> A -> A; mulrA : associative mul; mulr1 : left_id one mul; mul1r : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. Unset Implicit Arguments. HB.builders Context A (a : Ring_of_AddAG A). Fact mul0r : left_zero zero mul. Proof. move=> x; rewrite -[LHS]add0r addrC. rewrite -{2}(addNr (mul x x)) (addrC (opp _)) addrA. by rewrite -mulrDl add0r addrC addNr. Qed. Fact mulr0 : right_zero zero mul. Proof. move=> x; rewrite -[LHS]add0r addrC. rewrite -{2}(addNr (mul x x)) (addrC (opp _)) addrA. by rewrite -mulrDr add0r addrC addNr. Qed. HB.instance Definition to_SemiRing_of_AddComoid := SemiRing_of_AddComoid.Build A _ mul mulrA mulr1 mul1r mulrDl mulrDr mul0r mulr0. HB.end. HB.factory Record Ring_of_AddComoid A of AddComoid A := { opp : A -> A; one : A; mul : A -> A -> A; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a :Ring_of_AddComoid A). HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.instance Definition to_Ring_of_AddAG := Ring_of_AddAG.Build A mulrA mul1r mulr1 mulrDl mulrDr. HB.end. HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_Ring_of_AddComoid := Ring_of_AddComoid.Build A _ _ _ addNr mulrA mul1r mulr1 mulrDl mulrDr. HB.end. HB.structure Definition Ring := { A of Ring_of_TYPE A }. (* Notations *) Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). (* Not general enough anymore, subsumed by Monoid addr0 *) (* Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. *) Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. HB.graph "hierarchy_5.dot". (* we check the alias factory is abstracted over the whole section *) HB.check (SemiRing_of_AddComoid.axioms_ : forall A, forall m : AddMonoid_of_TYPE.axioms_ A, AddComoid_of_AddMonoid.axioms_ A m -> Type).hierarchy-builder-1.8.1/examples/demo1/test_0_0.v000066400000000000000000000007001474513043100215510ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_0. HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Open Scope hb_scope. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrNK addr0. Qed.hierarchy-builder-1.8.1/examples/demo1/test_1_0.v000066400000000000000000000006761474513043100215660ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_1. HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Open Scope hb_scope. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrNK addr0. Qed.hierarchy-builder-1.8.1/examples/demo1/test_2_0.v000066400000000000000000000006761474513043100215670ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_2. HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Open Scope hb_scope. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrNK addr0. Qed.hierarchy-builder-1.8.1/examples/demo1/test_3_0.v000066400000000000000000000006761474513043100215700ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_3. HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Open Scope hb_scope. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrNK addr0. Qed.hierarchy-builder-1.8.1/examples/demo1/test_3_3.v000066400000000000000000000010141474513043100215560ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_3. HB.instance Definition Z_AddComoid := AddComoid_of_TYPE.Build Z 0%Z Z.add Z.add_assoc Z.add_comm Z.add_0_l. HB.instance Definition Z_SemiRing := SemiRing_of_AddComoid.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l Z.mul_0_l Z.mul_0_r. Open Scope hb_scope. Example test1 (m n : Z) : m + n * 0 * 0 = m. Proof. by rewrite -mulrA !mulr0 addrC add0r. Qed.hierarchy-builder-1.8.1/examples/demo1/test_4_0.v000066400000000000000000000007001474513043100215550ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_4. HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Open Scope hb_scope. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrNK addr0. Qed.hierarchy-builder-1.8.1/examples/demo1/test_4_3.v000066400000000000000000000010141474513043100215570ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_4. HB.instance Definition Z_AddComoid := AddComoid_of_TYPE.Build Z 0%Z Z.add Z.add_assoc Z.add_comm Z.add_0_l. HB.instance Definition Z_SemiRing := SemiRing_of_AddComoid.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l Z.mul_0_l Z.mul_0_r. Open Scope hb_scope. Example test1 (m n : Z) : m + n * 0 * 0 = m. Proof. by rewrite -mulrA !mulr0 addrC add0r. Qed.hierarchy-builder-1.8.1/examples/demo1/test_5_0.v000066400000000000000000000006761474513043100215720ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_5. HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Open Scope hb_scope. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrNK addr0. Qed.hierarchy-builder-1.8.1/examples/demo1/test_5_3.v000066400000000000000000000010141474513043100215600ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_5. HB.instance Definition Z_AddComoid := AddComoid_of_TYPE.Build Z 0%Z Z.add Z.add_assoc Z.add_comm Z.add_0_l. HB.instance Definition Z_SemiRing := SemiRing_of_AddComoid.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l Z.mul_0_l Z.mul_0_r. Open Scope hb_scope. Example test1 (m n : Z) : m + n * 0 * 0 = m. Proof. by rewrite -mulrA !mulr0 addrC add0r. Qed.hierarchy-builder-1.8.1/examples/demo1/user_0.v000066400000000000000000000007041474513043100213350ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From @@DEMO@@ Require Import @@HIERARCHY@@. Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. HB.instance Z Z_ring_axioms. Open Scope hb_scope. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrNK addr0. Qed.hierarchy-builder-1.8.1/examples/demo1/user_3.v000066400000000000000000000010551474513043100213400ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect. From HB Require Import structures. From @@DEMO@@ Require Import @@HIERARCHY@@. Definition Z_AddComoid := AddComoid_of_TYPE.Build Z 0%Z Z.add Z.add_assoc Z.add_comm Z.add_0_l. HB.instance Z Z_AddComoid. Definition Z_SemiRing := SemiRing_of_AddComoid.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l Z.mul_0_l Z.mul_0_r. HB.instance Z Z_SemiRing. Open Scope hb_scope. Example test1 (m n : Z) : m + n * 0 * 0 = m. Proof. by rewrite -mulrA !mulr0 addrC add0r. Qed.hierarchy-builder-1.8.1/examples/demo2/000077500000000000000000000000001474513043100177515ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/demo2/classical.v000066400000000000000000001411651474513043100221060ustar00rootroot00000000000000Require Import ssreflect ssrfun ssrbool ssrfun ssrbool. (******************************************************************************) (* This file develops a basic theory of sets under classical axiomatization *) (* and is imported from math-comp/analysis *) (* *) (* --> A decidable equality is defined for any type. It is thus possible to *) (* define an eqType structure for any type using the mixin gen_eqMixin. *) (* --> This file adds the possibility to define a choiceType structure for *) (* any type thanks to an axiom gen_choiceMixin giving a choice mixin. *) (* --> We chose to have generic mixins and no global instances of the eqType *) (* and choiceType structures to let the user choose which definition of *) (* equality to use and to avoid conflict with already declared instances. *) (* *) (* * Sets: *) (* set A == type of sets on A. *) (* (x \in P) == boolean membership predicate from ssrbool *) (* for set P, available thanks to a canonical *) (* predType T structure on sets on T. *) (* [set x : T | P] == set of points x : T such that P holds. *) (* [set x | P] == same as before with T left implicit. *) (* [set E | x in A] == set defined by the expression E for x in *) (* set A. *) (* [set E | x in A & y in B] == same as before for E depending on 2 *) (* variables x and y in sets A and B. *) (* setT == full set. *) (* set0 == empty set. *) (* [set of F] == set defined by the expression F x for any *) (* x. *) (* [set a] == set containing only a. *) (* [set a : T] == same as before with the type of a made *) (* explicit. *) (* A `|` B == union of A and B. *) (* a |` A == A extended with a. *) (* [set a1; a2; ..; an] == set containing only the n elements ai. *) (* A `&` B == intersection of A and B. *) (* A `*` B == product of A and B, i.e. set of pairs (a,b) *) (* such that A a and B b. *) (* A.`1 == set of points a such that there exists b so *) (* that A (a, b). *) (* A.`2 == set of points a such that there exists b so *) (* that A (b, a). *) (* ~` A == complement of A. *) (* [set ~ a] == complement of [set a]. *) (* A `\` B == complement of B in A. *) (* A `\ a == A deprived of a. *) (* \bigcup_(i in P) F == union of the elements of the family F whose *) (* index satisfies P. *) (* \bigcup_(i : T) F == union of the family F indexed on T. *) (* \bigcup_i F == same as before with T left implicit. *) (* \bigcap_(i in P) F == intersection of the elements of the family *) (* F whose index satisfies P. *) (* \bigcap_(i : T) F == union of the family F indexed on T. *) (* \bigcap_i F == same as before with T left implicit. *) (* A `<=` B <-> A is included in B. *) (* A `<=>` B <-> double inclusion A `<=` B and B `<=` A. *) (* f @^-1` A == preimage of A by f. *) (* f @` A == image of A by f. *) (* A !=set0 := exists x, A x. *) (* is_singleton X <-> X contains only 1 element. *) (* is_fun f <-> for each a, f a contains only 1 element. *) (* is_total f <-> for each a, f a is non empty. *) (* is_totalfun f <-> conjunction of is_fun and is_total. *) (* xget x0 P == point x in P if it exists, x0 otherwise; *) (* P must be a set on a choiceType. *) (* fun_of_graph f0 f == function that maps x to an element of f x *) (* if there is one, to f0 x otherwise. *) (* *) (* --> Thanks to this basic set theory, we proved Zorn's Lemma, which states *) (* that any ordered set such that every totally ordered subset admits an *) (* upper bound has a maximal element. We also proved an analogous version *) (* for preorders, where maximal is replaced with premaximal: t is *) (* premaximal if whenever t < s we also have s < t. *) (******************************************************************************) (* -------------------------------------------------------------------- *) Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive. Declare Scope box_scope. Declare Scope quant_scope. (* Copy of the ssrbool shim to ensure compatibility with MathComp v1.8.0. *) Definition PredType : forall T pT, (pT -> pred T) -> predType T. exact PredType || exact mkPredType. Defined. Arguments PredType [T pT] toP. Local Notation predOfType T := (pred_of_simpl (@pred_of_argType T)). (* -------------------------------------------------------------------- *) Axiom functional_extensionality_dep : forall (A : Type) (B : A -> Type) (f g : forall x : A, B x), (forall x : A, f x = g x) -> f = g. Axiom propositional_extensionality : forall P Q : Prop, P <-> Q -> P = Q. Axiom constructive_indefinite_description : forall (A : Type) (P : A -> Prop), (exists x : A, P x) -> {x : A | P x}. Notation cid := constructive_indefinite_description. (* -------------------------------------------------------------------- *) Record mextentionality := { _ : forall (P Q : Prop), (P <-> Q) -> (P = Q); _ : forall {T U : Type} (f g : T -> U), (forall x, f x = g x) -> f = g; }. Fact extentionality : mextentionality. Proof. split. - exact: propositional_extensionality. - by move=> T U f g; apply: functional_extensionality_dep. Qed. Lemma propext (P Q : Prop) : (P <-> Q) -> (P = Q). Proof. by have [propext _] := extentionality; apply: propext. Qed. Lemma funext {T U : Type} (f g : T -> U) : (f =1 g) -> f = g. Proof. by case: extentionality=> _; apply. Qed. Lemma propeqE (P Q : Prop) : (P = Q) = (P <-> Q). Proof. by apply: propext; split=> [->|/propext]. Qed. Lemma funeqE {T U : Type} (f g : T -> U) : (f = g) = (f =1 g). Proof. by rewrite propeqE; split=> [->//|/funext]. Qed. Lemma funeq2E {T U V : Type} (f g : T -> U -> V) : (f = g) = (f =2 g). Proof. by rewrite propeqE; split=> [->//|?]; rewrite funeqE=> x; rewrite funeqE. Qed. Lemma funeq3E {T U V W : Type} (f g : T -> U -> V -> W) : (f = g) = (forall x y z, f x y z = g x y z). Proof. by rewrite propeqE; split=> [->//|?]; rewrite funeq2E=> x y; rewrite funeqE. Qed. Lemma predeqE {T} (P Q : T -> Prop) : (P = Q) = (forall x, P x <-> Q x). Proof. by rewrite propeqE; split=> [->//|?]; rewrite funeqE=> x; rewrite propeqE. Qed. Lemma predeq2E {T U} (P Q : T -> U -> Prop) : (P = Q) = (forall x y, P x y <-> Q x y). Proof. by rewrite propeqE; split=> [->//|?]; rewrite funeq2E=> ??; rewrite propeqE. Qed. Lemma predeq3E {T U V} (P Q : T -> U -> V -> Prop) : (P = Q) = (forall x y z, P x y z <-> Q x y z). Proof. by rewrite propeqE; split=> [->//|?]; rewrite funeq3E=> ???; rewrite propeqE. Qed. Lemma propT (P : Prop) : P -> P = True. Proof. by move=> p; rewrite propeqE; tauto. Qed. Lemma Prop_irrelevance (P : Prop) (x y : P) : x = y. Proof. by move: x (x) y => /propT-> [] []. Qed. Lemma choice X Y (P : X -> Y -> Prop) : (forall x, exists y, P x y) -> {f & forall x, P x (f x)}. Proof. by move=> /(_ _)/constructive_indefinite_description -/all_tag. Qed. (* Diaconescu Theorem *) Theorem EM P : P \/ ~ P. Proof. pose U val := fun Q : bool => Q = val \/ P. have Uex val : exists b, U val b by exists val; left. pose f val := projT1 (cid (Uex val)). pose Uf val : U val (f val) := projT2 (cid (Uex val)). have : f true <> f false \/ P. have [] := (Uf true, Uf false); rewrite /U. by move=> [->|?] [->|?] ; do ?[by right]; left. move=> [fTFN|]; [right=> p|by left]; apply: fTFN. have UTF : U true = U false by rewrite predeqE /U => b; split=> _; right. rewrite /f; move: (Uex true) (Uex false); rewrite UTF => p1 p2. by congr (projT1 (cid _)); apply: Prop_irrelevance. Qed. Lemma pselect (P : Prop): {P} + {~P}. Proof. have : exists b, if b then P else ~ P. by case: (EM P); [exists true|exists false]. by move=> /cid [[]]; [left|right]. Qed. Lemma pdegen (P : Prop): P = True \/ P = False. Proof. by have [p|Np] := pselect P; [left|right]; rewrite propeqE. Qed. Lemma lem (P : Prop): P \/ ~P. Proof. by case: (pselect P); tauto. Qed. (* -------------------------------------------------------------------- *) Lemma trueE : true = True :> Prop. Proof. by rewrite propeqE; split. Qed. Lemma falseE : false = False :> Prop. Proof. by rewrite propeqE; split. Qed. Lemma propF (P : Prop) : ~ P -> P = False. Proof. by move=> p; rewrite propeqE; tauto. Qed. Lemma eq_forall T (U V : T -> Prop) : (forall x : T, U x = V x) -> (forall x, U x) = (forall x, V x). Proof. by move=> e; rewrite propeqE; split=> ??; rewrite (e,=^~e). Qed. Lemma eq_exists T (U V : T -> Prop) : (forall x : T, U x = V x) -> (exists x, U x) = (exists x, V x). Proof. by move=> e; rewrite propeqE; split=> - [] x ?; exists x; rewrite (e,=^~e). Qed. Lemma reflect_eq (P : Prop) (b : bool) : reflect P b -> P = b. Proof. by rewrite propeqE; exact: rwP. Qed. Definition asbool (P : Prop) := if pselect P then true else false. Notation "`[< P >]" := (asbool P) : bool_scope. Lemma asboolE (P : Prop) : `[

] = P :> Prop. Proof. by rewrite propeqE /asbool; case: pselect; split. Qed. Lemma asboolP (P : Prop) : reflect P `[

]. Proof. by apply: (equivP idP); rewrite asboolE. Qed. Lemma asboolPn (P : Prop) : reflect (~ P) (~~ `[

]). Proof. by rewrite /asbool; case: pselect=> h; constructor. Qed. Lemma asboolW (P : Prop) : `[

] -> P. Proof. by case: asboolP. Qed. (* Shall this be a coercion ?*) Lemma asboolT (P : Prop) : P -> `[

]. Proof. by case: asboolP. Qed. Lemma asboolF (P : Prop) : ~ P -> `[

] = false. Proof. by apply/introF/asboolP. Qed. Lemma is_true_inj : injective is_true. Proof. by move=> [] []; rewrite ?(trueE, falseE) ?propeqE; tauto. Qed. (* -------------------------------------------------------------------- *) Lemma asbool_equiv_eq {P Q : Prop} : (P <-> Q) -> `[

] = `[]. Proof. by rewrite -propeqE => ->. Qed. Lemma asbool_equiv_eqP {P Q : Prop} QQ : reflect Q QQ -> (P <-> Q) -> `[

] = QQ. Proof. move=> Q_QQ [hPQ hQP]; apply/idP/Q_QQ=> [/asboolP//|]. by move=> hQ; apply/asboolP/hQP. Qed. Lemma asbool_equiv {P Q : Prop} : (P <-> Q) -> (`[

] <-> `[]). Proof. by move/asbool_equiv_eq->. Qed. Lemma asbool_eq_equiv {P Q : Prop} : `[

] = `[] -> (P <-> Q). Proof. by move=> eq; split=> /asboolP; rewrite (eq, =^~ eq) => /asboolP. Qed. (* -------------------------------------------------------------------- *) Lemma and_asboolP (P Q : Prop) : reflect (P /\ Q) (`[

] && `[]). Proof. apply: (iffP idP); first by case/andP=> /asboolP hP /asboolP hQ. by case=> /asboolP-> /asboolP->. Qed. Lemma or_asboolP (P Q : Prop) : reflect (P \/ Q) (`[

] || `[]). Proof. apply: (iffP idP); first by case/orP=> /asboolP; [left | right]. by case=> /asboolP-> //=; rewrite orbT. Qed. Lemma asbool_neg {P : Prop} : `[<~ P>] = ~~ `[

]. Proof. by apply/idP/asboolPn=> [/asboolP|/asboolT]. Qed. Lemma asbool_or {P Q : Prop} : `[

] = `[

] || `[]. Proof. exact: (asbool_equiv_eqP (or_asboolP _ _)). Qed. Lemma asbool_and {P Q : Prop} : `[

] = `[

] && `[]. Proof. exact: (asbool_equiv_eqP (and_asboolP _ _)). Qed. (* -------------------------------------------------------------------- *) Lemma imply_asboolP {P Q : Prop} : reflect (P -> Q) (`[

] ==> `[]). Proof. apply: (iffP implyP)=> [PQb /asboolP/PQb/asboolW //|]. by move=> PQ /asboolP/PQ/asboolT. Qed. Lemma asbool_imply {P Q : Prop} : `[

Q>] = `[

] ==> `[]. Proof. exact: (asbool_equiv_eqP imply_asboolP). Qed. Lemma imply_asboolPn (P Q : Prop) : reflect (P /\ ~ Q) (~~ `[

Q>]). Proof. apply: (iffP idP). by rewrite asbool_imply negb_imply -asbool_neg => /and_asboolP. by move/and_asboolP; rewrite asbool_neg -negb_imply asbool_imply. Qed. (* -------------------------------------------------------------------- *) Lemma forall_asboolP {T : Type} (P : T -> Prop) : reflect (forall x, `[

]) (`[]). Proof. apply: (iffP idP); first by move/asboolP=> Px x; apply/asboolP. by move=> Px; apply/asboolP=> x; apply/asboolP. Qed. Lemma exists_asboolP {T : Type} (P : T -> Prop) : reflect (exists x, `[

]) (`[]). Proof. apply: (iffP idP); first by case/asboolP=> x Px; exists x; apply/asboolP. by case=> x bPx; apply/asboolP; exists x; apply/asboolP. Qed. (* -------------------------------------------------------------------- *) Lemma contrap (Q P : Prop) : (Q -> P) -> ~ P -> ~ Q. Proof. move=> cb /asboolPn nb; apply/asboolPn. by apply: contra nb => /asboolP /cb /asboolP. Qed. Definition contrapNN := contra. Lemma contrapL (Q P : Prop) : (Q -> ~ P) -> P -> ~ Q. Proof. move=> cb /asboolP hb; apply/asboolPn. by apply: contraL hb => /asboolP /cb /asboolPn. Qed. Definition contrapTN := contrapL. Lemma contrapR (Q P : Prop) : (~ Q -> P) -> ~ P -> Q. Proof. move=> cb /asboolPn nb; apply/asboolP. by apply: contraR nb => /asboolP /cb /asboolP. Qed. Definition contrapNT := contrapR. Lemma contrapLR (Q P : Prop) : (~ Q -> ~ P) -> P -> Q. Proof. move=> cb /asboolP hb; apply/asboolP. by apply: contraLR hb => /asboolP /cb /asboolPn. Qed. Definition contrapTT := contrapLR. Lemma contrapT P : ~ ~ P -> P. Proof. by move/asboolPn=> nnb; apply/asboolP; apply: contraR nnb => /asboolPn /asboolP. Qed. Lemma wlog_neg P : (~ P -> P) -> P. Proof. by move=> ?; case: (pselect P). Qed. Lemma notT (P : Prop) : P = False -> ~ P. Proof. by move->. Qed. Lemma notTE (P : Prop) : (~ P) -> P = False. Proof. by case: (pdegen P)=> ->. Qed. Lemma notFE (P : Prop) : (~ P) = False -> P. Proof. move/notT; exact: contrapT. Qed. Lemma notK : involutive not. Proof. move=> P; case: (pdegen P)=> ->; last by apply: notTE; intuition. by rewrite [~ True]notTE //; case: (pdegen (~ False)) => // /notFE. Qed. Lemma not_inj : injective not. Proof. exact: can_inj notK. Qed. Lemma notLR P Q : (P = ~ Q) -> (~ P) = Q. Proof. exact: canLR notK. Qed. Lemma notRL P Q : (~ P) = Q -> P = ~ Q. Proof. exact: canRL notK. Qed. (* -------------------------------------------------------------------- *) (* assia : let's see if we need the simplpred machinery. In any case, we sould first try definitions + appropriate Arguments setting to see whether these can replace the canonical structures machinery. *) Definition predp T := T -> Prop. Identity Coercion fun_of_pred : predp >-> Funclass. Definition relp T := T -> predp T. Identity Coercion fun_of_rel : rel >-> Funclass. Notation xpredp0 := (fun _ => False). Notation xpredpT := (fun _ => True). Notation xpredpI := (fun (p1 p2 : predp _) x => p1 x /\ p2 x). Notation xpredpU := (fun (p1 p2 : predp _) x => p1 x \/ p2 x). Notation xpredpC := (fun (p : predp _) x => ~ p x). Notation xpredpD := (fun (p1 p2 : predp _) x => ~ p2 x /\ p1 x). Notation xpreimp := (fun f (p : predp _) x => p (f x)). Notation xrelpU := (fun (r1 r2 : relp _) x y => r1 x y \/ r2 x y). (* -------------------------------------------------------------------- *) Definition pred0p (T : Type) (P : predp T) : bool := `[

]. Prenex Implicits pred0p. Lemma pred0pP (T : Type) (P : predp T) : reflect (P =1 xpredp0) (pred0p P). Proof. by apply: (iffP (asboolP _)). Qed. (* -------------------------------------------------------------------- *) Module BoolQuant. Inductive box := Box of bool. Bind Scope box_scope with box. Delimit Scope box_scope with P. Definition idbox {T : Type} (B : box) := fun (x : T) => B. Definition unbox {T : Type} (B : T -> box) : bool := asbool (forall x : T, let: Box b := B x in b). Notation "F ^*" := (Box F) (at level 2). Notation "F ^~" := (~~ F) (at level 2). Section Definitions. Variable T : Type. Implicit Types (B : box) (x y : T). Definition quant0p Bp := pred0p (fun x : T => let: F^* := Bp x x in F). (* The first redundant argument protects the notation from Coq's K-term *) (* display kludge; the second protects it from simpl and /=. *) Definition ex B x y := B. (* Binding the predicate value rather than projecting it prevents spurious *) (* unfolding of the boolean connectives by unification. *) Definition all B x y := let: F^* := B in F^~^*. Definition all_in C B x y := let: F^* := B in (C ==> F)^~^*. Definition ex_in C B x y := let: F^* := B in (C && F)^*. End Definitions. Notation "`[ x | B ]" := (quant0p (fun x => B x)) (at level 0, x name). Notation "`[ x : T | B ]" := (quant0p (fun x : T => B x)) (at level 0, x name). Module Exports. Delimit Scope quant_scope with Q. (* Bogus, only used to declare scope. *) Bind Scope quant_scope with box. Notation ", F" := F^* (at level 200, format ", '/ ' F") : quant_scope. Notation "`[ 'forall' x B ]" := `[x | all B] (at level 0, x at level 99, B at level 200, format "`[ '[hv' 'forall' x B ] ']'") : bool_scope. Notation "`[ 'forall' x : T B ]" := `[x : T | all B] (at level 0, x at level 99, B at level 200, only parsing) : bool_scope. Notation "`[ 'forall' ( x | C ) B ]" := `[x | all_in C B] (at level 0, x at level 99, B at level 200, format "`[ '[hv' '[' 'forall' ( x '/ ' | C ) ']' B ] ']'") : bool_scope. Notation "`[ 'forall' ( x : T | C ) B ]" := `[x : T | all_in C B] (at level 0, x at level 99, B at level 200, only parsing) : bool_scope. Notation "`[ 'forall' x 'in' A B ]" := `[x | all_in (x \in A) B] (at level 0, x at level 99, B at level 200, format "`[ '[hv' '[' 'forall' x '/ ' 'in' A ']' B ] ']'") : bool_scope. Notation "`[ 'forall' x : T 'in' A B ]" := `[x : T | all_in (x \in A) B] (at level 0, x at level 99, B at level 200, only parsing) : bool_scope. Notation ", 'forall' x B" := `[x | all B]^* (at level 200, x at level 99, B at level 200, format ", '/ ' 'forall' x B") : quant_scope. Notation ", 'forall' x : T B" := `[x : T | all B]^* (at level 200, x at level 99, B at level 200, only parsing) : quant_scope. Notation ", 'forall' ( x | C ) B" := `[x | all_in C B]^* (at level 200, x at level 99, B at level 200, format ", '/ ' '[' 'forall' ( x '/ ' | C ) ']' B") : quant_scope. Notation ", 'forall' ( x : T | C ) B" := `[x : T | all_in C B]^* (at level 200, x at level 99, B at level 200, only parsing) : quant_scope. Notation ", 'forall' x 'in' A B" := `[x | all_in (x \in A) B]^* (at level 200, x at level 99, B at level 200, format ", '/ ' '[' 'forall' x '/ ' 'in' A ']' B") : bool_scope. Notation ", 'forall' x : T 'in' A B" := `[x : T | all_in (x \in A) B]^* (at level 200, x at level 99, B at level 200, only parsing) : bool_scope. Notation "`[ 'exists' x B ]" := `[x | ex B]^~ (at level 0, x at level 99, B at level 200, format "`[ '[hv' 'exists' x B ] ']'") : bool_scope. Notation "`[ 'exists' x : T B ]" := `[x : T | ex B]^~ (at level 0, x at level 99, B at level 200, only parsing) : bool_scope. Notation "`[ 'exists' ( x | C ) B ]" := `[x | ex_in C B]^~ (at level 0, x at level 99, B at level 200, format "`[ '[hv' '[' 'exists' ( x '/ ' | C ) ']' B ] ']'") : bool_scope. Notation "`[ 'exists' ( x : T | C ) B ]" := `[x : T | ex_in C B]^~ (at level 0, x at level 99, B at level 200, only parsing) : bool_scope. Notation "`[ 'exists' x 'in' A B ]" := `[x | ex_in (x \in A) B]^~ (at level 0, x at level 99, B at level 200, format "`[ '[hv' '[' 'exists' x '/ ' 'in' A ']' B ] ']'") : bool_scope. Notation "`[ 'exists' x : T 'in' A B ]" := `[x : T | ex_in (x \in A) B]^~ (at level 0, x at level 99, B at level 200, only parsing) : bool_scope. Notation ", 'exists' x B" := `[x | ex B]^~^* (at level 200, x at level 99, B at level 200, format ", '/ ' 'exists' x B") : quant_scope. Notation ", 'exists' x : T B" := `[x : T | ex B]^~^* (at level 200, x at level 99, B at level 200, only parsing) : quant_scope. Notation ", 'exists' ( x | C ) B" := `[x | ex_in C B]^~^* (at level 200, x at level 99, B at level 200, format ", '/ ' '[' 'exists' ( x '/ ' | C ) ']' B") : quant_scope. Notation ", 'exists' ( x : T | C ) B" := `[x : T | ex_in C B]^~^* (at level 200, x at level 99, B at level 200, only parsing) : quant_scope. Notation ", 'exists' x 'in' A B" := `[x | ex_in (x \in A) B]^~^* (at level 200, x at level 99, B at level 200, format ", '/ ' '[' 'exists' x '/ ' 'in' A ']' B") : bool_scope. Notation ", 'exists' x : T 'in' A B" := `[x : T | ex_in (x \in A) B]^~^* (at level 200, x at level 99, B at level 200, only parsing) : bool_scope. End Exports. End BoolQuant. Export BoolQuant.Exports. Open Scope quant_scope. (* -------------------------------------------------------------------- *) Section QuantifierCombinators. Variables (T : Type) (P : pred T) (PP : predp T). Hypothesis viewP : forall x, reflect (PP x) (P x). Lemma existsPP : reflect (exists x, PP x) `[exists x, P x]. Proof. apply: (iffP idP). move/asboolP; (* oops notation! *) apply: contrapR => nh x /=; apply: notTE. by apply: contrap nh => /viewP Px; exists x. case=> x PPx; apply/asboolP=> /(_ x) /notT /=; rewrite -/(not (~ P x)) notK. exact/viewP. Qed. Lemma forallPP : reflect (forall x, PP x) `[forall x, P x]. Proof. apply: (iffP idP). by move/asboolP=> h x; move/notT: (h x)=> /= /negP; rewrite negbK => /viewP. move=> h; apply/asboolP=> x; apply/notTE/negP; rewrite negbK; exact/viewP. Qed. End QuantifierCombinators. Section PredQuantifierCombinators. Variables (T : Type) (P : pred T). Lemma existsbP : reflect (exists x, P x) `[exists x, P x]. Proof. exact: existsPP (fun x => @idP (P x)). Qed. Lemma existsbE : `[exists x, P x] = `[]. Proof. apply/esym/is_true_inj; rewrite asboolE propeqE; apply: rwP; exact: existsbP. Qed. Lemma forallbP : reflect (forall x, P x) `[forall x, P x]. Proof. exact: forallPP (fun x => @idP (P x)). Qed. Lemma forallbE : `[forall x, P x] = `[]. Proof. apply/esym/is_true_inj; rewrite asboolE propeqE; apply: rwP; exact: forallbP. Qed. End PredQuantifierCombinators. (* -------------------------------------------------------------------- *) Lemma existsp_asboolP {T} {P : T -> Prop} : reflect (exists x : T, P x) `[exists x : T, `[

]]. Proof. exact: existsPP (fun x => @asboolP (P x)). Qed. Lemma forallp_asboolP {T} {P : T -> Prop} : reflect (forall x : T, P x) `[forall x : T, `[

]]. Proof. exact: forallPP (fun x => @asboolP (P x)). Qed. Lemma forallp_asboolPn {T} {P : T -> Prop} : reflect (forall x : T, ~ P x) (~~ `[]). Proof. apply: (iffP idP)=> [/asboolPn NP x Px|NP]. by apply/NP; exists x. by apply/asboolP=> -[x]; apply/NP. Qed. Lemma existsp_asboolPn {T} {P : T -> Prop} : reflect (exists x : T, ~ P x) (~~ `[]). Proof. apply: (iffP idP); last by case=> x NPx; apply/asboolPn=> /(_ x). move/asboolPn=> NP; apply/asboolP/negbNE/asboolPn=> h. by apply/NP=> x; apply/asboolP/negbNE/asboolPn=> NPx; apply/h; exists x. Qed. Lemma asbool_forallNb {T : Type} (P : pred T) : `[< forall x : T, ~~ (P x) >] = ~~ `[< exists x : T, P x >]. Proof. apply: (asbool_equiv_eqP forallp_asboolPn); by split=> h x; apply/negP/h. Qed. Lemma asbool_existsNb {T : Type} (P : pred T) : `[< exists x : T, ~~ (P x) >] = ~~ `[< forall x : T, P x >]. Proof. apply: (asbool_equiv_eqP existsp_asboolPn); by split=> -[x h]; exists x; apply/negP. Qed. Reserved Notation "[ 'set' x : T | P ]" (at level 0, x at level 99). Reserved Notation "[ 'set' x | P ]" (at level 0, x, P at level 99, format "[ 'set' x | P ]"). Reserved Notation "[ 'set' E | x 'in' A ]" (at level 0, E, x at level 99, format "[ '[hv' 'set' E '/ ' | x 'in' A ] ']'"). Reserved Notation "[ 'set' E | x 'in' A & y 'in' B ]" (at level 0, E, x at level 99, format "[ '[hv' 'set' E '/ ' | x 'in' A & y 'in' B ] ']'"). Reserved Notation "[ 'set' 'of' F ]" (at level 0, format "[ 'set' 'of' F ]"). Reserved Notation "[ 'set' a ]" (at level 0, a at level 99, format "[ 'set' a ]"). Reserved Notation "[ 'set' a : T ]" (at level 0, a at level 99, format "[ 'set' a : T ]"). Reserved Notation "A `|` B" (at level 52, left associativity). Reserved Notation "a |` A" (at level 52, left associativity). Reserved Notation "[ 'set' a1 ; a2 ; .. ; an ]" (at level 0, a1 at level 99, format "[ 'set' a1 ; a2 ; .. ; an ]"). Reserved Notation "A `&` B" (at level 48, left associativity). Reserved Notation "A `*` B" (at level 46, left associativity). Reserved Notation "A .`1" (at level 2, left associativity, format "A .`1"). Reserved Notation "A .`2" (at level 2, left associativity, format "A .`2"). Reserved Notation "~` A" (at level 35, right associativity). Reserved Notation "[ 'set' ~ a ]" (at level 0, format "[ 'set' ~ a ]"). Reserved Notation "A `\` B" (at level 50, left associativity). Reserved Notation "A `\ b" (at level 50, left associativity). (* Reserved Notation "A `+` B" (at level 54, left associativity). Reserved Notation "A +` B" (at level 54, left associativity). *) Reserved Notation "\bigcup_ ( i 'in' P ) F" (at level 41, F at level 41, i, P at level 50, format "'[' \bigcup_ ( i 'in' P ) '/ ' F ']'"). Reserved Notation "\bigcup_ ( i : T ) F" (at level 41, F at level 41, i at level 50, format "'[' \bigcup_ ( i : T ) '/ ' F ']'"). Reserved Notation "\bigcup_ i F" (at level 41, F at level 41, i at level 0, format "'[' \bigcup_ i '/ ' F ']'"). Reserved Notation "\bigcap_ ( i 'in' P ) F" (at level 41, F at level 41, i, P at level 50, format "'[' \bigcap_ ( i 'in' P ) '/ ' F ']'"). Reserved Notation "\bigcap_ ( i : T ) F" (at level 41, F at level 41, i at level 50, format "'[' \bigcap_ ( i : T ) '/ ' F ']'"). Reserved Notation "\bigcap_ i F" (at level 41, F at level 41, i at level 0, format "'[' \bigcap_ i '/ ' F ']'"). Reserved Notation "A `<=` B" (at level 70, no associativity). Reserved Notation "A `<=>` B" (at level 70, no associativity). Reserved Notation "f @^-1` A" (at level 24). Reserved Notation "f @` A" (at level 24). Reserved Notation "A !=set0" (at level 80). Definition set A := A -> Prop. Definition in_set T (P : set T) : pred T := [pred x | `[

]]. Canonical set_predType T := @PredType T (set T) (@in_set T). Lemma in_setE T (P : set T) x : x \in P = P x :> Prop. Proof. by rewrite propeqE; split => [] /asboolP. Qed. Declare Scope classical_set_scope. Bind Scope classical_set_scope with set. Local Open Scope classical_set_scope. Delimit Scope classical_set_scope with classic. Definition mkset {T} (A : T -> Prop) : set T := A. Notation "[ 'set' x : T | P ]" := (mkset (fun x : T => P)) : classical_set_scope. Notation "[ 'set' x | P ]" := [set x : _ | P] : classical_set_scope. Notation "[ 'set' E | x 'in' A ]" := [set y | exists2 x, A x & E = y] : classical_set_scope. Notation "[ 'set' E | x 'in' A & y 'in' B ]" := [set z | exists2 x, A x & exists2 y, B y & E = z] : classical_set_scope. Definition image {A B} (f : A -> B) (X : set A) : set B := [set f a | a in X]. Definition preimage {A B} (f : A -> B) (X : set B) : set A := [set a | X (f a)]. Arguments preimage A B f X / a. Definition setT {A} := [set _ : A | True]. Definition set0 {A} := [set _ : A | False]. Definition set1 {A} (x : A) := [set a : A | x = a]. Definition setI {A} (X Y : set A) := [set a | X a /\ Y a]. Definition setU {A} (X Y : set A) := [set a | X a \/ Y a]. Definition setV {A B} (X : set A) (Y : set B) := [set a : A + B | sum_rect _ X Y a]. Definition settt : set unit := setT. Definition nonempty {A} (X : set A) := exists x, X x. Definition setC {A} (X : set A) := [set a | ~ X a]. Definition setD {A} (X Y : set A) := [set a | X a /\ ~ Y a]. Definition setM {A B} (X : set A) (Y : set B) := [set x | X x.1 /\ Y x.2]. Definition fst_set {A B} (X : set (A * B)) := [set x | exists y, X (x, y)]. Definition snd_set {A B} (X : set (A * B)) := [set y | exists x, X (x, y)]. Notation "[ 'set' 'of' F ]" := [set F i | i in setT] : classical_set_scope. Notation "[ 'set' a ]" := (set1 a) : classical_set_scope. Notation "[ 'set' a : T ]" := [set (a : T)] : classical_set_scope. Notation "A `|` B" := (setU A B) : classical_set_scope. Notation "a |` A" := ([set a] `|` A) : classical_set_scope. Notation "[ 'set' a1 ; a2 ; .. ; an ]" := (setU .. (a1 |` [set a2]) .. [set an]) : classical_set_scope. Notation "A `&` B" := (setI A B) : classical_set_scope. Notation "A `*` B" := (setM A B) : classical_set_scope. Notation "A .`1" := (fst_set A) : classical_set_scope. Notation "A .`2" := (snd_set A) : classical_set_scope. Notation "~` A" := (setC A) : classical_set_scope. Notation "[ 'set' ~ a ]" := (~` [set a]) : classical_set_scope. Notation "A `\` B" := (setD A B) : classical_set_scope. Notation "A `\ a" := (A `\` [set a]) : classical_set_scope. Definition bigsetI A I (P : set I) (X : I -> set A) := [set a | forall i, P i -> X i a]. Definition bigsetU A I (P : set I) (X : I -> set A) := [set a | exists2 i, P i & X i a]. Notation "\bigcup_ ( i 'in' P ) F" := (bigsetU P (fun i => F)) : classical_set_scope. Notation "\bigcup_ ( i : T ) F" := (\bigcup_(i in @setT T) F) : classical_set_scope. Notation "\bigcup_ i F" := (\bigcup_(i : _) F) : classical_set_scope. Notation "\bigcap_ ( i 'in' P ) F" := (bigsetI P (fun i => F)) : classical_set_scope. Notation "\bigcap_ ( i : T ) F" := (\bigcap_(i in @setT T) F) : classical_set_scope. Notation "\bigcap_ i F" := (\bigcap_(i : _) F) : classical_set_scope. Definition subset {A} (X Y : set A) := forall a, X a -> Y a. Notation "A `<=` B" := (subset A B) : classical_set_scope. Notation "A `<=>` B" := ((A `<=` B) /\ (B `<=` A)) : classical_set_scope. Notation "f @^-1` A" := (preimage f A) : classical_set_scope. Notation "f @` A" := (image f A) : classical_set_scope. Notation "A !=set0" := (nonempty A) : classical_set_scope. Definition graph_sym {T T'} (A : set (T * T')) : set (T' * T) := [set xy | A (xy.2, xy.1)]. Definition graph_comp {T' T T''} (A : set (T * T')) (B : set (T' * T'')) : set (T * T'') := [set xz | exists2 y, A (xz.1, y) & B (y, xz.2)]. Lemma eqEsubset T (F G : set T) : F `<=` G -> G `<=` F -> F = G. Proof. by move=> H K; rewrite funeqE=> s; rewrite propeqE; split=> [/H|/K]. Qed. Lemma sub0set T (X : set T) : set0 `<=` X. Proof. by []. Qed. Lemma subset0 T (X : set T) : (X `<=` set0) = (X = set0). Proof. rewrite propeqE; split => [?|-> //]; exact/eqEsubset. Qed. Lemma set0P T (X : set T) : (X <> set0) <-> (X !=set0). Proof. split=> [X_neq0|[t tX] X_eq0]; last by rewrite X_eq0 in tX. apply: contrapT => /asboolPn/forallp_asboolPn X0. by apply/X_neq0/eqEsubset. Qed. Lemma imageP {A B} (f : A -> B) (X : set A) a : X a -> (f @` X) (f a). Proof. by exists a. Qed. Lemma sub_image_setI {A B} (f : A -> B) (X Y : set A) : f @` (X `&` Y) `<=` f @` X `&` f @` Y. Proof. by move=> b [x [Xa Ya <-]]; split; apply: imageP. Qed. Arguments sub_image_setI {A B f X Y} a _. Lemma nonempty_image {A B} (f : A -> B) (X : set A) : f @` X !=set0 -> X !=set0. Proof. by case=> b [a]; exists a. Qed. Lemma nonempty_preimage {A B} (f : A -> B) (X : set B) : f @^-1` X !=set0 -> X !=set0. Proof. by case=> [a ?]; exists (f a). Qed. Lemma preimage_image A B (f : A -> B) (X : set A) : X `<=` f@^-1` (f @` X). Proof. by move=> a Xa; exists a. Qed. Lemma image_preimage A B (f : A -> B) (X : set B) : f @` setT = setT -> f @` (f @^-1` X) = X. Proof. move=> fsurj; rewrite predeqE => x; split; first by move=> [?? <-]. move=> Xx; have : setT x by []; rewrite -fsurj => -[y _ fy_eqx]. by exists y => //; rewrite /preimage/mkset fy_eqx. Qed. Lemma preimage_setC A B (f : A -> B) (X : set B) : ~` (f @^-1` X) = f @^-1` (~` X). Proof. by rewrite predeqE => a; split=> nXfa ?; apply: nXfa. Qed. Lemma subset_empty {A} (X Y : set A) : X `<=` Y -> X !=set0 -> Y !=set0. Proof. by move=> sXY [x Xx]; exists x; apply: sXY. Qed. Lemma subset_trans {A} (Y X Z : set A) : X `<=` Y -> Y `<=` Z -> X `<=` Z. Proof. by move=> sXY sYZ ? ?; apply/sYZ/sXY. Qed. Lemma nonempty_preimage_setI {A B} (f : A -> B) (X Y : set B) : (f @^-1` (X `&` Y)) !=set0 <-> (f @^-1` X `&` f @^-1` Y) !=set0. Proof. by split; case=> x ?; exists x. Qed. Lemma subsetC {A} (X Y : set A) : X `<=` Y -> ~` Y `<=` ~` X. Proof. by move=> sXY ? nYa ?; apply/nYa/sXY. Qed. Lemma subsetU {A} (X Y Z : set A) : X `<=` Z -> Y `<=` Z -> X `|` Y `<=` Z. Proof. by move=> sXZ sYZ a; apply: or_ind; [apply: sXZ|apply: sYZ]. Qed. Lemma subUset T (X Y Z : set T) : (Y `|` Z `<=` X) = ((Y `<=` X) /\ (Z `<=` X)). Proof. rewrite propeqE; split => [|[YX ZX] x]; last by case; [exact: YX | exact: ZX]. by move=> sYZ_X; split=> x ?; apply sYZ_X; [left | right]. Qed. Lemma subsetI A (X Y Z : set A) : (X `<=` Y `&` Z) = ((X `<=` Y) /\ (X `<=` Z)). Proof. rewrite propeqE; split=> [H|[y z ??]]; split; by [move=> ?/H[]|apply y|apply z]. Qed. Lemma subIset {A} (X Y Z : set A) : X `<=` Z \/ Y `<=` Z -> X `&` Y `<=` Z. Proof. case => H a; by [move=> [/H] | move=> [_ /H]]. Qed. Lemma setD_eq0 A (X Y : set A) : (X `\` Y = set0) = (X `<=` Y). Proof. rewrite propeqE; split=> [XDY0 a|sXY]. by apply: contrapTT => nYa xA; rewrite -[False]/(set0 a) -XDY0. by rewrite predeqE => ?; split=> // - [?]; apply; apply: sXY. Qed. Lemma setDE {A} (X Y : set A) : X `\` Y = X `&` ~` Y. Proof. by []. Qed. Lemma setIid {A} (X : set A) : X `&` X = X. Proof. by rewrite predeqE => ?; split=> [[]|]. Qed. Lemma setIC {A} (X Y : set A) : X `&` Y = Y `&` X. Proof. by rewrite predeqE => ?; split=> [[]|[]]. Qed. Lemma setIT {A} (X : set A) : X `&` setT = X. Proof. by rewrite predeqE => ?; split=> [[]|]. Qed. Lemma setI0 {A} (X : set A) : X `&` set0 = set0. Proof. by rewrite predeqE => ?; split=> [[]|]. Qed. Lemma set0I A (Y : set A) : set0 `&` Y = set0. Proof. by rewrite setIC setI0. Qed. Lemma setIA {A} (X Y Z : set A) : X `&` (Y `&` Z) = X `&` Y `&` Z. Proof. by rewrite predeqE => ?; split=> [[? []]|[[]]]. Qed. Lemma setICA {A} (X Y Z : set A) : X `&` (Y `&` Z) = Y `&` (X `&` Z). Proof. by rewrite setIA [X `&` _]setIC -setIA. Qed. Lemma setIAC {A} (X Y Z : set A) : X `&` Y `&` Z = X `&` Z `&` Y. Proof. by rewrite setIC setICA setIA. Qed. Lemma setIACA {A} (X Y Z T : set A) : X `&` Y `&` (Z `&` T) = X `&` Z `&` (Y `&` T). Proof. by rewrite -setIA [Y `&` _]setICA setIA. Qed. Lemma setUA A : associative (@setU A). Proof. by move=> p q r; rewrite /setU /mkset predeqE => a; tauto. Qed. Lemma setUid A : idempotent (@setU A). Proof. move=> p; rewrite /setU predeqE /mkset => a; tauto. Qed. Lemma setUC A : commutative (@setU A). Proof. move=> p q; rewrite /setU predeqE /mkset => a; tauto. Qed. Lemma set0U T (X : set T) : set0 `|` X = X. Proof. by rewrite funeqE => t; rewrite propeqE; split; [case|right]. Qed. Lemma setU0 T (X : set T) : X `|` set0 = X. Proof. by rewrite funeqE => t; rewrite propeqE; split; [case|left]. Qed. Lemma setU_eq0 T (X Y : set T) : (X `|` Y = set0) = ((X = set0) /\ (Y = set0)). Proof. by rewrite -!subset0 subUset. Qed. Lemma setI_bigcapr A I (D : set I) (f : I -> set A) (X : set A) : X `&` \bigcap_(i in D) f i = \bigcap_(i in setV settt D) sum_rect (fun=> set A) (fun=> X) f i. Proof. rewrite predeqE => a; split; first by move=> [Xa IDfa] [[]|i]//= /IDfa. move=> IXDfa; split; first by apply: (IXDfa (inl tt)). by move=> i Di; apply: (IXDfa (inr i)). Qed. Lemma setI_bigcupl A I (D : set I) (f : I -> set A) (X : set A) : \bigcup_(i in D) f i `&` X = \bigcup_(i in D) (f i `&` X). Proof. rewrite predeqE => a; split => [[[i Di] fia] Xa|[i Di [fia Xa]]]. by exists i. by split=> //; exists i. Qed. Lemma setI_bigcupr A I (D : set I) (f : I -> set A) (X : set A) : X `&` \bigcup_(i in D) f i = \bigcup_(i in D) (X `&` f i). Proof. rewrite setIC setI_bigcupl; congr bigsetU. by rewrite funeqE => i; rewrite setIC. Qed. Lemma setU_bigcapl A I (D : set I) (f : I -> set A) (X : set A) : \bigcap_(i in D) f i `|` X = \bigcap_(i in D) (f i `|` X). Proof. rewrite predeqE => a; split => [|fI]. by move=> [fI|] i Di; [left; apply: fI|right]. by have [Xa|Xna] := asboolP (X a); [right |left => i /fI[]]. Qed. Lemma setU_bigcapr A I (D : set I) (f : I -> set A) (X : set A) : X `|` \bigcap_(i in D) f i = \bigcap_(i in D) (X `|` f i). Proof. rewrite setUC setU_bigcapl; congr bigsetI. by rewrite funeqE => i; rewrite setUC. Qed. Lemma bigcup_set1 {A I} (D : set I) (f : I -> set A) : \bigcup_(i in D) [set f i] = [set f i | i in D]. Proof. by []. Qed. Lemma bigcup_map {A I J} (D : set I) (h : I -> J) (f : J -> set A) : \bigcup_(i in D) f (h i) = \bigcup_(j in [set h i | i in D]) f j. Proof. rewrite predeqE => a; split=> [[i Di]|[_ [i Di <-]]] fhia; last by exists i. by exists (h i) => //; exists i. Qed. Lemma bigcup_bigcup {A I J} (DI : set I) (DJ : I -> set J) (f : J -> set A) : \bigcup_(j in \bigcup_(i in DI) DJ i) f j = \bigcup_(i in DI) \bigcup_(j in DJ i) f j. Proof. rewrite predeqE=> a; split => [[j [i Di Dij fja]]|[i Di [j Dij fja]]]. by exists i => //; exists j. by exists j => //; exists i. Qed. Lemma bigcap_bigcup {A I J} (DI : set I) (DJ : I -> set J) (f : J -> set A) : \bigcap_(j in \bigcup_(i in DI) DJ i) f j = \bigcap_(i in DI) \bigcap_(j in DJ i) f j. Proof. rewrite predeqE=> a; split=> [UUfa i Di j Dij|UUfa j [i Di Dij]]. by apply: UUfa; exists i. exact: UUfa Dij. Qed. Lemma bigcupM {I J A} (DI : set I) (DJ : set J) (f : I -> J -> set A) : \bigcup_(i in DI `*` DJ) f i.1 i.2 = \bigcup_(i in DI) \bigcup_(j in DJ) f i j. Proof. rewrite predeqE => i /=. split=> [[[a b] [/=Da Db] fabj]|[a Da [b Db fabi]]]; last by exists (a, b). by exists a => //; exists b => //. Qed. Definition is_singleton {A} (X : set A) := forall x y, X x -> X y -> x = y. Definition is_fun {A B} (f : A -> B -> Prop) := all (is_singleton \o f). Definition is_total {A B} (f : A -> B -> Prop) := all (nonempty \o f). Definition is_totalfun {A B} (f : A -> B -> Prop) := forall x, nonempty (f x) /\ is_singleton (f x). Record is_filter {T} (F : set (set T)) := IsFilter { filterT : F setT ; filterI : forall P Q : set T, F P -> F Q -> F (setI P Q) ; filterS : forall P Q : set T, P `<=` Q -> F P -> F Q; filter_not_empty : not (F (fun _ => False)) ; }. Definition xget {T} x0 (P : set T) : T := if pselect (exists x : T, `[

]) isn't left exP then x0 else projT1 (cid exP). Unset Auto Template Polymorphism. CoInductive xget_spec {T} x0 (P : set T) : T -> Prop -> Type := | XGetSome x of x = xget x0 P & P x : xget_spec x0 P x True | XGetNone of (forall x, ~ P x) : xget_spec x0 P x0 False. Lemma xgetP {T} x0 (P : set T) : xget_spec x0 P (xget x0 P) (P (xget x0 P)). Proof. move: (erefl (xget x0 P)); set y := {2}(xget x0 P). rewrite /xget; case: pselect => /= [?|neqP _]. by case: cid => x /= /asboolP Px; rewrite [P x]propT //; constructor. suff NP x : ~ P x by rewrite [P x0]propF //; constructor. by apply: contrap neqP => Px; exists x; apply/asboolP. Qed. Lemma xgetPex {T} x0 (P : set T) : (exists x, P x) -> P (xget x0 P). Proof. by case: xgetP=> // NP [x /NP]. Qed. Lemma xgetI {T} x0 (P : set T) (x : T): P x -> P (xget x0 P). Proof. by move=> Px; apply: xgetPex; exists x. Qed. Lemma xget_prop {T : nonPropType} x0 (P : set T) (x : T) : P x -> is_singleton P -> xget x0 P = x. Proof. by move=> Px /(_ _ _ (xgetI x0 Px) Px). Qed. Lemma xget_unique {T} x0 (P : set T) (x : T) : P x -> (forall y, P y -> y = x) -> xget x0 P = x. Proof. by move=> /xget_prop gPx eqx; apply: gPx=> y z /eqx-> /eqx. Qed. Lemma xgetPN {T} x0 (P : set T) : (forall x, ~ P x) -> xget x0 P = x0. Proof. by case: xgetP => // x _ Px /(_ x). Qed. Definition fun_of_graph {A} {B} (f0 : A -> B) (f : A -> B -> Prop) := fun x => xget (f0 x) (f x). Lemma fun_of_graphP {A} {B } (f : A -> B -> Prop) (f0 : A -> B) a : nonempty (f a) -> f a (fun_of_graph f0 f a). Proof. by move=> [b fab]; rewrite /fun_of_graph; apply: xgetI fab. Qed. Lemma fun_of_graph_uniq {A} {B } (f : A -> B -> Prop) (f0 : A -> B) a : is_singleton (f a) -> forall b, f a b -> fun_of_graph f0 f a = b. Proof. by move=> fa_prop b /xget_prop xgeteq; rewrite /fun_of_graph xgeteq. Qed. Definition total_on T (A : set T) (R : T -> T -> Prop) := forall s t, A s -> A t -> R s t \/ R t s. Section ZL. Variable (T : Type) (t0 : T) (R : T -> T -> Prop). Hypothesis (Rrefl : forall t, R t t). Hypothesis (Rtrans : forall r s t, R r s -> R s t -> R r t). Hypothesis (Rantisym : forall s t, R s t -> R t s -> s = t). Hypothesis (tot_lub : forall A : set T, total_on A R -> exists t, (forall s, A s -> R s t) /\ forall r, (forall s, A s -> R s r) -> R t r). Hypothesis (Rsucc : forall s, exists t, R s t /\ s <> t /\ forall r, R s r -> R r t -> r = s \/ r = t). Notation get := (xget t0). Notation getPex := (xgetPex t0). Let lub := fun A : {A : set T | total_on A R} => get (fun t : T => (forall s, sval A s -> R s t) /\ forall r, (forall s, sval A s -> R s r) -> R t r). Let succ := fun s => get (fun t : T => R s t /\ s <> t /\ forall r, R s r -> R r t -> r = s \/ r = t). Inductive tower : set T := | Lub : forall A, sval A `<=` tower -> tower (lub A) | Succ : forall t, tower t -> tower (succ t). Lemma ZL' : False. Proof. have lub_ub (A : {A : set T | total_on A R}) : forall s, sval A s -> R s (lub A). suff /getPex [] : exists t : T, (forall s, sval A s -> R s t) /\ forall r, (forall s, sval A s -> R s r) -> R t r by []. by apply: tot_lub; apply: (svalP A). have lub_lub (A : {A : set T | total_on A R}) : forall t, (forall s, sval A s -> R s t) -> R (lub A) t. suff /getPex [] : exists t : T, (forall s, sval A s -> R s t) /\ forall r, (forall s, sval A s -> R s r) -> R t r by []. by apply: tot_lub; apply: (svalP A). have RS s : R s (succ s) /\ s <> succ s. by have /getPex [? []] : exists t : T, R s t /\ s <> t /\ forall r, R s r -> R r t -> r = s \/ r = t by apply: Rsucc. have succS s : forall t, R s t -> R t (succ s) -> t = s \/ t = succ s. by have /getPex [? []] : exists t : T, R s t /\ s <> t /\ forall r, R s r -> R r t -> r = s \/ r = t by apply: Rsucc. suff Twtot : total_on tower R. have [R_S] := RS (lub (exist _ tower Twtot)); apply. by apply/Rantisym => //; apply/lub_ub/Succ/Lub. move=> s t Tws; elim: Tws t => {s} [A sATw ihA|s Tws ihs] t Twt. case: (pselect (forall s, sval A s -> R s t)). by move=> ?; left; apply: lub_lub. move/asboolP; rewrite asbool_neg => /existsp_asboolPn [s /asboolP]. rewrite asbool_neg => /imply_asboolPn [As nRst]; right. by have /lub_ub := As; apply: Rtrans; have [] := ihA _ As _ Twt. suff /(_ _ Twt) [Rts|RSst] : forall r, tower r -> R r s \/ R (succ s) r. by right; apply: Rtrans Rts _; have [] := RS s. by left. move=> r; elim=> {r} [A sATw ihA|r Twr ihr]. case: (pselect (forall r, sval A r -> R r s)). by move=> ?; left; apply: lub_lub. move/asboolP; rewrite asbool_neg => /existsp_asboolPn [r /asboolP]. rewrite asbool_neg => /imply_asboolPn [Ar nRrs]; right. by have /lub_ub := Ar; apply: Rtrans; have /ihA [] := Ar. have [Rrs|RSsr] := ihr; last by right; apply: Rtrans RSsr _; have [] := RS r. have : tower (succ r) by apply: Succ. move=> /ihs [RsSr|]; last by left. by have [->| ->] := succS _ _ Rrs RsSr; [right|left]; apply: Rrefl. Qed. End ZL. Lemma exist_congr T (P : T -> Prop) (s t : T) (p : P s) (q : P t) : s = t -> exist P s p = exist P t q. Proof. by move=> st; case: _ / st in q *; apply/congr1/Prop_irrelevance. Qed. Lemma Zorn T (R : T -> T -> Prop) : (forall t, R t t) -> (forall r s t, R r s -> R s t -> R r t) -> (forall s t, R s t -> R t s -> s = t) -> (forall A : set T, total_on A R -> exists t, forall s, A s -> R s t) -> exists t, forall s, R t s -> s = t. Proof. move=> Rrefl Rtrans Rantisym Rtot_max. set totR := ({A : set T | total_on A R}). set R' := fun A B : totR => sval A `<=` sval B. have R'refl A : R' A A by []. have R'trans A B C : R' A B -> R' B C -> R' A C by apply: subset_trans. have R'antisym A B : R' A B -> R' B A -> A = B. rewrite /R'; case: A; case: B => /= B totB A totA sAB sBA. by apply: exist_congr; rewrite predeqE=> ?; split=> [/sAB|/sBA]. have R'tot_lub A : total_on A R' -> exists t, (forall s, A s -> R' s t) /\ forall r, (forall s, A s -> R' s r) -> R' t r. move=> Atot. have AUtot : total_on (\bigcup_(B in A) (sval B)) R. move=> s t [B AB Bs] [C AC Ct]. have [/(_ _ Bs) Cs|/(_ _ Ct) Bt] := Atot _ _ AB AC. by have /(_ _ _ Cs Ct) := svalP C. by have /(_ _ _ Bs Bt) := svalP B. exists (exist _ (\bigcup_(B in A) sval B) AUtot); split. by move=> B ???; exists B. by move=> B Bub ? /= [? /Bub]; apply. apply: contrapT => nomax. have {}nomax t : exists s, R t s /\ s <> t. have /asboolP := nomax; rewrite asbool_neg => /forallp_asboolPn /(_ t). move=> /asboolP; rewrite asbool_neg => /existsp_asboolPn [s]. by move=> /asboolP; rewrite asbool_neg => /imply_asboolPn []; exists s. have tot0 : total_on set0 R by []. apply: (ZL' (exist _ set0 tot0)) R'tot_lub _ => // A. have /Rtot_max [t tub] := svalP A; have [s [Rts snet]] := nomax t. have Astot : total_on (sval A `|` [set s]) R. move=> u v [Au|<-]; last first. by move=> [/tub Rvt| ->]; right=> //; apply: Rtrans Rts. move=> [Av|<-]; [apply: (svalP A)|left] => //. by apply: Rtrans Rts; apply: tub. exists (exist _ (sval A `|` [set s]) Astot); split; first by move=> ??; left. split=> [AeAs|[B Btot] sAB sBAs]. case: (pselect (sval A s)); first by move=> /tub Rst; apply/snet/Rantisym. by rewrite AeAs /=; apply; right. case: (pselect (B s)) => [Bs|nBs]. by right; apply: exist_congr; rewrite predeqE => r; split=> [/sBAs|[/sAB| <-]]. left; case: A tub Astot sBAs sAB => A Atot /= tub Astot sBAs sAB. apply: exist_congr; rewrite predeqE => r; split=> [Br|/sAB] //. by have /sBAs [|ser] // := Br; rewrite -ser in Br. Qed. Definition premaximal T (R : T -> T -> Prop) (t : T) := forall s, R t s -> R s t. Lemma ZL_preorder T (t0 : T) (R : T -> T -> Prop) : (forall t, R t t) -> (forall r s t, R r s -> R s t -> R r t) -> (forall A : set T, total_on A R -> exists t, forall s, A s -> R s t) -> exists t, premaximal R t. Proof. move=> Rrefl Rtrans tot_max. set eqR := fun s t => R s t /\ R t s; set ceqR := fun s => [set t | eqR s t]. have eqR_trans r s t : eqR r s -> eqR s t -> eqR r t. by move=> [Rrs Rsr] [Rst Rts]; split; [apply: Rtrans Rst|apply: Rtrans Rsr]. have ceqR_uniq s t : eqR s t -> ceqR s = ceqR t. by rewrite predeqE => - [Rst Rts] r; split=> [[Rr rR] | [Rr rR]]; split; try exact: Rtrans Rr; exact: Rtrans rR _. set ceqRs := ceqR @` setT; set quotR := sig ceqRs. have ceqRP t : ceqRs (ceqR t) by exists t. set lift := fun t => exist _ (ceqR t) (ceqRP t). have lift_surj (A : quotR) : exists t : T, lift t = A. case: A => A [t Tt ctA]; exists t; rewrite /lift; case : _ / ctA. exact/congr1/Prop_irrelevance. have lift_inj s t : eqR s t -> lift s = lift t. by move=> eqRst; apply/exist_congr/ceqR_uniq. have lift_eqR s t : lift s = lift t -> eqR s t. move=> cst; have ceqst : ceqR s = ceqR t by have := congr1 sval cst. by rewrite [_ s]ceqst; split; apply: Rrefl. set repr := fun A : quotR => xget t0 [set t : T | lift t = A]. have repr_liftE t : eqR t (repr (lift t)) by apply: lift_eqR; have -> := xgetPex t0 (lift_surj (lift t)). set R' := fun A B : quotR => R (repr A) (repr B). have R'refl A : R' A A by apply: Rrefl. have R'trans A B C : R' A B -> R' B C -> R' A C by apply: Rtrans. have R'antisym A B : R' A B -> R' B A -> A = B. move=> RAB RBA; have [t tA] := lift_surj A; have [s sB] := lift_surj B. rewrite -tA -sB; apply: lift_inj; apply (eqR_trans _ _ _ (repr_liftE t)). have eAB : eqR (repr A) (repr B) by []. rewrite tA; apply: eqR_trans eAB _; rewrite -sB. by have [] := repr_liftE s. have [A Atot|A Amax] := Zorn R'refl R'trans R'antisym. have /tot_max [t tmax] : total_on [set repr B | B in A] R. by move=> ?? [B AB <-] [C AC <-]; apply: Atot. exists (lift t) => B AB; have [Rt _] := repr_liftE t. by apply: Rtrans Rt; apply: tmax; exists B. exists (repr A) => t RAt. have /Amax <- : R' A (lift t). by have [Rt _] := repr_liftE t; apply: Rtrans Rt. by have [] := repr_liftE t. Qed. hierarchy-builder-1.8.1/examples/demo2/stage10.v000066400000000000000000000165141474513043100214130ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun ssrbool ZArith QArith Qcanon. From HB Require Import structures. Require Import classical. Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope classical_set_scope. Local Open Scope hb_scope. Module Stage10. HB.mixin Record AddAG_of_TYPE A := { zero : A; add : A -> A -> A; opp : A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; }. HB.structure Definition AddAG := { A of AddAG_of_TYPE A }. Notation "0" := zero : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section AddAGTheory. Variable A : AddAG.type. Implicit Type (x : A). Lemma addr0 : right_id (@zero A) add. Proof. by move=> x; rewrite addrC add0r. Qed. Lemma addrN : right_inverse (@zero A) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrK : right_loop (@opp A) (@add A). Proof. by move=> x y; rewrite -addrA subrr addr0. Qed. Lemma addKr : left_loop (@opp A) (@add A). Proof. by move=> x y; rewrite addrA addNr add0r. Qed. Lemma addrNK : rev_right_loop (@opp A) (@add A). Proof. by move=> y x; rewrite -addrA addNr addr0. Qed. Lemma addNKr : rev_left_loop (@opp A) (@add A). Proof. by move=> x y; rewrite addrA subrr add0r. Qed. Lemma addrAC : right_commutative (@add A). Proof. by move=> x y z; rewrite -!addrA [y + z]addrC. Qed. Lemma addrCA : left_commutative (@add A). Proof. by move=> x y z; rewrite !addrA [x + y]addrC. Qed. Lemma addrACA : interchange (@add A) add. Proof. by move=> x y z t; rewrite !addrA [x + y + z]addrAC. Qed. Lemma opprK : involutive (@opp A). Proof. by move=> x; apply: (can_inj (addrK (- x))); rewrite addNr addrN. Qed. Lemma opprD x y : - (x + y) = - x - y. Proof. apply: (can_inj (addKr (x + y))). by rewrite subrr addrACA !subrr addr0. Qed. Lemma opprB x y : - (x - y) = y - x. Proof. by rewrite opprD opprK addrC. Qed. End AddAGTheory. HB.mixin Record Ring_of_AddAG A of AddAG A := { one : A; mul : A -> A -> A; mulrA : associative mul; mulr1 : left_id one mul; mul1r : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddAG_of_TYPE := AddAG_of_TYPE.Build A _ _ _ addrA addrC add0r addNr. HB.instance Definition to_Ring_of_AddAG := Ring_of_AddAG.Build A _ _ mulrA mul1r mulr1 mulrDl mulrDr. HB.end. HB.structure Definition Ring := { A of Ring_of_TYPE A }. Notation "1" := one : hb_scope. Infix "*" := (@mul _) : hb_scope. HB.mixin Record Topological T := { open : (T -> Prop) -> Prop; open_setT : open setT; open_bigcup : forall {I} (D : set I) (F : I -> set T), (forall i, D i -> open (F i)) -> open (\bigcup_(i in D) F i); open_setI : forall X Y : set T, open X -> open Y -> open (setI X Y); }. HB.structure Definition TopologicalSpace := { A of Topological A }. #[export] Hint Extern 0 (open setT) => now apply: open_setT : core. HB.factory Record TopologicalBase T := { open_base : set (set T); open_base_covers : setT `<=` \bigcup_(X in open_base) X; open_base_cup : forall X Y : set T, open_base X -> open_base Y -> forall z, (X `&` Y) z -> exists2 Z, open_base Z & Z z /\ Z `<=` X `&` Y }. HB.builders Context T (a : TopologicalBase T). Definition open_of : (T -> Prop) -> Prop := [set A | exists2 D, D `<=` open_base & A = \bigcup_(X in D) X]. Lemma open_of_setT : open_of setT. Proof. exists open_base; rewrite // predeqE => x; split=> // _. by apply: open_base_covers. Qed. Lemma open_of_bigcup {I} (D : set I) (F : I -> set T) : (forall i, D i -> open_of (F i)) -> open_of (\bigcup_(i in D) F i). Proof. Admitted. Lemma open_of_cap X Y : open_of X -> open_of Y -> open_of (X `&` Y). Proof. Admitted. HB.instance Definition to_Topological := Topological.Build T _ open_of_setT (@open_of_bigcup) open_of_cap. HB.end. Section ProductTopology. Variables (T1 T2 : TopologicalSpace.type). Definition prod_open_base := [set A | exists (A1 : set T1) (A2 : set T2), open A1 /\ open A2 /\ A = setM A1 A2]. Lemma prod_open_base_covers : setT `<=` \bigcup_(X in prod_open_base) X. Proof. move=> X _; exists setT => //; exists setT, setT; do ?split. - exact: open_setT. - exact: open_setT. - by rewrite predeqE. Qed. Lemma prod_open_base_setU X Y : prod_open_base X -> prod_open_base Y -> forall z, (X `&` Y) z -> exists2 Z, prod_open_base Z & Z z /\ Z `<=` X `&` Y. Proof. move=> [A1 [A2 [A1open [A2open ->]]]] [B1 [B2 [B1open [B2open ->]]]]. move=> [z1 z2] [[/=Az1 Az2] [/= Bz1 Bz2]]. exists ((A1 `&` B1) `*` (A2 `&` B2)). by eexists _, _; do ?[split; last first]; apply: open_setI. by split => // [[x1 x2] [[/=Ax1 Bx1] [/=Ax2 Bx2]]]. Qed. HB.instance Definition prod_topology := TopologicalBase.Build (T1 * T2)%type _ prod_open_base_covers prod_open_base_setU. End ProductTopology. Definition continuous {T T' : TopologicalSpace.type} (f : T -> T') := forall B : set T', open B -> open (f@^-1` B). Definition continuous2 {T T' T'': TopologicalSpace.type} (f : T -> T' -> T'') := continuous (fun xy => f xy.1 xy.2). HB.mixin Record JoinTAddAG T of AddAG_of_TYPE T & Topological T := { add_continuous : continuous2 (add : T -> T -> T); opp_continuous : continuous (opp : T -> T) }. HB.structure Definition TAddAG := { A of Topological A & AddAG_of_TYPE A & JoinTAddAG A }. (* Instance *) HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrK addr0. Qed. Import Qcanon. Search _ Qc "plus" "opp". Lemma Qcplus_opp_l q : - q + q = 0. Proof. by rewrite Qcplus_comm Qcplus_opp_r. Qed. HB.instance Definition Qc_ring_axioms := Ring_of_TYPE.Build Qc 0%Qc 1%Qc Qcplus Qcopp Qcmult Qcplus_assoc Qcplus_comm Qcplus_0_l Qcplus_opp_l Qcmult_assoc Qcmult_1_l Qcmult_1_r Qcmult_plus_distr_l Qcmult_plus_distr_r. Obligation Tactic := idtac. Definition Qcopen_base : set (set Qc) := [set A | exists a b : Qc, forall z, A z <-> a < z /\ z < b]. Program Definition QcTopological := TopologicalBase.Build Qc Qcopen_base _ _. Next Obligation. move=> x _; exists [set y | x - 1 < y < x + 1]. by exists (x - 1), (x + 1). split; rewrite Qclt_minus_iff. by rewrite -[_ + _]/(x - (x - 1))%G opprB addrCA subrr. by rewrite -[_ + _]/(x + 1 - x)%G addrAC subrr. Qed. Next Obligation. move=> X Y [aX [bX Xeq]] [aY [bY Yeq]] z [/Xeq [aXz zbX] /Yeq [aYz zbY]]. Admitted. HB.instance Definition _ : TopologicalBase Qc := QcTopological. Program Definition QcJoinTAddAG := JoinTAddAG.Build Qc _ _. Next Obligation. Admitted. Next Obligation. Admitted. HB.instance Definition _ : JoinTAddAG Qc := QcJoinTAddAG. End Stage10.hierarchy-builder-1.8.1/examples/demo2/stage11.v000066400000000000000000000300701474513043100214050ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun ssrbool ZArith QArith Qcanon. From HB Require Import structures. Require Import classical. Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope classical_set_scope. Local Open Scope hb_scope. Module Stage11. HB.mixin Record AddAG_of_TYPE A := { zero : A; add : A -> A -> A; opp : A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; }. HB.structure Definition AddAG := { A of AddAG_of_TYPE A }. (* TODO: command hb.module_export which creates a module, exports it immediatly and remembers that it should be added to the final Theory module created at file closure *) Notation "0" := zero : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section AddAGTheory. Variable A : AddAG.type. Implicit Type (x : A). Lemma addr0 : right_id (@zero A) add. Proof. by move=> x; rewrite addrC add0r. Qed. Lemma addrN : right_inverse (@zero A) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrK : right_loop (@opp A) (@add A). Proof. by move=> x y; rewrite -addrA subrr addr0. Qed. Lemma addKr : left_loop (@opp A) (@add A). Proof. by move=> x y; rewrite addrA addNr add0r. Qed. Lemma addrNK : rev_right_loop (@opp A) (@add A). Proof. by move=> y x; rewrite -addrA addNr addr0. Qed. Lemma addNKr : rev_left_loop (@opp A) (@add A). Proof. by move=> x y; rewrite addrA subrr add0r. Qed. Lemma addrAC : right_commutative (@add A). Proof. by move=> x y z; rewrite -!addrA [y + z]addrC. Qed. Lemma addrCA : left_commutative (@add A). Proof. by move=> x y z; rewrite !addrA [x + y]addrC. Qed. Lemma addrACA : interchange (@add A) add. Proof. by move=> x y z t; rewrite !addrA [x + y + z]addrAC. Qed. Lemma opprK : involutive (@opp A). Proof. by move=> x; apply: (can_inj (addrK (- x))); rewrite addNr addrN. Qed. Lemma opprD x y : - (x + y) = - x - y. Proof. apply: (can_inj (addKr (x + y))). by rewrite subrr addrACA !subrr addr0. Qed. Lemma opprB x y : - (x - y) = y - x. Proof. by rewrite opprD opprK addrC. Qed. End AddAGTheory. HB.mixin Record Ring_of_AddAG A of AddAG A := { one : A; mul : A -> A -> A; mulrA : associative mul; mulr1 : left_id one mul; mul1r : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddAG := AddAG_of_TYPE.Build A _ _ _ addrA addrC add0r addNr. HB.instance Definition to_Ring := Ring_of_AddAG.Build A _ _ mulrA mul1r mulr1 mulrDl mulrDr. HB.end. HB.structure Definition Ring := { A of Ring_of_TYPE A }. Notation "1" := one : hb_scope. Infix "*" := (@mul _) : hb_scope. HB.mixin Record Topological T := { open : (T -> Prop) -> Prop; open_setT : open setT; open_bigcup : forall {I} (D : set I) (F : I -> set T), (forall i, D i -> open (F i)) -> open (\bigcup_(i in D) F i); open_setI : forall X Y : set T, open X -> open Y -> open (setI X Y); }. HB.structure Definition TopologicalSpace := { A of Topological A }. #[export] Hint Extern 0 (open setT) => now apply: open_setT : core. HB.factory Record TopologicalBase T := { open_base : set (set T); open_base_covers : setT `<=` \bigcup_(X in open_base) X; open_base_cup : forall X Y : set T, open_base X -> open_base Y -> forall z, (X `&` Y) z -> exists2 Z, open_base Z & Z z /\ Z `<=` X `&` Y }. HB.builders Context T (a : TopologicalBase T). Definition open_of := [set A | exists2 D, D `<=` open_base & A = \bigcup_(X in D) X]. Lemma open_of_setT : open_of setT. Proof. exists open_base; rewrite // predeqE => x; split=> // _. by apply: open_base_covers. Qed. Lemma open_of_bigcup {I} (D : set I) (F : I -> set T) : (forall i, D i -> open_of (F i)) -> open_of (\bigcup_(i in D) F i). Proof. Admitted. Lemma open_of_cap X Y : open_of X -> open_of Y -> open_of (X `&` Y). Proof. Admitted. HB.instance Definition to_Topological := Topological.Build T _ open_of_setT (@open_of_bigcup) open_of_cap. HB.end. Section ProductTopology. Variables (T1 T2 : TopologicalSpace.type). Definition prod_open_base := [set A | exists (A1 : set T1) (A2 : set T2), open A1 /\ open A2 /\ A = setM A1 A2]. Lemma prod_open_base_covers : setT `<=` \bigcup_(X in prod_open_base) X. Proof. move=> X _; exists setT => //; exists setT, setT; do ?split. - exact: open_setT. - exact: open_setT. - by rewrite predeqE. Qed. Lemma prod_open_base_setU X Y : prod_open_base X -> prod_open_base Y -> forall z, (X `&` Y) z -> exists2 Z, prod_open_base Z & Z z /\ Z `<=` X `&` Y. Proof. move=> [A1 [A2 [A1open [A2open ->]]]] [B1 [B2 [B1open [B2open ->]]]]. move=> [z1 z2] [[/=Az1 Az2] [/= Bz1 Bz2]]. exists ((A1 `&` B1) `*` (A2 `&` B2)). by eexists _, _; do ?[split; last first]; apply: open_setI. by split => // [[x1 x2] [[/=Ax1 Bx1] [/=Ax2 Bx2]]]. Qed. HB.instance Definition prod_topology := TopologicalBase.Build (T1 * T2)%type _ prod_open_base_covers prod_open_base_setU. End ProductTopology. (* TODO: infer continuous as a morphism of Topology *) Definition continuous {T T' : TopologicalSpace.type} (f : T -> T') := forall B : set T', open B -> open (f@^-1` B). Definition continuous2 {T T' T'': TopologicalSpace.type} (f : T -> T' -> T'') := continuous (fun xy => f xy.1 xy.2). HB.mixin Record JoinTAddAG_wo_Uniform T of AddAG_of_TYPE T & Topological T := { add_continuous : continuous2 (add : T -> T -> T); opp_continuous : continuous (opp : T -> T) }. HB.structure Definition TAddAG_wo_Uniform := { A of Topological A & AddAG_of_TYPE A & JoinTAddAG_wo_Uniform A }. HB.mixin Record Uniform_wo_Topology U := { entourage : set (set (U * U)) ; filter_entourage : is_filter entourage ; entourage_sub : forall A, entourage A -> [set xy | xy.1 = xy.2] `<=` A; entourage_sym : forall A, entourage A -> entourage (graph_sym A) ; entourage_split : forall A, entourage A -> exists2 B, entourage B & graph_comp B B `<=` A ; }. HB.structure Definition UniformSpace_wo_Topology := { A of Uniform_wo_Topology A }. (* TODO: have a command hb.typealias which register "typealias factories" which turn a typealias into factories *) Definition uniform T : Type := T. Section Uniform_Topology. Variable U : UniformSpace_wo_Topology.type. Definition uniform_open : set (set (uniform U)). Admitted. Lemma uniform_open_setT : uniform_open setT. Admitted. Lemma uniform_open_bigcup : forall {I} (D : set I) (F : I -> set U), (forall i, D i -> uniform_open (F i)) -> uniform_open (\bigcup_(i in D) F i). Admitted. Lemma uniform_open_setI : forall X Y : set U, uniform_open X -> uniform_open Y -> uniform_open (setI X Y). Admitted. HB.instance Definition uniform_topology := Topological.Build (uniform U) _ uniform_open_setT (@uniform_open_bigcup) uniform_open_setI. End Uniform_Topology. HB.mixin Record Join_Uniform_Topology U of Topological U & Uniform_wo_Topology U := { openE : open = (uniform_open _ : set (set (uniform U))) }. (* TODO: this factory should be replaced by type alias uniform *) HB.factory Record Uniform_Topology U of Uniform_wo_Topology U := { }. HB.builders Context U (f : Uniform_Topology U). HB.instance Definition to_Topological : Topological U := (uniform_topology _). HB.end. HB.structure Definition UniformSpace := { A of Uniform_Topology A (* should be replaced by typealias uniform *) & Uniform_wo_Topology A }. (* TODO: should be ommited *) (* TODO: this is another typealias *) Definition tAddAG (T : Type) := T. Section TAddAGUniform. Variable T : TAddAG_wo_Uniform.type. Notation TT := (tAddAG T). Definition TAddAG_entourage : set (set (TT * TT)). Admitted. Lemma filter_TAddAG_entourage : is_filter TAddAG_entourage. Admitted. Lemma TAddAG_entourage_sub : forall A, TAddAG_entourage A -> [set xy | xy.1 = xy.2] `<=` A. Admitted. Lemma TAddAG_entourage_sym : forall A, TAddAG_entourage A -> TAddAG_entourage (graph_sym A). Admitted. Lemma TAddAG_entourage_split : forall A, TAddAG_entourage A -> exists2 B, TAddAG_entourage B & graph_comp B B `<=` A. Admitted. HB.instance Definition TAddAG_uniform := Uniform_wo_Topology.Build (tAddAG T) _ filter_TAddAG_entourage TAddAG_entourage_sub TAddAG_entourage_sym TAddAG_entourage_split. Lemma TAddAG_uniform_topologyE : open = (uniform_open _ : set (set (uniform TT))). Admitted. HB.instance Definition TAddAG_Join_Uniform_Topology := Join_Uniform_Topology.Build TT TAddAG_uniform_topologyE. Lemma TAddAG_entourageE : entourage = (TAddAG_entourage : set (set (TT * TT))). Admitted. End TAddAGUniform. HB.structure Definition Uniform_TAddAG_unjoined := { A of TAddAG_wo_Uniform A & Uniform_wo_Topology A }. (* should be created automatically *) HB.mixin Record Join_TAddAG_Uniform T of Uniform_TAddAG_unjoined T := { entourageE : entourage = (TAddAG_entourage _ : set (set (tAddAG T * tAddAG T))) }. (* TODO: should be subsumed by the type alias TAddAG *) HB.factory Record TAddAG_Uniform U of TAddAG_wo_Uniform U := { }. HB.builders Context U (a : TAddAG_Uniform U). HB.instance Definition to_Uniform_wo_Topology : Uniform_wo_Topology U := TAddAG_uniform _. HB.instance Definition to_Join_Uniform_Topology : Join_Uniform_Topology U := TAddAG_Join_Uniform_Topology _. HB.instance Definition to_Join_TAddAG_Uniform : Join_TAddAG_Uniform U := Join_TAddAG_Uniform.Build U (TAddAG_entourageE _). HB.end. HB.structure Definition TAddAG := { A of TAddAG_Uniform A (* TODO: should be replaced by type alias TAddAG *) & TAddAG_wo_Uniform A }. (* TODO: should be omitted *) HB.factory Definition JoinTAddAG T of AddAG_of_TYPE T & Topological T := (JoinTAddAG_wo_Uniform T). HB.builders Context T (a : JoinTAddAG T). HB.instance Definition to_JoinTAddAG_wo_Uniform : JoinTAddAG_wo_Uniform T := a. (* TODO: Nice error message when factory builders do not depend on the source factory 'a'*) HB.instance Definition to_Uniform : TAddAG_Uniform T := let _ : JoinTAddAG T := a in TAddAG_Uniform.Build T. HB.end. (* Instance *) HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Example test1 (m n : Z) : (m + n) - n + 0 = m. Proof. by rewrite addrK addr0. Qed. Import Qcanon. Lemma Qcplus_opp_l q : - q + q = 0. Proof. by rewrite Qcplus_comm Qcplus_opp_r. Qed. HB.instance Definition Qc_ring_axioms := Ring_of_TYPE.Build Qc 0%Qc 1%Qc Qcplus Qcopp Qcmult Qcplus_assoc Qcplus_comm Qcplus_0_l Qcplus_opp_l Qcmult_assoc Qcmult_1_l Qcmult_1_r Qcmult_plus_distr_l Qcmult_plus_distr_r. Obligation Tactic := idtac. Definition Qcopen_base : set (set Qc) := [set A | exists a b : Qc, forall z, A z <-> a < z /\ z < b]. Program Definition QcTopological := TopologicalBase.Build Qc Qcopen_base _ _. Next Obligation. move=> x _; exists [set y | x - 1 < y < x + 1]. by exists (x - 1), (x + 1). split; rewrite Qclt_minus_iff. by rewrite -[_ + _]/(x - (x - 1))%G opprB addrCA subrr. by rewrite -[_ + _]/(x + 1 - x)%G addrAC subrr. Qed. Next Obligation. move=> X Y [aX [bX Xeq]] [aY [bY Yeq]] z [/Xeq [aXz zbX] /Yeq [aYz zbY]]. Admitted. HB.instance Definition _ : TopologicalBase Qc := QcTopological. Program Definition QcJoinTAddAG := JoinTAddAG.Build Qc _ _. Next Obligation. Admitted. Next Obligation. Admitted. #[verbose] HB.instance Definition _ : JoinTAddAG Qc := QcJoinTAddAG. Check (entourage : set (set (Qc * Qc))). (* TODO fix spill-factory-param-factories *) End Stage11. hierarchy-builder-1.8.1/examples/demo3/000077500000000000000000000000001474513043100177525ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/demo3/hierarchy_0.v000066400000000000000000000013321474513043100223350ustar00rootroot00000000000000From HB Require Import structures. From Coq Require Import ssreflect ssrfun. HB.mixin Record MulMonoid_of_Type A := { one : A; mul : A -> A -> A; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; }. HB.structure Definition MulMonoid := { A of MulMonoid_of_Type A }. HB.mixin Record Ring_of_MulMonoid A of MulMonoid A := { zero : A; add : A -> A -> A; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.structure Definition Ring := { A of MulMonoid A & Ring_of_MulMonoid A }. hierarchy-builder-1.8.1/examples/demo3/hierarchy_1.v000066400000000000000000000030131474513043100223340ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. HB.mixin Record MulMonoid_of_Type A := { one : A; mul : A -> A -> A; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; }. HB.structure Definition MulMonoid := { A of MulMonoid_of_Type A }. HB.mixin Record AddMonoid_of_Type A := { zero : A; add : A -> A -> A; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition AddMonoid := { A of AddMonoid_of_Type A }. HB.mixin Record Ring_of_AddMulMonoid A of MulMonoid A & AddMonoid A := { opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; mulrDl : left_distributive mul (add : A -> A -> A); mulrDr : right_distributive mul (add : A -> A -> A); }. HB.structure Definition Ring := { A of MulMonoid A & AddMonoid A & Ring_of_AddMulMonoid A }. HB.factory Record Ring_of_MulMonoid A of MulMonoid A := { zero : A; add : A -> A -> A; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_MulMonoid A). HB.instance Definition to_AddMonoid_of_Type := AddMonoid_of_Type.Build A zero add addrA add0r addr0. HB.instance Definition to_Ring_of_AddMulMonoid := Ring_of_AddMulMonoid.Build A opp addrC addNr mulrDl mulrDr. HB.end. hierarchy-builder-1.8.1/examples/demo3/hierarchy_2.v000066400000000000000000000044731474513043100223500ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. HB.mixin Record MulMonoid_of_Type A := { one : A; mul : A -> A -> A; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; }. HB.structure Definition MulMonoid := { A of MulMonoid_of_Type A }. HB.mixin Record AddMonoid_of_Type A := { zero : A; add : A -> A -> A; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; }. HB.structure Definition AddMonoid := { A of AddMonoid_of_Type A }. HB.mixin Record AbGroup_of_AddMonoid A of AddMonoid A := { opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; }. HB.structure Definition AbGroup := { A of AddMonoid A & AbGroup_of_AddMonoid A }. HB.mixin Record Ring_of_AbGroupMulMonoid A of MulMonoid A & AbGroup A := { mulrDl : left_distributive mul (add : A -> A -> A); mulrDr : right_distributive mul (add : A -> A -> A); }. HB.structure Definition Ring := { A of MulMonoid A & AbGroup A & Ring_of_AbGroupMulMonoid A }. HB.factory Record Ring_of_AddMulMonoid A of MulMonoid A & AddMonoid A := { opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; mulrDl : left_distributive mul (add : A -> A -> A); mulrDr : right_distributive mul (add : A -> A -> A); }. HB.builders Context A (a : Ring_of_AddMulMonoid A). HB.instance Definition to_AbGroup_of_AddMonoid := AbGroup_of_AddMonoid.Build A opp addrC addNr. HB.instance Definition to_Ring_of_AbGroupMulMonoid := Ring_of_AbGroupMulMonoid.Build A mulrDl mulrDr. HB.end. HB.factory Record Ring_of_MulMonoid A of MulMonoid A := { zero : A; add : A -> A -> A; addrA : associative add; add0r : left_id zero add; addr0 : right_id zero add; opp : A -> A; addrC : commutative (add : A -> A -> A); addNr : left_inverse zero opp add; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_MulMonoid A). HB.instance Definition to_AddMonoid_of_Type := AddMonoid_of_Type.Build A zero add addrA add0r addr0. HB.instance Definition to_AbGroup_of_AddMonoid := AbGroup_of_AddMonoid.Build A opp addrC addNr. HB.instance Definition to_Ring_of_AddMulMonoid := Ring_of_AddMulMonoid.Build A opp addrC addNr mulrDl mulrDr. HB.end. hierarchy-builder-1.8.1/examples/demo3/test_0_0.v000066400000000000000000000022151474513043100215560ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect ssrfun. From HB Require Import structures. From HB Require Import demo3.hierarchy_0. Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). (* Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. *) Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. (* Instance *) HB.instance Definition Z_mulmonoid_axioms := MulMonoid_of_Type.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r. HB.instance Definition Z_ring_axioms := Ring_of_MulMonoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r Z.opp Z.add_comm Z.add_opp_diag_l Z.mul_add_distr_r Z.mul_add_distr_l. hierarchy-builder-1.8.1/examples/demo3/test_1_0.v000066400000000000000000000022141474513043100215560ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect ssrfun. From HB Require Import structures. From HB Require Import demo3.hierarchy_1. Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). (* Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. *) Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. (* Instance *) HB.instance Definition Z_mulmonoid_axioms := MulMonoid_of_Type.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r. HB.instance Definition Z_ring_axioms := Ring_of_MulMonoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r Z.opp Z.add_comm Z.add_opp_diag_l Z.mul_add_distr_r Z.mul_add_distr_l. hierarchy-builder-1.8.1/examples/demo3/test_2_0.v000066400000000000000000000022151474513043100215600ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect ssrfun. From HB Require Import structures. From HB Require Import demo3.hierarchy_2. Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). (* Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. *) Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. (* Instance *) HB.instance Definition Z_mulmonoid_axioms := MulMonoid_of_Type.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r. HB.instance Definition Z_ring_axioms := Ring_of_MulMonoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r Z.opp Z.add_comm Z.add_opp_diag_l Z.mul_add_distr_r Z.mul_add_distr_l. hierarchy-builder-1.8.1/examples/demo3/user_0.v000066400000000000000000000022661474513043100213440ustar00rootroot00000000000000From Coq Require Import ZArith ssreflect ssrfun. From HB Require Import structures. From @@DEMO@@ Require Import @@HIERARCHY@@. Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). (* Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. *) Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. (* Instance *) Definition Z_mulmonoid_axioms := MulMonoid_of_Type.Build Z 1%Z Z.mul Z.mul_assoc Z.mul_1_l Z.mul_1_r. HB.instance Z Z_mulmonoid_axioms. Definition Z_ring_axioms := Ring_of_MulMonoid.Build Z 0%Z Z.add Z.add_assoc Z.add_0_l Z.add_0_r Z.opp Z.add_comm Z.add_opp_diag_l Z.mul_add_distr_r Z.mul_add_distr_l. HB.instance Z Z_ring_axioms.hierarchy-builder-1.8.1/examples/demo4/000077500000000000000000000000001474513043100177535ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/demo4/hierarchy_0.v000066400000000000000000000013271474513043100223420ustar00rootroot00000000000000From HB Require Import structures. #[key="A"] HB.mixin Record m1 (T : Type) (A : Type) := { inhab : A; inhab_param : T; }. HB.structure Definition s1 T := { A of m1 T A }. Check inhab. (* inhab : forall (T : Type) (A : s1.type T), s1.sort A *) HB.instance Definition nat_m1 := m1.Build bool nat 7 false. Check (refl_equal _ : @inhab _ _ = 7). HB.instance Definition list_m1 A := m1.Build (option A) (list nat) (cons 7 nil) None. Check (refl_equal _ : @inhab _ _ = (cons 7 nil)). HB.mixin Record m2 (T : Type) (A : Type) of m1 T A := { inj : T -> A; }. HB.structure Definition s2 T := { A of m1 T A & m2 T A }. Check fun X : s2.type nat => inhab : X. Check fun X : s2.type nat => inj : nat -> X. About s2_to_s1.hierarchy-builder-1.8.1/examples/demo5/000077500000000000000000000000001474513043100177545ustar00rootroot00000000000000hierarchy-builder-1.8.1/examples/demo5/hierarchy_0.v000066400000000000000000000104621474513043100223430ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. HB.mixin Record AddComoid_of_TYPE A := { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. HB.structure Definition AddComoid := { A of AddComoid_of_TYPE A }. (* Begin change *) HB.mixin Record AddAG_of_AddComoid A of AddComoid A := { opp : A -> A; addNr : left_inverse zero opp add; }. HB.factory Record AddAG_of_TYPE A := { zero : A; add : A -> A -> A; opp : A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; }. HB.builders Context A (a : AddAG_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.end. HB.structure Definition AddAG := { A of AddAG_of_TYPE A }. HB.mixin Record Ring_of_AddAG A of AddAG A := { one : A; mul : A -> A -> A; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.factory Record Ring_of_AddComoid A of AddComoid A := { opp : A -> A; one : A; mul : A -> A -> A; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_AddComoid A). HB.instance Definition to_AddAG_of_AddComoid := AddAG_of_AddComoid.Build A _ addNr. HB.instance Definition to_Ring_of_AddAG := Ring_of_AddAG.Build A _ _ mulrA mul1r mulr1 mulrDl mulrDr. HB.end. (* End change *) HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_Ring_of_AddComoid := Ring_of_AddComoid.Build A _ _ _ addNr mulrA mul1r mulr1 mulrDl mulrDr. HB.end. HB.structure Definition Ring := { A of Ring_of_TYPE A }. (* Notations *) Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. (* Theory *) Section Theory. Variable R : Ring.type. Implicit Type (x : R). Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. HB.mixin Record LModule_of_AG (R : Ring.type) (M : Type) of AddAG M := { scale : Ring.sort R -> M -> M; (* TODO: insert coercions automatically *) scaleDl : forall v, {morph scale^~ v: a b / a + b}; scaleDr : right_distributive scale add; scaleA : forall a b v, scale a (scale b v) = scale (a * b) v; scale1r : forall m, scale 1 m = m; }. HB.structure Definition LModule (R : Ring.type) := { M of LModule_of_AG R M & }. Infix "*:" := (@scale _ _) (at level 30) : hb_scope. Definition regular (R : Type) := R. HB.instance Definition regular_AG (R : AddAG.type) := AddAG_of_TYPE.Build (regular (AddAG.sort R)) zero add opp addrA addrC add0r addNr. HB.instance Definition regular_LModule (R : Ring.type) := LModule_of_AG.Build R (regular (Ring.sort R)) mul (fun _ _ _ => mulrDl _ _ _) mulrDr mulrA mul1r. Require Import ZArith. HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Lemma test (m : Z) (n : regular Z) : m *: n = m * n. Proof. by []. Qed. hierarchy-builder-1.8.1/examples/hulk.v000066400000000000000000000244751474513043100201110ustar00rootroot00000000000000 From HB Require Import structures. Require Import ssreflect ssrfun ssrbool. (* ******************************************************************* *) (* *********************** Hierarchy design ************************** *) (* ******************************************************************* *) Module BadInheritance. HB.mixin Record HasMul T := { mul : T -> T -> T; }. HB.structure Definition Mul := { T of HasMul T }. HB.mixin Record HasSq T := { sq : T -> T; }. HB.structure Definition Sq := { T of HasSq T }. (* We need a functorial construction (a container) which preserves both structures. The simplest one is the option type. *) Definition option_mul {T : Mul.type} (o1 o2 : option T) : option T := match o1, o2 with | Some n, Some m => Some (mul n m) | _, _ => None end. HB.instance Definition _ (T : Mul.type) := HasMul.Build (option T) option_mul. Definition option_square {T : Sq.type} (o : option T) : option T := match o with | Some n => Some (sq n) | None => None end. HB.instance Definition _ (T : Sq.type) := HasSq.Build (option T) option_square. (* Now we mix the two unrelated structures by building Sq out of Mul. *** This breaks Non Forgetful Inheritance *** https://math-comp.github.io/competing-inheritance-paths-in-dependent-type-theory/ *) #[non_forgetful_inheritance] HB.instance Definition _ (T : Mul.type) := HasSq.Build T (fun x => mul x x). (* As we expect we can proved this (by reflexivity) *) Lemma sq_mul (V : Mul.type) (v : V) : sq v = mul v v. Proof. by reflexivity. Qed. Lemma problem (W : Mul.type) (w : option W) : sq w = mul w w. Proof. Fail reflexivity. (* What? It used to work! *) Fail rewrite sq_mul. (* Lemmas don't cross the container either! *) (* Let's investigate *) rewrite /mul/= /sq/=. (* As we expect, we are on the option type. In the LHS it is the Sq built using the NFI instance option_square w = option_mul w w *) rewrite /option_mul/=. rewrite /option_square/sq/=. congr (match w with Some n => _ | None => None end). (* The branches for Some differ, since w is a variable, they don't compare as equal (fun n : W => Some (mul n n)) = (fun n : W => match w with | Some m => Some (mul n m) | None => None end) *) Abort. End BadInheritance. Module GoodInheritance. HB.mixin Record HasMul T := { mul : T -> T -> T; }. HB.structure Definition Mul := { T of HasMul T }. HB.mixin Record HasSq T of Mul T := { sq : T -> T; sq_mul : forall x, sq x = mul x x; }. HB.structure Definition Sq := { T of HasSq T & Mul T }. Definition option_mul {T : Mul.type} (o1 o2 : option T) : option T := match o1, o2 with | Some n, Some m => Some (mul n m) | _, _ => None end. HB.instance Definition _ (T : Mul.type) := HasMul.Build (option T) option_mul. Definition option_square {T : Sq.type} (o : option T) : option T := match o with | Some n => Some (sq n) | None => None end. Lemma option_sq_mul {T : Sq.type} (o : option T) : option_square o = mul o o. Proof. by rewrite /option_square; case: o => [x|//]; rewrite sq_mul. Qed. HB.instance Definition _ (T : Sq.type) := HasSq.Build (option T) option_square option_sq_mul. Lemma problem (W : Sq.type) (w : option W) : sq w = mul w w. Proof. by rewrite sq_mul. Qed. End GoodInheritance. (* ******************************************************************* *) (* ********************** Feather factories *********************** *) (* ******************************************************************* *) (* HB comes with a concept of factory, a virtual interface that is compiled down to the real ones. When the contents of a factory are just one lemma, the following trick may come handy. We define a type "link" which is convertible to a new type T but carries, as a dummy argument, a proof that T is linked to some known type xT. We can then use "link" to transfer (copy) structure instances across the link. *) Module Feather. (* We need a hierarchy with a few structure, here we Equality -> Singleton *) HB.mixin Record HasEqDec T := { eqtest : T -> T -> bool; eqOK : forall x y, reflect (x = y) (eqtest x y); }. HB.structure Definition Equality := { T of HasEqDec T }. HB.mixin Record IsContractible T of HasEqDec T := { def : T; all_def : forall x, eqtest x def = true; }. HB.structure Definition Singleton := { T of IsContractible T }. (* This is the type which is used as a feather factory. - xT plays the role of a rich type, - T is a new type linked to xT by some lemma. In this case a very strong cancellation lemma canfg *) Definition link {xT T : Type} {f : xT -> T} {g : T -> xT} (canfg : forall x, f (g x) = x) := T. (* (link canfg) is convertible to T *) (* We explain HB how to transfer Equality over link *) Section TransferEQ. Context {eT : Equality.type} {T : Type} {f : eT -> T} {g : T -> eT}. Context (canfg : forall x, f (g x) = x). Definition link_eqtest (x y : T) : bool := eqtest (g x) (g y). Lemma link_eqOK (x y : T) : reflect (x = y) (link_eqtest x y). Proof. rewrite /link_eqtest; case: (eqOK (g x) (g y)) => [E|abs]. by constructor; rewrite -[x]canfg -[y]canfg E canfg. by constructor=> /(f_equal g)/abs. Qed. (* (link canfg) is now an Equality instance *) HB.instance Definition link_HasEqDec := HasEqDec.Build (link canfg) link_eqtest link_eqOK. End TransferEQ. (* We explain HB how to transfer Singleton over link *) Section TransferSingleton. Context {eT : Singleton.type} {T : Type} {f : eT -> T} {g : T -> eT}. Context (canfg : forall x, f (g x) = x). Definition link_def : link canfg := f def. Lemma link_all_def x : eqtest x link_def = true. Proof. rewrite /link_def; have /eqOK <- := all_def (g x). by rewrite canfg; case: (eqOK x x). Qed. (* (link canfg) is now a Signleton instance *) HB.instance Definition _ := IsContractible.Build (link canfg) link_def link_all_def. End TransferSingleton. (* We assume a known type B which is both an Equality and a Singleton *) Axiom B : Type. Axiom testB : B -> B -> bool. Axiom testOKB : forall x y, reflect (x = y) (testB x y). HB.instance Definition _ := HasEqDec.Build B testB testOKB. Axiom defB : B. Axiom all_defB : forall x, eqtest x defB = true. HB.instance Definition _ := IsContractible.Build B defB all_defB. (* Now we copy all instances from B to A via link *) Axiom A : Type. Axiom f : B -> A. Axiom g : A -> B. Axiom canfg : forall x, f (g x) = x. (* We take all the instances up to Singleton on (link canfg) and we copy them on A. Recall (link canfg) is convertible to A *) HB.instance Definition _ := Singleton.copy A (link canfg). HB.about A. (* both Equality and Singleton have been copied *) End Feather. (* ******************************************************************* *) (* ********************** Abstraction barriers *********************** *) (* ******************************************************************* *) Require Import Arith. Module SlowFailure. (* When building a library it is natural to stack definitions up and reuse things you already have as much as possible. More often that not we want to set up abstraction barriers. For example one may define a mathematical concept using, say, lists and their operations, provide a few lemmas about the new concept, and then expect the user to never unfold the concept and work with lists directly. Abstraction barriers are not only good for clients, which are granted to work at the right abstraction level, but also for Coq itself, since it may be tricked into unfolding definitions and manipulate huge terms. HB.lock is a tool to easily impose abstraction barriers. It uses modules and module signatures to seal the body of a definition, keeping access to it via an equation. *) (* not a very clever construction, but a large one. Bare with us. *) Definition new_concept := 999999. Lemma test x : new_concept ^ x ^ new_concept = x ^ new_concept ^ new_concept. Proof. (* this goal is not trivial, and maybe even false, but you may call some automation on it anyway *) Time Fail reflexivity. (* takes 7s, note that both by and // call reflexivity *) Abort. End SlowFailure. Module FastFailure. HB.lock Definition new_concept := 999999. Lemma test x : new_concept ^ x ^ new_concept = x ^ new_concept ^ new_concept. Time Fail reflexivity. (* takes 0s *) rewrite new_concept.unlock. Time Fail reflexivity. (* takes 7s, the original body is restored *) Abort. Print Module Type new_concept_Locked. Print Module new_concept. (* Module Type new_conceptLocked = Sig Parameter body : nat. Parameter unlock : body = 999999 End Module new_concept : new_conceptLocked := ... *) Print new_concept. (* Notation new_concept := new_concept.body *) Canonical unlock_new_concept := Unlockable new_concept.unlock. End FastFailure. (* ******************************************************************* *) (* ******************************* Joins ***************************** *) (* ******************************************************************* *) (* All structures which are not leaves must be joinable *) Module MissingJoin. HB.mixin Record isTop M := { }. HB.structure Definition Top := {M of isTop M}. HB.mixin Record isA1 M of Top M := { }. HB.structure Definition A1 := {M of isA1 M & isTop M}. HB.mixin Record isA2 M of Top M := { }. HB.structure Definition A2 := {M of isA2 M & isTop M}. HB.mixin Record isB1 M of A1 M := { }. HB.structure Definition B1 := {M of isB1 M & }. HB.mixin Record isB2 M of A2 M := { }. HB.structure Definition B2 := {M of isB2 M & isA2 M }. HB.structure Definition B2A1 := {M of B2 M & A1 M }. Fail HB.structure Definition A2B1 := {M of A2 M & B1 M }. HB.graph "missing_join.dot". End MissingJoin. Module GoodJoin. HB.mixin Record isTop M := { }. HB.structure Definition Top := {M of isTop M}. HB.mixin Record isA1 M of Top M := { }. HB.structure Definition A1 := {M of isA1 M & isTop M}. HB.mixin Record isA2 M of Top M := { }. HB.structure Definition A2 := {M of isA2 M & isTop M}. HB.mixin Record isB1 M of A1 M := { }. HB.structure Definition B1 := {M of isB1 M & }. HB.mixin Record isB2 M of A2 M := { }. HB.structure Definition B2 := {M of isB2 M & isA2 M }. HB.structure Definition join := {M of A1 M & A2 M }. HB.structure Definition B2A1 := {M of B2 M & A1 M }. HB.structure Definition A2B1 := {M of A2 M & B1 M }. HB.graph "good_join.dot". End GoodJoin. hierarchy-builder-1.8.1/examples/readme.v000066400000000000000000000024701474513043100203720ustar00rootroot00000000000000From HB Require Import structures. From Coq Require Import ssreflect ZArith. #[verbose, log] HB.mixin Record AddComoid_of_Type A := { zero : A; add : A -> A -> A; addrA : forall x y z, add x (add y z) = add (add x y) z; addrC : forall x y, add x y = add y x; add0r : forall x, add zero x = x; }. #[verbose, log(raw)] HB.structure Definition AddComoid := { A of AddComoid_of_Type A }. Notation "0" := zero. Infix "+" := add. Check forall (M : AddComoid.type) (x : M), x + x = 0. HB.mixin Record AbelianGrp_of_AddComoid A of AddComoid_of_Type A := { opp : A -> A; addNr : forall x, opp x + x = 0; }. HB.structure Definition AbelianGrp := { A of AbelianGrp_of_AddComoid A & }. Notation "- x" := (opp x). Lemma example (G : AbelianGrp.type) (x : G) : x + (- x) = - 0. Proof. by rewrite addrC addNr -[LHS](addNr zero) addrC add0r. Qed. HB.instance Definition Z_CoMoid := AddComoid_of_Type.Build Z 0%Z Z.add Z.add_assoc Z.add_comm Z.add_0_l. HB.instance Definition Z_AbGrp := AbelianGrp_of_AddComoid.Build Z Z.opp Z.add_opp_diag_l. Lemma example2 (x : Z) : x + (- x) = - 0. Proof. by rewrite example. Qed. Check AbelianGrp.on Z. HB.graph "readme.dot". HB.about Z. Section Test. HB.declare Context (T : Type) (p : AddComoid_of_Type T) (q : AbelianGrp_of_AddComoid T). Goal forall x : T, x + -x = 0. Abort. End Test. hierarchy-builder-1.8.1/shim/000077500000000000000000000000001474513043100160655ustar00rootroot00000000000000hierarchy-builder-1.8.1/shim/Makefile000066400000000000000000000003051474513043100175230ustar00rootroot00000000000000COQMAKEFILE?=$(COQBIN)coq_makefile build: $(COQMAKEFILE) -f _CoqProject -o Makefile.coq $(MAKE) -f Makefile.coq install: $(MAKE) -f Makefile.coq install clean: $(MAKE) -f Makefile.coq clean hierarchy-builder-1.8.1/shim/_CoqProject000066400000000000000000000000251474513043100202150ustar00rootroot00000000000000-R . HB structures.vhierarchy-builder-1.8.1/shim/structures.v000066400000000000000000000007041474513043100205000ustar00rootroot00000000000000From Coq Require Import String ssreflect ssrfun. Export String.StringSyntax. Variant error_msg := NoMsg | IsNotCanonicallyA (x : Type). Definition unify T1 T2 (t1 : T1) (t2 : T2) (s : error_msg) := phantom T1 t1 -> phantom T2 t2. Definition id_phant {T} {t : T} (x : phantom T t) := x. Definition nomsg : error_msg := NoMsg. Definition is_not_canonically_a x := IsNotCanonicallyA x. Definition new {T} (x : T) := x. Definition eta {T} (x : T) := x. hierarchy-builder-1.8.1/tests/000077500000000000000000000000001474513043100162675ustar00rootroot00000000000000hierarchy-builder-1.8.1/tests/about.v000066400000000000000000000023521474513043100175720ustar00rootroot00000000000000From Coq Require Import ZArith ssrfun ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_5. HB.instance Definition _ := AddAG_of_TYPE.Build Z 0%Z Z.add Z.opp Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l. HB.instance Definition _ := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. (* mixin *) HB.about AddMonoid_of_TYPE. (* mixin constructor *) HB.about AddMonoid_of_TYPE.Build. (* structure *) HB.about AddAG.type. (* class *) HB.about AddMonoid. (* factory *) HB.about Ring_of_AddAG. (* factory constructor *) HB.about Ring_of_AddAG.Build. (* operation *) HB.about add. (* canonical proj/value *) HB.about AddAG.sort. (* canonical value *) HB.about Z. (* coercion *) HB.about hierarchy_5_Ring_class__to__hierarchy_5_SemiRing_class. HB.about hierarchy_5_Ring__to__hierarchy_5_SemiRing. (* builder *) HB.about Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid. HB.locate BinNums_Z__canonical__hierarchy_5_AddAG. (* Test minimally qualified names *) Module Import hierarchy_5. Module AddComoid. End AddComoid. End hierarchy_5. HB.about Z. hierarchy-builder-1.8.1/tests/about.v.out000066400000000000000000000130161474513043100203770ustar00rootroot00000000000000Toplevel input, character 0: > From Coq Require Import ZArith ssrfun ssreflect. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Warning: "From Coq" has been replaced by "From Stdlib". [deprecated-from-Coq,deprecated-since-9.0,deprecated,default] HB: AddMonoid_of_TYPE is a factory (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddMonoid_of_TYPE operations and axioms are: - zero - add - addrA - add0r - addr0 HB: AddMonoid_of_TYPE requires the following mixins: HB: AddMonoid_of_TYPE provides the following mixins: - AddMonoid_of_TYPE HB: AddMonoid_of_TYPE.Build is a factory constructor (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddMonoid_of_TYPE.Build requires its subject to be already equipped with: HB: AddMonoid_of_TYPE.Build provides the following mixins: - AddMonoid_of_TYPE HB: arguments: AddMonoid_of_TYPE.Build S zero add addrA add0r addr0 - S : Type - zero : AddMonoid.sort S - add : S -> S -> S - addrA : associative add - add0r : left_id 0%G add - addr0 : right_id 0%G add HB: AddAG.type is a structure (from "./examples/demo1/hierarchy_5.v", line 73) HB: AddAG.type characterizing operations and axioms are: - addNr - opp HB: AddAG is a factory for the following mixins: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid (* new, not from inheritance *) HB: AddAG inherits from: - AddMonoid - AddComoid HB: AddAG is inherited by: - Ring HB: AddMonoid.type is a structure (from "./examples/demo1/hierarchy_5.v", line 17) HB: AddMonoid.type characterizing operations and axioms are: - addr0 - add0r - addrA - add - zero HB: AddMonoid is a factory for the following mixins: - AddMonoid_of_TYPE (* new, not from inheritance *) HB: AddMonoid inherits from: HB: AddMonoid is inherited by: - AddComoid - AddAG - BiNearRing - SemiRing - Ring HB: Ring_of_AddAG is a factory (from "./examples/demo1/hierarchy_5.v", line 108) HB: Ring_of_AddAG operations and axioms are: - one - mul - mulrA - mulr1 - mul1r - mulrDl - mulrDr HB: Ring_of_AddAG requires the following mixins: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid HB: Ring_of_AddAG provides the following mixins: - BiNearRing_of_AddMonoid Doc: Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995). HB: Ring_of_AddAG.Build is a factory constructor (from "./examples/demo1/hierarchy_5.v", line 108) HB: Ring_of_AddAG.Build requires its subject to be already equipped with: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid HB: Ring_of_AddAG.Build provides the following mixins: - BiNearRing_of_AddMonoid HB: arguments: Ring_of_AddAG.Build A [one] [mul] mulrA mulr1 mul1r mulrDl mulrDr - A : Type - one : A - mul : A -> A -> A - mulrA : associative mul - mulr1 : left_id one mul - mul1r : right_id one mul - mulrDl : left_distributive mul add - mulrDr : right_distributive mul add Doc: Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995). HB: add is an operation of structure AddMonoid (from "./examples/demo1/hierarchy_5.v", line 17) HB: add comes from mixin AddMonoid_of_TYPE (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddAG.sort is a canonical projection (from "./examples/demo1/hierarchy_5.v", line 73) HB: AddAG.sort has the following canonical values: - Ring.sort (from "./examples/demo1/hierarchy_5.v", line 196) - Z HB: AddAG.sort is a coercion from AddAG to Sortclass (from "./examples/demo1/hierarchy_5.v", line 73) HB: Z is canonically equipped with structures: - AddMonoid AddComoid AddAG (from "(stdin)", line 5) - BiNearRing SemiRing Ring (from "(stdin)", line 10) HB: hierarchy_5_Ring_class__to__hierarchy_5_SemiRing_class is a coercion from Ring to SemiRing (from "./examples/demo1/hierarchy_5.v", line 196) HB: hierarchy_5_Ring__to__hierarchy_5_SemiRing is a coercion from Ring to SemiRing (from "./examples/demo1/hierarchy_5.v", line 196) Toplevel input, character 15: > HB.about Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: HB: unable to locate Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid HB: synthesized in file File "(stdin)", line 5, column 0, character 127: Interactive Module hierarchy_5 started Interactive Module AddComoid started HB: Z is canonically equipped with structures: - AddMonoid demo1.hierarchy_5.AddComoid AddAG (from "(stdin)", line 5) - BiNearRing SemiRing Ring (from "(stdin)", line 10) hierarchy-builder-1.8.1/tests/about.v.out.18000066400000000000000000000124251474513043100206310ustar00rootroot00000000000000HB: AddMonoid_of_TYPE is a factory (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddMonoid_of_TYPE operations and axioms are: - zero - add - addrA - add0r - addr0 HB: AddMonoid_of_TYPE requires the following mixins: HB: AddMonoid_of_TYPE provides the following mixins: - AddMonoid_of_TYPE HB: AddMonoid_of_TYPE.Build is a factory constructor (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddMonoid_of_TYPE.Build requires its subject to be already equipped with: HB: AddMonoid_of_TYPE.Build provides the following mixins: - AddMonoid_of_TYPE HB: arguments: AddMonoid_of_TYPE.Build S zero add addrA add0r addr0 - S : Type - zero : AddMonoid.sort S - add : S -> S -> S - addrA : associative add - add0r : left_id 0%G add - addr0 : right_id 0%G add HB: AddAG.type is a structure (from "./examples/demo1/hierarchy_5.v", line 73) HB: AddAG.type characterizing operations and axioms are: - addNr - opp HB: AddAG is a factory for the following mixins: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid (* new, not from inheritance *) HB: AddAG inherits from: - AddMonoid - AddComoid HB: AddAG is inherited by: - Ring HB: AddMonoid.type is a structure (from "./examples/demo1/hierarchy_5.v", line 17) HB: AddMonoid.type characterizing operations and axioms are: - addr0 - add0r - addrA - add - zero HB: AddMonoid is a factory for the following mixins: - AddMonoid_of_TYPE (* new, not from inheritance *) HB: AddMonoid inherits from: HB: AddMonoid is inherited by: - AddComoid - AddAG - BiNearRing - SemiRing - Ring HB: Ring_of_AddAG is a factory (from "./examples/demo1/hierarchy_5.v", line 108) HB: Ring_of_AddAG operations and axioms are: - one - mul - mulrA - mulr1 - mul1r - mulrDl - mulrDr HB: Ring_of_AddAG requires the following mixins: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid HB: Ring_of_AddAG provides the following mixins: - BiNearRing_of_AddMonoid Doc: Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995). HB: Ring_of_AddAG.Build is a factory constructor (from "./examples/demo1/hierarchy_5.v", line 108) HB: Ring_of_AddAG.Build requires its subject to be already equipped with: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid HB: Ring_of_AddAG.Build provides the following mixins: - BiNearRing_of_AddMonoid HB: arguments: Ring_of_AddAG.Build A [one] [mul] mulrA mulr1 mul1r mulrDl mulrDr - A : Type - one : A - mul : A -> A -> A - mulrA : associative mul - mulr1 : left_id one mul - mul1r : right_id one mul - mulrDl : left_distributive mul add - mulrDr : right_distributive mul add Doc: Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995). HB: add is an operation of structure AddMonoid (from "./examples/demo1/hierarchy_5.v", line 17) HB: add comes from mixin AddMonoid_of_TYPE (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddAG.sort is a canonical projection (from "./examples/demo1/hierarchy_5.v", line 73) HB: AddAG.sort has the following canonical values: - Ring.sort (from "./examples/demo1/hierarchy_5.v", line 196) - Z HB: AddAG.sort is a coercion from AddAG to Sortclass (from "./examples/demo1/hierarchy_5.v", line 73) HB: Z is canonically equipped with structures: - AddMonoid AddComoid AddAG (from "(stdin)", line 5) - BiNearRing SemiRing Ring (from "(stdin)", line 10) HB: hierarchy_5_Ring_class__to__hierarchy_5_SemiRing_class is a coercion from Ring to SemiRing (from "./examples/demo1/hierarchy_5.v", line 196) HB: hierarchy_5_Ring__to__hierarchy_5_SemiRing is a coercion from Ring to SemiRing (from "./examples/demo1/hierarchy_5.v", line 196) Toplevel input, character 15: > HB.about Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: HB: unable to locate Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid HB: synthesized in file File "(stdin)", line 5, column 0, character 127: Interactive Module hierarchy_5 started Interactive Module AddComoid started HB: Z is canonically equipped with structures: - AddMonoid demo1.hierarchy_5.AddComoid AddAG (from "(stdin)", line 5) - BiNearRing SemiRing Ring (from "(stdin)", line 10) hierarchy-builder-1.8.1/tests/about.v.out.19000066400000000000000000000124251474513043100206320ustar00rootroot00000000000000HB: AddMonoid_of_TYPE is a factory (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddMonoid_of_TYPE operations and axioms are: - zero - add - addrA - add0r - addr0 HB: AddMonoid_of_TYPE requires the following mixins: HB: AddMonoid_of_TYPE provides the following mixins: - AddMonoid_of_TYPE HB: AddMonoid_of_TYPE.Build is a factory constructor (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddMonoid_of_TYPE.Build requires its subject to be already equipped with: HB: AddMonoid_of_TYPE.Build provides the following mixins: - AddMonoid_of_TYPE HB: arguments: AddMonoid_of_TYPE.Build S zero add addrA add0r addr0 - S : Type - zero : AddMonoid.sort S - add : S -> S -> S - addrA : associative add - add0r : left_id 0%G add - addr0 : right_id 0%G add HB: AddAG.type is a structure (from "./examples/demo1/hierarchy_5.v", line 73) HB: AddAG.type characterizing operations and axioms are: - addNr - opp HB: AddAG is a factory for the following mixins: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid (* new, not from inheritance *) HB: AddAG inherits from: - AddMonoid - AddComoid HB: AddAG is inherited by: - Ring HB: AddMonoid.type is a structure (from "./examples/demo1/hierarchy_5.v", line 17) HB: AddMonoid.type characterizing operations and axioms are: - addr0 - add0r - addrA - add - zero HB: AddMonoid is a factory for the following mixins: - AddMonoid_of_TYPE (* new, not from inheritance *) HB: AddMonoid inherits from: HB: AddMonoid is inherited by: - AddComoid - AddAG - BiNearRing - SemiRing - Ring HB: Ring_of_AddAG is a factory (from "./examples/demo1/hierarchy_5.v", line 108) HB: Ring_of_AddAG operations and axioms are: - one - mul - mulrA - mulr1 - mul1r - mulrDl - mulrDr HB: Ring_of_AddAG requires the following mixins: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid HB: Ring_of_AddAG provides the following mixins: - BiNearRing_of_AddMonoid Doc: Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995). HB: Ring_of_AddAG.Build is a factory constructor (from "./examples/demo1/hierarchy_5.v", line 108) HB: Ring_of_AddAG.Build requires its subject to be already equipped with: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid HB: Ring_of_AddAG.Build provides the following mixins: - BiNearRing_of_AddMonoid HB: arguments: Ring_of_AddAG.Build A [one] [mul] mulrA mulr1 mul1r mulrDl mulrDr - A : Type - one : A - mul : A -> A -> A - mulrA : associative mul - mulr1 : left_id one mul - mul1r : right_id one mul - mulrDl : left_distributive mul add - mulrDr : right_distributive mul add Doc: Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995). HB: add is an operation of structure AddMonoid (from "./examples/demo1/hierarchy_5.v", line 17) HB: add comes from mixin AddMonoid_of_TYPE (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddAG.sort is a canonical projection (from "./examples/demo1/hierarchy_5.v", line 73) HB: AddAG.sort has the following canonical values: - Ring.sort (from "./examples/demo1/hierarchy_5.v", line 196) - Z HB: AddAG.sort is a coercion from AddAG to Sortclass (from "./examples/demo1/hierarchy_5.v", line 73) HB: Z is canonically equipped with structures: - AddMonoid AddComoid AddAG (from "(stdin)", line 5) - BiNearRing SemiRing Ring (from "(stdin)", line 10) HB: hierarchy_5_Ring_class__to__hierarchy_5_SemiRing_class is a coercion from Ring to SemiRing (from "./examples/demo1/hierarchy_5.v", line 196) HB: hierarchy_5_Ring__to__hierarchy_5_SemiRing is a coercion from Ring to SemiRing (from "./examples/demo1/hierarchy_5.v", line 196) Toplevel input, character 15: > HB.about Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: HB: unable to locate Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid HB: synthesized in file File "(stdin)", line 5, column 0, character 127: Interactive Module hierarchy_5 started Interactive Module AddComoid started HB: Z is canonically equipped with structures: - AddMonoid demo1.hierarchy_5.AddComoid AddAG (from "(stdin)", line 5) - BiNearRing SemiRing Ring (from "(stdin)", line 10) hierarchy-builder-1.8.1/tests/about.v.out.20000066400000000000000000000124251474513043100206220ustar00rootroot00000000000000HB: AddMonoid_of_TYPE is a factory (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddMonoid_of_TYPE operations and axioms are: - zero - add - addrA - add0r - addr0 HB: AddMonoid_of_TYPE requires the following mixins: HB: AddMonoid_of_TYPE provides the following mixins: - AddMonoid_of_TYPE HB: AddMonoid_of_TYPE.Build is a factory constructor (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddMonoid_of_TYPE.Build requires its subject to be already equipped with: HB: AddMonoid_of_TYPE.Build provides the following mixins: - AddMonoid_of_TYPE HB: arguments: AddMonoid_of_TYPE.Build S zero add addrA add0r addr0 - S : Type - zero : AddMonoid.sort S - add : S -> S -> S - addrA : associative add - add0r : left_id 0%G add - addr0 : right_id 0%G add HB: AddAG.type is a structure (from "./examples/demo1/hierarchy_5.v", line 73) HB: AddAG.type characterizing operations and axioms are: - addNr - opp HB: AddAG is a factory for the following mixins: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid (* new, not from inheritance *) HB: AddAG inherits from: - AddMonoid - AddComoid HB: AddAG is inherited by: - Ring HB: AddMonoid.type is a structure (from "./examples/demo1/hierarchy_5.v", line 17) HB: AddMonoid.type characterizing operations and axioms are: - addr0 - add0r - addrA - add - zero HB: AddMonoid is a factory for the following mixins: - AddMonoid_of_TYPE (* new, not from inheritance *) HB: AddMonoid inherits from: HB: AddMonoid is inherited by: - AddComoid - AddAG - BiNearRing - SemiRing - Ring HB: Ring_of_AddAG is a factory (from "./examples/demo1/hierarchy_5.v", line 108) HB: Ring_of_AddAG operations and axioms are: - one - mul - mulrA - mulr1 - mul1r - mulrDl - mulrDr HB: Ring_of_AddAG requires the following mixins: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid HB: Ring_of_AddAG provides the following mixins: - BiNearRing_of_AddMonoid Doc: Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995). HB: Ring_of_AddAG.Build is a factory constructor (from "./examples/demo1/hierarchy_5.v", line 108) HB: Ring_of_AddAG.Build requires its subject to be already equipped with: - AddMonoid_of_TYPE - AddComoid_of_AddMonoid - AddAG_of_AddComoid HB: Ring_of_AddAG.Build provides the following mixins: - BiNearRing_of_AddMonoid HB: arguments: Ring_of_AddAG.Build A [one] [mul] mulrA mulr1 mul1r mulrDl mulrDr - A : Type - one : A - mul : A -> A -> A - mulrA : associative mul - mulr1 : left_id one mul - mul1r : right_id one mul - mulrDl : left_distributive mul add - mulrDr : right_distributive mul add Doc: Builds a Ring from an Abelian Group: the absorbing properties mul0r and mul0r are derived from addrC and the other ring axioms, following a proof of Hankel (Gerhard Betsch. On the beginnings and development of near-ring theory. In Near-rings and near-fields. Proceedings of the conference held in Fredericton, New Brunswick, July 18-24, 1993, pages 1–11. Mathematics and its Applications, 336. Kluwer Academic Publishers Group, Dordrecht, 1995). HB: add is an operation of structure AddMonoid (from "./examples/demo1/hierarchy_5.v", line 17) HB: add comes from mixin AddMonoid_of_TYPE (from "./examples/demo1/hierarchy_5.v", line 10) HB: AddAG.sort is a canonical projection (from "./examples/demo1/hierarchy_5.v", line 73) HB: AddAG.sort has the following canonical values: - Ring.sort (from "./examples/demo1/hierarchy_5.v", line 196) - Z HB: AddAG.sort is a coercion from AddAG to Sortclass (from "./examples/demo1/hierarchy_5.v", line 73) HB: Z is canonically equipped with structures: - AddMonoid AddComoid AddAG (from "(stdin)", line 5) - BiNearRing SemiRing Ring (from "(stdin)", line 10) HB: hierarchy_5_Ring_class__to__hierarchy_5_SemiRing_class is a coercion from Ring to SemiRing (from "./examples/demo1/hierarchy_5.v", line 196) HB: hierarchy_5_Ring__to__hierarchy_5_SemiRing is a coercion from Ring to SemiRing (from "./examples/demo1/hierarchy_5.v", line 196) Toplevel input, character 15: > HB.about Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: HB: unable to locate Builders_40.hierarchy_5_Ring_of_AddAG__to__hierarchy_5_BiNearRing_of_AddMonoid HB: synthesized in file File "(stdin)", line 5, column 0, character 127: Interactive Module hierarchy_5 started Interactive Module AddComoid started HB: Z is canonically equipped with structures: - AddMonoid demo1.hierarchy_5.AddComoid AddAG (from "(stdin)", line 5) - BiNearRing SemiRing Ring (from "(stdin)", line 10) hierarchy-builder-1.8.1/tests/bug_435.v000066400000000000000000000015161474513043100176310ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record M T := { m : bool }. HB.structure Definition S := {T of M T}. HB.mixin Record A1 X T := { a1 : bool }. HB.structure Definition B1 X := {T of A1 X T}. HB.instance Definition _ (X : Type) := A1.Build X unit true. HB.mixin Record A2 (X : Type) T := { a2 : bool }. HB.structure Definition B2 (X : Type) := {T of A2 X T}. (* This should work but fails. *) Module should_work_but_fails. HB.structure Definition B (X : S.type) := {T of A1 X T & A2 X T}. #[verbose] HB.instance Definition _ (X : Type) := A2.Build X unit true. HB.saturate unit. Check unit : B.type _. End should_work_but_fails. Module workaround. HB.instance Definition _ (X : Type) := A2.Build X unit true. HB.structure Definition B (X : S.type) := {T of A1 X T & A2 X T}. HB.saturate unit. Check unit : B.type _. End workaround.hierarchy-builder-1.8.1/tests/bug_447.v000066400000000000000000000016061474513043100176340ustar00rootroot00000000000000From HB Require Import structures. Variant testTy := A | B. HB.mixin Record Stack1 T := { prop1 : unit }. HB.structure Definition JustStack1 := { T of Stack1 T }. HB.mixin Record Stack1Param R T := { prop2 : unit }. HB.structure Definition JustStack1Param R := { T of Stack1Param R T }. HB.mixin Record Stack2 T := { prop3 : unit }. HB.structure Definition JustStack2 := { T of Stack2 T }. HB.mixin Record Mixed T of Stack1 T & Stack2 T := { prop4 : unit }. HB.structure Definition JustMixed := { T of Mixed T & Stack1 T & Stack2 T}. HB.structure Definition JustMixedParam R := { T of Mixed T & Stack1 T & Stack1Param R T & Stack2 T}. HB.instance Definition _ := @Stack1.Build testTy tt. HB.instance Definition _ := @Stack2.Build testTy tt. HB.instance Definition _ {R} := @Stack1Param.Build R testTy tt. HB.instance Definition _ := @Mixed.Build testTy tt. Check testTy : JustMixedParam.type _.hierarchy-builder-1.8.1/tests/class_for.v000066400000000000000000000015371474513043100204370ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun ssrbool. From HB Require Import structures. (* without params *) HB.mixin Record isInhab T := { x : T }. HB.structure Definition Inhab := { T of isInhab T }. Definition unit' := unit. HB.instance Definition _ := isInhab.Build unit' tt. Check Inhab.of unit'. Fail Check Inhab.of unit. HB.instance Definition _ := Inhab.copy unit unit'. Check Inhab.of unit. (* with params *) HB.mixin Record isInhabIf (b : bool) (T : Type) := { y : forall ph : phant T, (match b with true => T | false => unit end) }. HB.structure Definition InhabIf b := { T of isInhabIf b T }. Definition bool' := bool. HB.instance Definition _ := isInhabIf.Build true bool' (fun=> false). Check InhabIf.of bool'. Fail Check InhabIf.of bool. HB.instance Definition _ := InhabIf.copy bool bool'. Check InhabIf.of bool. Check (y (Phant bool) : bool). hierarchy-builder-1.8.1/tests/compress_coe.v000066400000000000000000000017631474513043100211460ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. HB.mixin Record hasA T := { a : T }. HB.structure Definition A := {T of hasA T}. HB.mixin Record hasB (p : unit) T of A T := { b : T }. HB.structure Definition B p := {T of A T & hasB p T}. HB.mixin Record hasC (p q : unit) T of B p T := { c : T }. HB.structure Definition C p q := {T of B p T & hasC p q T}. HB.mixin Record hasD T of C tt tt T := { d : T }. HB.structure Definition D := {T of C tt tt T & hasD T}. #[compress_coercions] HB.instance Definition prodA (A A' : A.type) := hasA.Build (A * A')%type (a, a). #[compress_coercions] HB.instance Definition prodB p (B B' : B.type p) := hasB.Build p (B * B')%type (b, b). #[compress_coercions] HB.instance Definition prodC p q (C C' : C.type p q) := hasC.Build p q (C * C')%type (c, c). #[compress_coercions] HB.instance Definition prodD (D D' : D.type) := hasD.Build (D * D')%type (d, d). Set Printing Coercions. Print Datatypes_prod__canonical__compress_coe_D.hierarchy-builder-1.8.1/tests/compress_coe.v.out000066400000000000000000000016421474513043100217500ustar00rootroot00000000000000Toplevel input, character 0: > From Coq Require Import ssreflect ssrfun. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Warning: "From Coq" has been replaced by "From Stdlib". [deprecated-from-Coq,deprecated-since-9.0,deprecated,default] Datatypes_prod__canonical__compress_coe_D = fun D D' : D.type => {| D.sort := D.sort D * D.sort D'; D.class := {| D.compress_coe_hasA_mixin := prodA (compress_coe_D__to__compress_coe_A D) (compress_coe_D__to__compress_coe_A D'); D.compress_coe_hasB_mixin := prodB tt (compress_coe_D__to__compress_coe_B D) (compress_coe_D__to__compress_coe_B D'); D.compress_coe_hasC_mixin := prodC tt tt (compress_coe_D__to__compress_coe_C D) (compress_coe_D__to__compress_coe_C D'); D.compress_coe_hasD_mixin := prodD D D' |} |} : D.type -> D.type -> D.type Arguments Datatypes_prod__canonical__compress_coe_D D D' hierarchy-builder-1.8.1/tests/compress_coe.v.out.18000066400000000000000000000012671474513043100222020ustar00rootroot00000000000000Datatypes_prod__canonical__compress_coe_D = fun D D' : D.type => {| D.sort := D.sort D * D.sort D'; D.class := {| D.compress_coe_hasA_mixin := prodA (compress_coe_D__to__compress_coe_A D) (compress_coe_D__to__compress_coe_A D'); D.compress_coe_hasB_mixin := prodB tt (compress_coe_D__to__compress_coe_B D) (compress_coe_D__to__compress_coe_B D'); D.compress_coe_hasC_mixin := prodC tt tt (compress_coe_D__to__compress_coe_C D) (compress_coe_D__to__compress_coe_C D'); D.compress_coe_hasD_mixin := prodD D D' |} |} : D.type -> D.type -> D.type Arguments Datatypes_prod__canonical__compress_coe_D D D' hierarchy-builder-1.8.1/tests/compress_coe.v.out.19000066400000000000000000000012671474513043100222030ustar00rootroot00000000000000Datatypes_prod__canonical__compress_coe_D = fun D D' : D.type => {| D.sort := D.sort D * D.sort D'; D.class := {| D.compress_coe_hasA_mixin := prodA (compress_coe_D__to__compress_coe_A D) (compress_coe_D__to__compress_coe_A D'); D.compress_coe_hasB_mixin := prodB tt (compress_coe_D__to__compress_coe_B D) (compress_coe_D__to__compress_coe_B D'); D.compress_coe_hasC_mixin := prodC tt tt (compress_coe_D__to__compress_coe_C D) (compress_coe_D__to__compress_coe_C D'); D.compress_coe_hasD_mixin := prodD D D' |} |} : D.type -> D.type -> D.type Arguments Datatypes_prod__canonical__compress_coe_D D D' hierarchy-builder-1.8.1/tests/compress_coe.v.out.20000066400000000000000000000012671474513043100221730ustar00rootroot00000000000000Datatypes_prod__canonical__compress_coe_D = fun D D' : D.type => {| D.sort := D.sort D * D.sort D'; D.class := {| D.compress_coe_hasA_mixin := prodA (compress_coe_D__to__compress_coe_A D) (compress_coe_D__to__compress_coe_A D'); D.compress_coe_hasB_mixin := prodB tt (compress_coe_D__to__compress_coe_B D) (compress_coe_D__to__compress_coe_B D'); D.compress_coe_hasC_mixin := prodC tt tt (compress_coe_D__to__compress_coe_C D) (compress_coe_D__to__compress_coe_C D'); D.compress_coe_hasD_mixin := prodD D D' |} |} : D.type -> D.type -> D.type Arguments Datatypes_prod__canonical__compress_coe_D D D' hierarchy-builder-1.8.1/tests/declare.v000066400000000000000000000020511474513043100200530ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. HB.mixin Record hasA T := { a : T }. HB.structure Definition A := {T of hasA T}. HB.mixin Record hasB (p : unit) T of A T := { b : T }. HB.structure Definition B p := {T of A T & hasB p T}. HB.mixin Record hasC (p q : unit) T of B p T := { c : T }. HB.structure Definition C p q := {T of B p T & hasC p q T}. Section test. HB.declare Context p q T of hasA T & hasB p T & hasC p q T. Definition test := [the C.type _ _ of T]. End test. HB.factory Record hasABC (p q : unit) T := { a : T; b : T; c : T}. HB.builders Context p q T of hasABC p q T. HB.instance Definition _ := hasA.Build T a. HB.instance Definition _ := hasB.Build p T b. HB.instance Definition _ := hasC.Build p q T c. HB.end. Section test2. HB.declare Context p q T of hasABC p q T. Definition test2 := [the C.type _ _ of T]. End test2. (* broken *) (* Section test3. Definition copy : Type -> Type := id. HB.declare Context p T of hasABC p tt (copy T). Definition test3 := [the C.type _ _ of copy T]. End test3. *) hierarchy-builder-1.8.1/tests/display.v000066400000000000000000000001641474513043100201240ustar00rootroot00000000000000From HB Require Import structures. #[key="T"] HB.mixin Record m (d : unit) (T : Type) := { op : T -> T -> T; }. hierarchy-builder-1.8.1/tests/duplicate_structure.v000066400000000000000000000003721474513043100225520ustar00rootroot00000000000000From HB Require Import structures. Definition comb A op := forall x : A, op (op x) = x. HB.mixin Record Foo A := { op : A -> A; ax : comb A op }. HB.structure Definition S1 := { A of Foo A }. Fail HB.structure Definition S2 := { A of Foo A }. hierarchy-builder-1.8.1/tests/err_bad_mix.v000066400000000000000000000007021474513043100207300ustar00rootroot00000000000000From HB Require Import structures. Module Test. HB.mixin Record Mixin T := { zero: T; }. HB.structure Definition Struct := { T of Mixin T }. HB.instance Definition struct_bool := Mixin.Build bool true. Module Exports. HB.reexport. End Exports. End Test. (** Uncommenting any of these two prevents the issue *) (* Export Test.Exports. *) (* HB.export Test. *) Fail HB.instance Definition struct_nat := Test.Mixin.Build nat 0. hierarchy-builder-1.8.1/tests/err_bad_mix.v.out000066400000000000000000000003351474513043100215400ustar00rootroot00000000000000Interactive Module Test started Interactive Module Exports started The command has indeed failed with message: HB: Test.Mixin.axioms_ is not a factory or its library (HB.tests.err_bad_mix.Test) was not correctly imported hierarchy-builder-1.8.1/tests/err_instance_nop.v000066400000000000000000000003131474513043100220030ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record M T := {}. HB.structure Definition S := { x of M x }. HB.instance Definition _ : M nat := M.Build nat. HB.instance Definition _ : M nat := M.Build nat.hierarchy-builder-1.8.1/tests/err_instance_nop.v.out000066400000000000000000000003221474513043100226110ustar00rootroot00000000000000Toplevel input, character 0: > HB.instance Definition _ : M nat := M.Build nat. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Warning: HB: no new instance is generated [HB.no-new-instance,HB,elpi,default] hierarchy-builder-1.8.1/tests/err_instance_nop.v.out.18000066400000000000000000000001561474513043100230450ustar00rootroot00000000000000Toplevel input, character 155: Warning: HB: no new instance is generated [HB.no-new-instance,HB,elpi,default] hierarchy-builder-1.8.1/tests/err_instance_nop.v.out.19000066400000000000000000000001561474513043100230460ustar00rootroot00000000000000Toplevel input, character 155: Warning: HB: no new instance is generated [HB.no-new-instance,HB,elpi,default] hierarchy-builder-1.8.1/tests/err_instance_nop.v.out.20000066400000000000000000000001561474513043100230360ustar00rootroot00000000000000Toplevel input, character 155: Warning: HB: no new instance is generated [HB.no-new-instance,HB,elpi,default] hierarchy-builder-1.8.1/tests/err_miss_dep.v000066400000000000000000000005061474513043100211320ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record IsAddComoid A := {}. HB.structure Definition AddComoid := { A of IsAddComoid A }. HB.mixin Record IsAbelianGrp A of IsAddComoid A := {}. HB.structure Definition AbelianGrp := { A of IsAbelianGrp A }. Fail HB.mixin Record IsRing K of IsAbelianGrp K (*& IsAddComoid K*) := {}. hierarchy-builder-1.8.1/tests/err_miss_dep.v.out000066400000000000000000000006541474513043100217440ustar00rootroot00000000000000Toplevel input, character 0: > HB.structure Definition AbelianGrp := { A of IsAbelianGrp A }. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Warning: pulling in dependencies: [err_miss_dep_IsAddComoid] Please list them or end the declaration with '&' [HB.implicit-structure-dependency,HB,elpi,default] The command has indeed failed with message: HB: Unable to find mixin err_miss_dep_IsAddComoid on subject K hierarchy-builder-1.8.1/tests/err_miss_key.v000066400000000000000000000001241474513043100211460ustar00rootroot00000000000000From HB Require Import structures. Fail #[key="Tmiss"] HB.mixin Record Foo T := {}.hierarchy-builder-1.8.1/tests/err_miss_key.v.out000066400000000000000000000001631474513043100217570ustar00rootroot00000000000000The command has indeed failed with message: HB: The #[key="Tmiss"] attribute does not match the selected subject T hierarchy-builder-1.8.1/tests/err_missin_subject.v000066400000000000000000000003701474513043100223470ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record M X := {}. HB.structure Definition S := { X of M X}. HB.instance Definition _ : M nat := M.Build _. HB.instance Definition _ : M _ := M.Build bool. Fail HB.instance Definition _ : M _ := M.Build _.hierarchy-builder-1.8.1/tests/err_missin_subject.v.out000066400000000000000000000003101474513043100231470ustar00rootroot00000000000000The command has indeed failed with message: HB: The instance subject must be explicitly given. Use: HB.instance Definition _ : M := ... HB.instance Definition _ := M.Build ... hierarchy-builder-1.8.1/tests/exports.v000066400000000000000000000055401474513043100201660ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun ZArith. From HB Require Import structures. Module Enclosing. (**************************************************************************) (* Stage 0: +Ring+ *) (**************************************************************************) HB.mixin Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. #[mathcomp] HB.structure Definition Ring := { A of Ring_of_TYPE A }. (* Notations *) Module RingExports. Declare Scope hb_scope. Delimit Scope hb_scope with G. Local Open Scope hb_scope. Notation "0" := zero : hb_scope. Notation "1" := one : hb_scope. Infix "+" := (@add _) : hb_scope. Notation "- x" := (@opp _ x) : hb_scope. Infix "*" := (@mul _) : hb_scope. Notation "x - y" := (x + - y) : hb_scope. End RingExports. HB.export RingExports. (* Theory *) Section Theory. Local Open Scope hb_scope. Variable R : Ring.type. Implicit Type (x : R). Lemma addr0 : right_id (@zero R) add. Proof. by move=> x; rewrite addrC add0r. Qed. HB.export addr0. Lemma addrN : right_inverse (@zero R) opp add. Proof. by move=> x; rewrite addrC addNr. Qed. Lemma subrr x : x - x = 0. Proof. by rewrite addrN. Qed. Lemma addrNK x y : x + y - y = x. Proof. by rewrite -addrA subrr addr0. Qed. End Theory. HB.mixin Record Dummy T := { u : unit }. HB.structure Definition URing := { R of Ring R & Dummy R }. HB.factory Record dummy R of Ring R := {}. HB.builders Context T of dummy T. HB.instance Definition _ := Dummy.Build T tt. Definition addrNK := addrNK. HB.export addrNK. HB.end. Module Import Instances. #[export] HB.instance Definition Z_ring_axioms := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. Module Exports. HB.reexport Instances. End Exports. End Instances. Module Exports. #[verbose] HB.reexport. End Exports. Module ExportsOnlyInstance. Export Instances.Exports. End ExportsOnlyInstance. End Enclosing. Module Test1. (* We miss the coercions, canonical and elpi metadata *) Fail Check forall (R : Enclosing.Ring.type) (x : R), x = x. Fail Check 0%G. Fail Check addr0. Export Enclosing.Exports. Check forall (R : Enclosing.Ring.type) (x : R), x = x. Check 0%G. Example test1 (m n : Z) : ((m + n) - n + 0 = m)%G. Proof. by rewrite addrNK addr0. Qed. End Test1. Module Test2. Fail Check Enclosing.zero : Z. Export Enclosing.ExportsOnlyInstance. Check Enclosing.zero : Z. Fail Check 0%G. (* notation not there *) End Test2. hierarchy-builder-1.8.1/tests/exports2.v000066400000000000000000000001651474513043100202460ustar00rootroot00000000000000From HB Require Import structures. From HB Require tests.exports. Import exports.Enclosing. #[verbose] HB.reexport. hierarchy-builder-1.8.1/tests/factory_sort.v000066400000000000000000000016101474513043100211720ustar00rootroot00000000000000Require Import ssreflect ssrfun ssrbool. From HB Require Import structures. #[verbose] HB.mixin Record hasA T := { a : T }. About hasA.type. HB.structure Definition A := {T of hasA T}. HB.mixin Record hasB T := { b : T }. About hasB.type. HB.structure Definition B := {T of hasB T}. HB.structure Definition AB := {T of hasA T & hasB T}. HB.factory Record hasAB T := { a : T; b : T }. HB.builders Context T of hasAB T. HB.instance Definition _ := AB.copy T (AB.pack T (hasB.Build (hasA.Build T a) b)). HB.end. About hasAB.type. HB.factory Definition hasA' T := hasA T. About hasA'.type. Section test. Variables (G : Prop) (P : AB.type -> G). Goal forall T (a b : T), G. Proof. move=> T a b. pose Ta := hasA.Build _ a. pose Tab := hasB.Build Ta b. exact: P (AB.pack T Tab). Qed. Goal forall T (a b : T), G. Proof. move=> T a b. exact: P [the AB.type of hasAB.Build T a b : Type]. Qed. End test. hierarchy-builder-1.8.1/tests/factory_when_notation.v000066400000000000000000000003331474513043100230600ustar00rootroot00000000000000From HB Require Import structures. Notation x := (fun x : nat => true). HB.mixin Record m T := {x : T}. HB.factory Record f T := { x : T }. HB.builders Context T of f T. HB.instance Definition _ := m.Build T x. HB.end. hierarchy-builder-1.8.1/tests/fix_loop.v000066400000000000000000000001621474513043100202740ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record M A := { x: nat }. HB.structure Definition S := { A of M A }. hierarchy-builder-1.8.1/tests/fun_instance.v000066400000000000000000000005341474513043100211340ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun ssrbool. From HB Require Import structures. HB.mixin Record HasA T := { a : T }. HB.structure Definition A := { T of HasA T }. HB.instance Definition _ T (T' : A.type) := HasA.Build (T -> T') (fun=> a). HB.instance Definition _ := HasA.Build Prop True. HB.instance Definition _ := HasA.Build Type nat.hierarchy-builder-1.8.1/tests/funclass.v000066400000000000000000000027671474513043100203100ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record has_assoc T (F : T -> T -> T) := { assoc : forall x y z : T , F x (F y z) = F (F x y) z; }. HB.structure Definition Magma T := { F of has_assoc T F }. HB.mixin Record has_neutral T (F : T -> T -> T) := { id : T; idl : forall x : T , F id x = x; idr : forall x : T , F x id = x; }. HB.structure Definition Monoid T := { F of Magma T F & has_neutral T F }. About id. Require Import Arith ssreflect. HB.instance Definition x1 := has_assoc.Build nat plus Nat.add_assoc. Lemma plus_O_r x : x + 0 = x. Proof. by rewrite -plus_n_O. Qed. HB.instance Definition x2 := has_neutral.Build nat plus 0 plus_O_n plus_O_r. Check Monoid.on plus. Lemma test x : x + 0 = x. Proof. by rewrite idr. Qed. HB.factory Record MOT T (F : T -> T -> T) := { assoc : forall x y z : T , F x (F y z) = F (F x y) z; id : T; idl : forall x : T , F id x = x; commid : forall x : T , F x id = F id x; }. HB.builders Context T F of MOT T F. HB.instance Definition x3 := has_assoc.Build T F assoc. Lemma myidr x : F x id = x. Proof. by rewrite commid idl. Qed. HB.instance Definition x4 := has_neutral.Build T F id idl myidr. HB.end. HB.instance Definition x5 := MOT.Build nat mult Nat.mul_assoc 1 Nat.mul_1_l (fun x => Nat.mul_comm x 1). Check Monoid.on mult. HB.mixin Record silly (T1 : Type) (F : Monoid.type T1) (T : Type) := { xx : T }. HB.structure Definition wp T (F : Monoid.type T) := { A of silly T F A }. #[skip="8.11"] HB.check (forall w : wp.type _ mult, w = w). hierarchy-builder-1.8.1/tests/grefclass.v000066400000000000000000000003751474513043100204340ustar00rootroot00000000000000From HB Require Import structures. Definition pred T := T -> bool. HB.mixin Record isPredNat (f : pred nat) := {}. HB.structure Definition PredNat := {f of isPredNat f}. Section TestSort. Variable p : PredNat.type. Check p : pred nat. End TestSort. hierarchy-builder-1.8.1/tests/hb_pack.v000066400000000000000000000053641474513043100200550ustar00rootroot00000000000000Require Import ssreflect ssrfun ssrbool. From elpi Require Import elpi. From HB Require Import structures. #[verbose] HB.mixin Record hasA T := { a : T }. About hasA.type. HB.structure Definition A := {T of hasA T}. HB.mixin Record hasB T := { b : T * T }. About hasB.type. HB.structure Definition B := {T of hasB T}. #[short(pack="AB.pack")] HB.structure Definition AB := {T of hasA T & hasB T}. HB.factory Record hasAB T := { a : T; b : T * T }. HB.builders Context T of hasAB T. Definition xxx := HB.pack_for AB.type T (hasB.Build T b) (hasA.Build T a). HB.instance Definition _ := AB.copy T xxx. HB.end. About hasAB.type. HB.factory Definition hasA' T := hasA T. About hasA'.type. Section test. Variables (G : Prop) (P : AB.type -> G). (* problem with planB Goal forall T (a b : T), G. Proof. move=> T a b. pose Ta := hasA.Build _ a. pose A := ltac:(elpi HB.pack_for (A.type) (T) (Ta)). pose Tab := hasB.Build A (b,b). pose AB : AB.type := ltac:(elpi HB.pack (A) (Tab)). exact: P AB. Qed. *) Goal forall T (a b : T), G. Proof. move=> T a b. pose Ta := hasA.Build _ a. pose A := HB.pack_for A.type T Ta. pose Tab := hasB.Build A (b,b). pose AB := HB.pack_for AB.type A Tab. exact: P AB. Qed. Goal forall T (a b : T), G. Proof. move=> T a b. pose Ta := hasA.Build _ a. pose A : A.type := HB.pack T Ta. pose Tab := hasB.Build A (b,b). pose AB : AB.type := HB.pack A Tab. exact: P AB. Qed. Check forall T : AB.type, let x := AB.pack T in x. Goal forall T (a b : T), G. Proof. move=> T a b. unshelve epose (A := HB.pack_for A.type T (_ : hasA T)). by exact: (hasA.Build _ a). Check A : A.type. unshelve epose (A1 := HB.pack_for A.type T (hasA.Build T _)). by exact: a. Check A : A.type. pose AB1 := AB.pack A (_ : hasB _). Check AB1 : hasB A -> AB.type. have [:Bm] @AB2 := AB.pack A (Bm : hasB A). by exact: (hasB.Build _ (b,b)). Check Bm : hasB A. Check AB2 : AB.type. have [:pB] @AB3 := AB.pack A (hasB.Build A pB). by exact: (b,b). Check pB : T * T. Check AB3 : AB.type. have [:pA pB'] @AB4 := AB.pack T (hasAB.Build A pA pB'). by exact: a. by exact: (b,b). exact: P AB4. Qed. End test. HB.mixin Record HasFoo (A : Type) (P : A -> Prop) T := { foo : forall x, P x -> T; }. #[short(pack="Foo.pack")] HB.structure Definition Foo A P := { T of HasFoo A P T }. Section test2. Variable A : Type. Variable P : A -> Prop. Goal forall T, (forall x, P x -> T) -> True. intros T H. pose X := Foo.pack T (HasFoo.Build A P T H). Check X : Foo.type A P. Abort. End test2. HB.mixin Record isID T (F : T -> T) := { p : forall x : T, F x = x }. HB.structure Definition Fun T := { F of isID T F }. Goal forall f : nat -> nat, forall p : (forall x, f x = x ), True. intros f p. pose F := isID.Build nat f p. pose T : Fun.type nat := HB.pack f F. Check T : Fun.type nat. Abort. hierarchy-builder-1.8.1/tests/hnf.v000066400000000000000000000007361474513043100172370ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record M A := { x: nat }. HB.structure Definition S := { X of M X}. HB.factory Record f A := { y : nat }. HB.builders Context T of f T. HB.instance Definition _ := M.Build T (y + 1). HB.end. #[hnf] HB.instance Definition _ := f.Build nat (3 + 2). Print Datatypes_nat__canonical__hnf_S. Print HB_unnamed_mixin_8. HB.instance Definition _ := f.Build bool (3 + 2). Print Datatypes_bool__canonical__hnf_S. Print HB_unnamed_mixin_12. hierarchy-builder-1.8.1/tests/hnf.v.out000066400000000000000000000006651474513043100200460ustar00rootroot00000000000000Datatypes_nat__canonical__hnf_S = {| S.sort := nat; S.class := {| S.hnf_M_mixin := HB_unnamed_mixin_8 |} |} : S.type HB_unnamed_mixin_8 = {| M.x := f.y nat HB_unnamed_factory_6 + 1 |} : M.axioms_ nat Datatypes_bool__canonical__hnf_S = {| S.sort := bool; S.class := {| S.hnf_M_mixin := HB_unnamed_mixin_12 |} |} : S.type HB_unnamed_mixin_12 = Builders_1.HB_unnamed_factory_3 bool HB_unnamed_factory_9 : M.axioms_ bool hierarchy-builder-1.8.1/tests/hnf.v.out.16000066400000000000000000000006711474513043100202700ustar00rootroot00000000000000Datatypes_nat__canonical__hnf_S = {| S.sort := nat; S.class := {| S.hnf_M_mixin := HB_unnamed_mixin_8 |} |} : S.type HB_unnamed_mixin_8 = {| M.x := f.y nat HB_unnamed_factory_6 + 1 |} : M.axioms_ nat Datatypes_bool__canonical__hnf_S = {| S.sort := bool; S.class := {| S.hnf_M_mixin := HB_unnamed_mixin_12 |} |} : S.type HB_unnamed_mixin_12 = Builders_2.HB_unnamed_factory_4 bool HB_unnamed_factory_9 : M.axioms_ bool hierarchy-builder-1.8.1/tests/howto.v000066400000000000000000000012731474513043100176210ustar00rootroot00000000000000From Coq Require Import ZArith ssrfun ssreflect. From HB Require Import structures. From HB Require Import demo1.hierarchy_5. HB.howto Ring.type. HB.howto Ring.type 2. HB.howto Z Ring.type. HB.howto Z Ring.type 2. Fail HB.howto Z Ring.type 0. HB.howto AddComoid.type Ring.type. HB.instance Definition _ := AddAG_of_TYPE.Build Z 0%Z Z.add Z.opp Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l. HB.howto Z Ring.type. HB.howto AddAG.type Ring.type. HB.instance Definition _ := Ring_of_TYPE.Build Z 0%Z 1%Z Z.add Z.opp Z.mul Z.add_assoc Z.add_comm Z.add_0_l Z.add_opp_diag_l Z.mul_assoc Z.mul_1_l Z.mul_1_r Z.mul_add_distr_r Z.mul_add_distr_l. HB.howto Z Ring.type. hierarchy-builder-1.8.1/tests/howto.v.out000066400000000000000000000070261474513043100204310ustar00rootroot00000000000000Toplevel input, character 0: > From Coq Require Import ZArith ssrfun ssreflect. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Warning: "From Coq" has been replaced by "From Stdlib". [deprecated-from-Coq,deprecated-since-9.0,deprecated,default] HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid - AddComoid_of_TYPE; AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddComoid_of_TYPE; AddAG_of_AddComoid; Ring_of_AddAG - AddComoid_of_TYPE; AddAG_of_AddComoid; SemiRing_of_AddComoid - AddMonoid_of_TYPE; AddComoid_of_AddMonoid; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid - AddComoid_of_TYPE; AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddComoid_of_TYPE; AddAG_of_AddComoid; Ring_of_AddAG - AddComoid_of_TYPE; AddAG_of_AddComoid; SemiRing_of_AddComoid - AddMonoid_of_TYPE; AddComoid_of_AddMonoid; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances The command has indeed failed with message: HB: no solution found, try to increase search depth. HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_AddComoid - AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddAG_of_AddComoid; Ring_of_AddAG - AddAG_of_AddComoid; SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - BiNearRing_of_AddMonoid - Ring_of_AddAG - SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - BiNearRing_of_AddMonoid - Ring_of_AddAG - SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: nothing to do. hierarchy-builder-1.8.1/tests/howto.v.out.18000066400000000000000000000064351474513043100206630ustar00rootroot00000000000000HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid - AddComoid_of_TYPE; AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddComoid_of_TYPE; AddAG_of_AddComoid; Ring_of_AddAG - AddComoid_of_TYPE; AddAG_of_AddComoid; SemiRing_of_AddComoid - AddMonoid_of_TYPE; AddComoid_of_AddMonoid; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid - AddComoid_of_TYPE; AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddComoid_of_TYPE; AddAG_of_AddComoid; Ring_of_AddAG - AddComoid_of_TYPE; AddAG_of_AddComoid; SemiRing_of_AddComoid - AddMonoid_of_TYPE; AddComoid_of_AddMonoid; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances The command has indeed failed with message: HB: no solution found, try to increase search depth. HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_AddComoid - AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddAG_of_AddComoid; Ring_of_AddAG - AddAG_of_AddComoid; SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - BiNearRing_of_AddMonoid - Ring_of_AddAG - SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - BiNearRing_of_AddMonoid - Ring_of_AddAG - SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: nothing to do. hierarchy-builder-1.8.1/tests/howto.v.out.19000066400000000000000000000064351474513043100206640ustar00rootroot00000000000000HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid - AddComoid_of_TYPE; AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddComoid_of_TYPE; AddAG_of_AddComoid; Ring_of_AddAG - AddComoid_of_TYPE; AddAG_of_AddComoid; SemiRing_of_AddComoid - AddMonoid_of_TYPE; AddComoid_of_AddMonoid; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid - AddComoid_of_TYPE; AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddComoid_of_TYPE; AddAG_of_AddComoid; Ring_of_AddAG - AddComoid_of_TYPE; AddAG_of_AddComoid; SemiRing_of_AddComoid - AddMonoid_of_TYPE; AddComoid_of_AddMonoid; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances The command has indeed failed with message: HB: no solution found, try to increase search depth. HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_AddComoid - AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddAG_of_AddComoid; Ring_of_AddAG - AddAG_of_AddComoid; SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - BiNearRing_of_AddMonoid - Ring_of_AddAG - SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - BiNearRing_of_AddMonoid - Ring_of_AddAG - SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: nothing to do. hierarchy-builder-1.8.1/tests/howto.v.out.20000066400000000000000000000064351474513043100206540ustar00rootroot00000000000000HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid - AddComoid_of_TYPE; AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddComoid_of_TYPE; AddAG_of_AddComoid; Ring_of_AddAG - AddComoid_of_TYPE; AddAG_of_AddComoid; SemiRing_of_AddComoid - AddMonoid_of_TYPE; AddComoid_of_AddMonoid; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid - AddComoid_of_TYPE; AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddComoid_of_TYPE; AddAG_of_AddComoid; Ring_of_AddAG - AddComoid_of_TYPE; AddAG_of_AddComoid; SemiRing_of_AddComoid - AddMonoid_of_TYPE; AddComoid_of_AddMonoid; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_TYPE - AddAG_of_TYPE; BiNearRing_of_AddMonoid - AddAG_of_TYPE; Ring_of_AddAG - AddAG_of_TYPE; SemiRing_of_AddComoid - AddComoid_of_TYPE; Ring_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances The command has indeed failed with message: HB: no solution found, try to increase search depth. HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - Ring_of_AddComoid - AddAG_of_AddComoid; BiNearRing_of_AddMonoid - AddAG_of_AddComoid; Ring_of_AddAG - AddAG_of_AddComoid; SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - BiNearRing_of_AddMonoid - Ring_of_AddAG - SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: solutions (use 'HB.about F.Build' to see the arguments of each factory F): - BiNearRing_of_AddMonoid - Ring_of_AddAG - SemiRing_of_AddComoid For a guide on declaring MathComp instances please refer to the following link: https://github.com/math-comp/math-comp/wiki/How-to-declare-MathComp-instances HB: nothing to do. hierarchy-builder-1.8.1/tests/instance_before_structure.v000066400000000000000000000013761474513043100237330ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record m1 T := { default1 : T }. HB.mixin Record m2 T := { default2 : T }. HB.mixin Record m3 T := { default3 : T }. HB.structure Definition s1 := { T of m1 T }. HB.instance Definition _ : m1 nat := m1.Build nat 1. HB.about nat. (* too early *) HB.instance Definition _ : m2 nat := m2.Build nat 2. HB.about nat. (* only s1 on nat *) HB.instance Definition _ : m3 nat := m3.Build nat 3. HB.structure Definition s2 := { T of m1 T & m2 T }. HB.about nat. (* s2 is not there yet *) HB.structure Definition s3 := { T of m3 T }. HB.about nat. (* s2 has been instanciated but not s3 *) (* here it works *) HB.saturate. HB.about nat. (* all there *) Check @default1 nat. Check @default2 nat. Check @default3 nat. hierarchy-builder-1.8.1/tests/instance_merge.v000066400000000000000000000000001474513043100214270ustar00rootroot00000000000000hierarchy-builder-1.8.1/tests/instance_merge_with_distinct_param.v000066400000000000000000000031151474513043100255550ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record m1 T := { default1 : T }. HB.mixin Record m2 T := { default2 : T }. (* since s1 only requires m1 there is a 1:1 correspondence between the structure s1 and the mixin m1 *) HB.structure Definition s1 := { T of m1 T }. HB.structure Definition s2 := { T of m2 T }. HB.instance Definition nat_m1 := m1.Build nat 0. HB.instance Definition nat_m2 := m2.Build nat 1. (* with the following example we want to show that list preserves the s1 structure ie. if x:s1.type then (list x):s1.type, in practice we can use this for the type of polynomials *) HB.instance Definition list_m1 (X : s1.type) : m1 (list X) := m1.Build (list X) (cons default1 nil). (* similarly list preserves s2 structure *) HB.instance Definition list_m2 (X : s2.type) : m2 (list X) := m2.Build (list X) (cons default2 nil). HB.structure Definition s3 := { T of m1 T & m2 T }. (* since we can preserve m1 and m2 with list, we can preserve s3 as well ! *) (* if we have a file A with definitions of S1 and S2, file B importing Awith definitions of instance nat_m1 and nat_m2 file C importing A with the definition of s3 in a file D that imports B and C if we call saturate_instance, we create the instance for s3. this example shows the need for a separate command *) Fail Check nat : s3.type. HB.saturate. Check nat : s3.type. (* since nat satisfies s3.type, so does list nat *) Check list nat : s3.type. Check list (list nat) : s3.type. Fail Check fun t : s1.type => (list t : s3.type). Fail Check fun t : s2.type => (list t : s3.type). Check fun t : s3.type => (list t : s3.type). hierarchy-builder-1.8.1/tests/instance_merge_with_param.v000066400000000000000000000014451474513043100236600ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record m1 T := { default1 : T }. HB.mixin Record m2 T := { default2 : T }. HB.structure Definition s1 := { T of m1 T }. HB.structure Definition s2 := { T of m2 T }. HB.instance Definition _ (X : s1.type) : m1 (list X) := m1.Build (list X) (cons default1 nil). HB.instance Definition list_m2 (X : s1.type) : m2 (list X) := m2.Build (list X) nil. HB.structure Definition s3 := { T of m1 T & m2 T }. HB.about list. (* should have s3 *) (* The s3 instance on list should be synthetized automatically, *) (* But since it's defined afterwards, it's not taken into account. *) (* The subtelty now is that there is a parameter, but it's always the same *) (* A simple recall suffices: *) HB.instance Definition _ (X : s1.type) := list_m2 X. HB.about list. hierarchy-builder-1.8.1/tests/instance_params_no_type.v000066400000000000000000000020511474513043100233600ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record is_foo P A := { op : P -> A -> A }. HB.instance Definition nat_foo P := is_foo.Build P nat (fun _ x => x). HB.instance Definition list_foo P := is_foo.Build P (list P) (fun _ x => x). HB.instance Definition list_foo' P A:= is_foo.Build P (list A) (fun _ x => x). About list_foo'. HB.structure Definition foo P := { A of is_foo P A }. (* .... list A .... (fun A => {| foo.sort := list..; foo.class := {| foo.instance_params_no_type_is_foo_mixin := list_foo A |} |} ). HB.about foo. *) (* Elpi Trace Browser. *) Check nat_foo. Check list_foo. HB.mixin Record is_b A:= { default : A }. Check foo.type. Print foo.type. Print Module foo. Print foo.axioms_. (*Elpi Trace Browser. *) HB.structure Definition b := { A of is_b A}. HB.instance Definition nat_b := is_b.Build nat 0. HB.mixin Record is_bar (P : b.type) A := { test : P -> A -> A }. HB.structure Definition bar P := { A of is_bar P A}. HB.instance Definition list_bar P := is_bar.Build P (list P) (fun _ x => x). Check list_bar. hierarchy-builder-1.8.1/tests/interleave_context.v000066400000000000000000000016521474513043100223640ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun ssrbool. From HB Require Import structures. HB.mixin Record HasA (n : nat) T := { a : T }. HB.structure Definition A n := { T of HasA n T }. HB.mixin Record HasB (X : A.type 0) (T : Type) := { b : X -> T }. HB.structure Definition B (X : A.type 0) := { T of HasB X T }. (* Since `B` expects an argument of type `A.type 0` (and not just just the naked type `T`) we pass `A.clone 0 T _` (of type `A.type 0`) and inference uses the first parameter `A` to elaborate it. *) HB.mixin Record IsSelfA T of A 0 T & B (A.clone 0 T _) T := {}. HB.structure Definition SelfA := { T of IsSelfA T }. HB.factory Record IsSelfA' T := { a : T ; b : T -> T}. HB.builders Context T of IsSelfA' T. HB.instance Definition _ := HasA.Build 0 T a. HB.instance Definition _ := HasB.Build _ T b. HB.instance Definition _ := IsSelfA.Build T. HB.end. HB.instance Definition _ := IsSelfA'.Build nat 0 id. hierarchy-builder-1.8.1/tests/issue284.v000066400000000000000000000010071474513043100200420ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record X_of_Type Ω := {}. HB.structure Definition X := {Ω of X_of_Type Ω}. HB.instance Definition XProp := X_of_Type.Build Prop. Definition prop := Prop. HB.instance Definition Xprop := X_of_Type.Build prop. HB.instance Definition XSet := X_of_Type.Build Set. Definition set := Set. HB.instance Definition Xset := X_of_Type.Build set. HB.instance Definition XType := X_of_Type.Build Type. Definition type := Type. HB.instance Definition Xtype := X_of_Type.Build type. hierarchy-builder-1.8.1/tests/issue287.v000066400000000000000000000007611474513043100200530ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record InhMixin T := { point : T; }. HB.structure Definition Inh := { T of InhMixin T }. HB.instance Definition nat_inh := InhMixin.Build nat 0. Section ProdInh. Variables (T S : Inh.type). (* This works fine *) HB.instance Definition prod_inh := InhMixin.Build (T * S)%type (point, point). End ProdInh. Section FunInh. Variables (T S : Inh.type). HB.instance Definition fun_inh := InhMixin.Build (T -> S) (fun _ => point). End FunInh. hierarchy-builder-1.8.1/tests/local_instance.v000066400000000000000000000004361474513043100214370ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record def A := { default : A }. HB.structure Definition nonempty := { T of def T }. Section Box. #[local] HB.instance Definition def_nat := def.Build nat 1. Check default : nat. End Box. #[fail, skip="8.11"] HB.check (default : nat). hierarchy-builder-1.8.1/tests/lock.v000066400000000000000000000005421474513043100174070ustar00rootroot00000000000000From HB Require Import structures. HB.lock Definition foo := 3. Definition nat1 := nat. HB.lock Definition bar : nat1 := 3. HB.lock Definition baz n : nat := 3 + n. Module Import X. Axiom bigbody : Type -> Type -> Type. Axiom bigop : forall R I : Type, R -> list I -> (I -> bigbody R I) -> R. HB.lock Definition big := bigop. End X. About big. hierarchy-builder-1.8.1/tests/log_impargs_record.v000066400000000000000000000003741474513043100223230ustar00rootroot00000000000000From HB Require Import structures. Set Implicit Arguments. #[log] HB.mixin Record A T := { a : T; f : T -> T; p : forall x : T, f x = x -> True; q : forall h : f a = a, p _ h = p _ h; }. HB.structure Definition S := { T of A T }. About A.p.hierarchy-builder-1.8.1/tests/missing_join_error.v000066400000000000000000000011331474513043100223550ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record isTop M := { }. HB.structure Definition Top := {M of isTop M}. HB.mixin Record isA1 M of Top M := { }. HB.structure Definition A1 := {M of isA1 M & isTop M}. HB.mixin Record isA2 M of Top M := { }. HB.structure Definition A2 := {M of isA2 M & isTop M}. HB.mixin Record isB1 M of A1 M := { }. HB.structure Definition B1 := {M of isB1 M & }. HB.mixin Record isB2 M of A2 M := { }. HB.structure Definition B2 := {M of isB2 M & isA2 M }. HB.structure Definition B2A1 := {M of B2 M & A1 M }. Fail HB.structure Definition A2B1 := {M of A2 M & B1 M }.hierarchy-builder-1.8.1/tests/missing_join_error.v.out000066400000000000000000000011601474513043100231630ustar00rootroot00000000000000Toplevel input, character 0: > HB.structure Definition B2 := {M of isB2 M & isA2 M }. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Warning: pulling in dependencies: [missing_join_error_isTop] Please list them or end the declaration with '&' [HB.implicit-structure-dependency,HB,elpi,default] The command has indeed failed with message: You must declare the hierarchy bottom-up or add a missing join. There are two ways out: - declare structure A2B1 before structure B2A1 if B2A1 inherits from it; - declare an additional structure that inherits from both A1 and A2 and from which A2B1 and/or B2A1 inherit. hierarchy-builder-1.8.1/tests/non_forgetful_inheritance.v000066400000000000000000000044441474513043100237040ustar00rootroot00000000000000From HB Require Import structures. Require Import ssreflect ssrfun ssrbool. HB.mixin Record HasMul T := { mul : T -> T -> T; }. HB.structure Definition Mul := { T of HasMul T }. HB.mixin Record HasSq T := { sq : T -> T; }. HB.structure Definition Sq := { T of HasSq T }. (* We need a functorial construction (a container) which preserves both structures. The simplest one is the option type. *) Definition option_mul {T : Mul.type} (o1 o2 : option T) : option T := match o1, o2 with | Some n, Some m => Some (mul n m) | _, _ => None end. HB.instance Definition _ (T : Mul.type) := HasMul.Build (option T) option_mul. Definition option_square {T : Sq.type} (o : option T) : option T := match o with | Some n => Some (sq n) | None => None end. HB.instance Definition _ (T : Sq.type) := HasSq.Build (option T) option_square. (* Now we mix the two unrelated structures by building Sq out of Mul. *** This breaks Forgetful Inheritance *** https://math-comp.github.io/competing-inheritance-paths-in-dependent-type-theory/ hence, HB prevents us from using it without care. *) Set Warnings "+HB.non-forgetful-inheritance". Fail HB.instance Definition _ (T : Mul.type) := HasSq.Build T (fun x => mul x x). (* As advised by the error message, we contain the problem in a module *) Module MulSq. #[non_forgetful_inheritance] HB.instance Definition _ (T : Mul.type) := HasSq.Build T (fun x => mul x x). (* As we expect we can proved this (by reflexivity) *) Lemma sq_mul (V : Mul.type) (v : V) : sq v = mul v v. Proof. by reflexivity. Qed. Lemma problem (W : Mul.type) (w : option W) : sq w = mul w w. Proof. Fail reflexivity. (* What? It used to work! *) Fail rewrite sq_mul. (* Lemmas don't cross the container either! *) (* Let's investigate *) rewrite /mul/= /sq/=. (* As we expect, we are on the option type. In the LHS it is the Sq built using the NFI instance option_square w = option_mul w w *) rewrite /option_mul/=. rewrite /option_square/sq/=. congr (match w with Some n => _ | None => None end). (* The branches for Some differ, since w is a variable, they don't compare as equal (fun n : W => Some (mul n n)) = (fun n : W => match w with | Some m => Some (mul n m) | None => None end) *) Abort. End MulSq.hierarchy-builder-1.8.1/tests/not_same_key.v000066400000000000000000000003011474513043100211250ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record A T := { a : T }. #[key="T"] HB.mixin Record B T1 (T : Type) := { b : T -> T1 }. Fail HB.structure Definition sAB T1 := {T of A T & B T T1}.hierarchy-builder-1.8.1/tests/not_same_key.v.out000066400000000000000000000001221474513043100217340ustar00rootroot00000000000000The command has indeed failed with message: HB: all mixins must have the same key hierarchy-builder-1.8.1/tests/packable.v000066400000000000000000000025421474513043100202230ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. HB.mixin Record AddComoid_of_TYPE A := { zero : A; add : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; }. HB.structure Definition AddComoid := { A of AddComoid_of_TYPE A }. HB.mixin Record Ring_of_AddComoid A of AddComoid A := { opp : A -> A; one : A; mul : A -> A -> A; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. HB.factory Record Ring_of_TYPE A := { zero : A; one : A; add : A -> A -> A; opp : A -> A; mul : A -> A -> A; addrA : associative add; addrC : commutative add; add0r : left_id zero add; addNr : left_inverse zero opp add; mulrA : associative mul; mul1r : left_id one mul; mulr1 : right_id one mul; mulrDl : left_distributive mul add; mulrDr : right_distributive mul add; }. #[verbose] HB.builders Context A (a : Ring_of_TYPE A). HB.instance Definition to_AddComoid_of_TYPE := AddComoid_of_TYPE.Build A zero add addrA addrC add0r. HB.instance Definition to_Ring_of_AddComoid := Ring_of_AddComoid.Build A _ _ _ addNr mulrA mul1r mulr1 mulrDl mulrDr. HB.end. (* End change *) HB.structure Definition Ring := { A of Ring_of_TYPE A }.hierarchy-builder-1.8.1/tests/primitive_records.v000066400000000000000000000020071474513043100222060ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From elpi Require Import elpi. From HB Require Import structures. Elpi Command HB.test. #[primitive] HB.mixin Record hasA T := { a : T }. Elpi Query lp:{{ coq.locate "hasA.axioms_" (indt Ind), std.assert! (coq.env.record? Ind tt) "not primitive" }}. #[primitive] HB.structure Definition A := {T of hasA T}. Elpi Query lp:{{ coq.locate "A.axioms_" (indt Ind), std.assert! (coq.env.record? Ind tt) "not primitive" }}. Elpi Query lp:{{ coq.locate "A.type" (indt Ind), std.assert! (coq.env.record? Ind tt) "not primitive" }}. (* Issue #248 *) #[primitive] HB.mixin Record HasMul T := { mul : T -> T -> T; mulC: forall x y : T, mul x y = mul y x; mulA: associative mul; }. #[primitive] HB.structure Definition Mul := { T of HasMul T }. #[primitive] HB.mixin Record HasSq T of Mul T := { sq : T -> T; pmul : forall x y, sq (mul x y) = mul (sq x) (sq y); }. #[primitive] HB.structure Definition Sq := { T of HasSq T & Mul T }. Check erefl : Sq.sort _ = Mul.sort _. hierarchy-builder-1.8.1/tests/saturate_on.v000066400000000000000000000011071474513043100210010ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record HasPoint T := { default : T }. HB.instance Definition _ : HasPoint nat := HasPoint.Build nat 0. HB.instance Definition _ : HasPoint bool := HasPoint.Build bool false. HB.instance Definition _ A : HasPoint (list A) := HasPoint.Build (list A) nil. HB.instance Definition _ A : HasPoint Type := HasPoint.Build Type nat. HB.structure Definition Pointed := { T of HasPoint T }. HB.saturate (list _). Fail Check nat : Pointed.type. Fail Check bool : Pointed.type. Check (list unit : Pointed.type). Fail Check Type : Pointed.type. hierarchy-builder-1.8.1/tests/short.v000066400000000000000000000016221474513043100176160ustar00rootroot00000000000000From Coq Require Import ssreflect ssrfun. From HB Require Import structures. HB.mixin Record hasA T := { a : T }. #[short(type="aType", pack="AType")] HB.structure Definition A := {T of hasA T}. Check aType. HB.mixin Record hasB T := { b : T }. About hasB.type. #[short(type="bType", pack="BType")] HB.structure Definition B := {T of hasB T}. #[short(type="abType", pack="ABType")] HB.structure Definition AB := {T of hasA T & hasB T}. HB.factory Record hasAB T := { a : T; b : T }. HB.builders Context T of hasAB T. Definition xxx := ABType T (hasB.Build T b) (hasA.Build T a). HB.instance Definition _ := AB.copy T xxx. HB.end. About hasAB.type. HB.factory Definition hasA' T := hasA T. About hasA'.type. Section test. Variables (G : Prop) (P : AB.type -> G). Goal forall T (a b : T), G. Proof. move=> T a b. pose Ta := hasA.Build T a. pose Tb := hasB.Build T b. exact: P (ABType T Ta Tb). Qed. End test.hierarchy-builder-1.8.1/tests/subtype.v000066400000000000000000000023061474513043100201520ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record is_inhab T := { default : T }. HB.structure Definition Inhab := { T of is_inhab T }. HB.mixin Record is_nontrivial T := { twodiff : forall x : T, exists y : T, ~~ (x = y) }. HB.structure Definition Nontrivial1 := { T of is_nontrivial T }. HB.structure Definition Nontrivial := { T of is_inhab T & is_nontrivial T }. Definition pred T := T -> Prop. #[key="sub_sort"] HB.mixin Record is_SUB (T : Type) (P : pred T) (sub_sort : Type) := SubType { val : sub_sort -> T; Sub : forall x, P x -> sub_sort; Sub_rect : forall K (_ : forall x Px, K (@Sub x Px)) u, K u; SubK : forall x Px, val (@Sub x Px) = x }. HB.structure Definition SUB (T : Type) (P : pred T) := { S of is_SUB T P S }. #[verbose] HB.structure Definition SubInhab (T : Type) P := { sT of is_inhab sT & is_SUB T P sT }. HB.structure Definition SubNontrivial T P := { sT of is_nontrivial sT & is_SUB T P sT }. #[key="sT"] HB.factory Record InhabForSub (T : Inhab.type) P (sT : Type) of SubNontrivial T P sT := {}. HB.builders Context (T : Inhab.type) P sT of InhabForSub T P sT. Axiom xxx : P (default : T). HB.instance Definition SubInhabMix := is_inhab.Build sT (Sub (default : T) xxx). HB.end.hierarchy-builder-1.8.1/tests/test_CS_db_filtering.v000066400000000000000000000014311474513043100225310ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record base_m T := { A : T }. HB.structure Definition base := { T of base_m T }. HB.mixin Record child1_m T := { C1 : T }. HB.structure Definition child1 := { T of base T & child1_m T }. HB.mixin Record child2_m T := { C2 : T }. HB.structure Definition child2 := { T of base T & child2_m T }. Axiom ix : Type. Definition vec T := ix -> T. Section b. Variable T : base.type. HB.instance Definition v_base_m : base_m (vec T) := base_m.Build _ (fun _ => A). End b. Section c1. Variable T : child1.type. HB.instance Definition v_child1_m : child1_m (vec T) := child1_m.Build _ (fun _ => C1). End c1. Section c2. Variable T : child2.type. HB.instance Definition v_child2_m : child2_m (vec T) := child2_m.Build _ (fun _ => C2). End c2. hierarchy-builder-1.8.1/tests/test_synthesis_params.v000066400000000000000000000021131474513043100231060ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record IsDualPOrdered (d : unit) T := { le : T -> T -> bool; ge : T -> T -> bool }. HB.structure Definition POrder d := { T of IsDualPOrdered d T }. HB.factory Record IsPOrdered (d : unit) T := { le : T -> T -> bool }. HB.builders Context d T of IsPOrdered d T. HB.instance Definition _ := IsDualPOrdered.Build d T le le. HB.end. HB.mixin Record HasBottom d T of IsDualPOrdered d T := { bottom : T }. HB.structure Definition BPOrder d := { T of HasBottom d T & IsDualPOrdered d T }. HB.mixin Record HasTop d T of IsDualPOrdered d T := { top : T }. HB.structure Definition TPOrder d := { T of HasTop d T & IsDualPOrdered d T }. Definition dual (T : Type) := T. Definition dd (d:unit) : unit. exact d. Qed. HB.instance Definition _ d (T : POrder.type d) := IsDualPOrdered.Build (dd d) (dual T) (fun x y => @le d T y x) (fun x y => @le d T y x). HB.instance Definition _ d (T : TPOrder.type d) := HasBottom.Build (dd d) (dual T) (@top _ T). HB.instance Definition _ d (T : BPOrder.type d) := HasTop.Build (dd d) (dual T) (@bottom _ T). hierarchy-builder-1.8.1/tests/two_hier.v000066400000000000000000000054611474513043100203040ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record m1 T := { default1 : T }. HB.mixin Record m2 T := { default2 : T }. (* since s1 only requires m1 there is a 1:1 correspondence between the structure s1 and the mixin m1 *) HB.structure Definition s1 := { T of m1 T }. HB.structure Definition s2 := { T of m2 T }. HB.instance Definition nat_m1 := m1.Build nat 0. HB.instance Definition nat_m2 := m2.Build nat 1. (* with the following example we want to show that list preserves the s1 structure ie. if x:s1.type then (list x):s1.type, in practice we can use this for the type of polynomials *) HB.instance Definition list_m1 (X : s1.type) : m1 (list X) := m1.Build (list X) (cons default1 nil). (* similarly list preserves s2 structure *) HB.instance Definition list_m2 (X : s2.type) : m2 (list X) := m2.Build (list X) (cons default2 nil). HB.structure Definition s3 := { T of m1 T & m2 T }. (* since we can preserve m1 and m2 with list, we can preserve s3 as well ! *) (* if we have a file A with definitions of S1 and S2, file B importing Awith definitions of instance nat_m1 and nat_m2 file C importing A with the definition of s3 in a file D that imports B and C if we call saturate_instance, we create the instance for s3. this example shows the need for a separate command *) Fail Check nat : s3.type. HB.saturate. Check nat : s3.type. (* since nat satisfies s3.type, so does list nat *) Check list nat : s3.type. Check list (list nat) : s3.type. Fail Check fun t : s1.type => (list t : s3.type). Fail Check fun t : s2.type => (list t : s3.type). Check fun t : s3.type => (list t : s3.type). HB.mixin Record m1' (P : s1.type) T := { f1 : P -> T }. HB.mixin Record m2' (P : s2.type) T := { f2 : P -> T }. (* since s1 only requires m1 there is a 1:1 correspondence between the structure s1 and the mixin m1 *) HB.structure Definition s1' P := { T of m1' P T }. HB.structure Definition s2' P := { T of m2' P T }. HB.instance Definition nat_m1' := m1'.Build nat nat (fun _ => 0). HB.instance Definition nat_m2' := m2'.Build nat nat (fun _ => 1). (* with the following example we want to show that list preserves the s1 structure ie. if x:s1.type then (list x):s1.type, in practice we can use this for the type of polynomials *) HB.instance Definition list_m1' (P : s1.type) (X : s1'.type P) : m1' P (list X) := m1'.Build P (list X) (fun x => cons (f1 x) nil). (* similarly list preserves s2 structure *) HB.instance Definition list_m2' (P : s2.type) (X : s2'.type P) : m2' P (list X) := m2'.Build P (list X) (fun x => cons (f2 x) nil). HB.structure Definition s3' (P : s3.type) := { T of m1' P T & m2' P T }. Fail Check nat : s3'.type _. HB.saturate. Check nat : s3'.type _. (* since nat satisfies s3'.type, so does list nat *) Check list nat : s3'.type _. Check Datatypes_list__canonical__two_hier_s3'. Check list (list nat) : s3'.type _.hierarchy-builder-1.8.1/tests/type_of_exported_ops.v000066400000000000000000000015431474513043100227210ustar00rootroot00000000000000From HB Require Import structures. Definition comb A op := forall x : A, op (op x) = x. HB.mixin Record Foo A := { op : A -> A; ax : comb A op }. HB.structure Definition S := { A of Foo A }. Set Printing All. Lemma test1 : True. Proof. pose proof @ax as H. match goal with | H : forall x : S.type, comb (S.sort x) op |- _ => trivial | H : ?T |- _ => fail "type of ax not as nice as expected:" T end. Qed. HB.mixin Record HasMul T := { mul : T -> T -> T; mulC: forall x y : T, mul x y = mul y x; mulA: forall x y z : T, mul x (mul y z) = mul (mul x y) z; }. HB.structure Definition Mul := { T of HasMul T }. Lemma test2 : True. Proof. pose proof @mulA as H. match goal with | H : forall s : Mul.type, forall x y z : Mul.sort s, mul x (mul y z) = mul (mul x y) z |- _ => trivial | H : ?T |- _ => fail "type of mulA not as nice as expected:" T end. Qed. hierarchy-builder-1.8.1/tests/unimported_irrelevant_class.v000066400000000000000000000006411474513043100242650ustar00rootroot00000000000000From HB Require Import structures. Module A. HB.mixin Record isA T := {}. HB.structure Definition A := {T of isA T}. End A. HB.mixin Record isB T := {}. HB.structure Definition B := {T of isB T}. Module Export C. Import A. HB.mixin Record isC T of A T & B T := {}. HB.structure Definition C := {T of isB T & isA T & isC T}. End C. (* Should not fail: A is irrelevant *) HB.instance Definition _ := isB.Build unit.hierarchy-builder-1.8.1/tests/unimported_relevant_class.v000066400000000000000000000005531474513043100237340ustar00rootroot00000000000000From HB Require Import structures. Module A. HB.mixin Record isA T := {}. HB.structure Definition A := {T of isA T}. End A. Module Export B. Import A. HB.factory Record isB T := {}. HB.builders Context T of isB T. HB.instance Definition _ := isA.Build T. HB.end. End B. (* legitimate failure: A is relevant *) Fail HB.instance Definition _ := isB.Build unit.hierarchy-builder-1.8.1/tests/unit/000077500000000000000000000000001474513043100172465ustar00rootroot00000000000000hierarchy-builder-1.8.1/tests/unit/close_hole_term.v000066400000000000000000000016351474513043100226050ustar00rootroot00000000000000From HB Require Import structures. From elpi Require Import elpi. From Coq Require Export Setoid. Elpi Query HB.instance lp:{{ X = app [{{list}}, Y_], % X needs to be typechecked here to get rid of the hole for the type of Y coq.typecheck X _ ok, abstract-holes.main X Z, std.assert! (Z = {{fun x => list x}}) "term badly closed" }}. Elpi Query HB.instance lp:{{ abstract-holes.main {{nat}} Z, std.assert! (Z = {{nat}}) "term badly closed" }}. Class Inj {A B} (R : relation A) (S : relation B) (f : A -> B) : Prop := inj x y : S (f x) (f y) -> R x y. Elpi Query HB.structure lp:{{ Y = {{Inj}}, %Inj has 5 implicit arguments saturate-type-constructor Y X, % X needs to be typechecked here to get rid of the holes of the types of its arguments coq.typecheck X _ ok, abstract-holes.main X Z, std.assert! (Z = {{ fun a b c d e => @Inj a b c d e }}) "term badly closed" }}.hierarchy-builder-1.8.1/tests/unit/enrich_type.v000066400000000000000000000015521474513043100217510ustar00rootroot00000000000000From HB Require Import structures. From elpi Require Import elpi. From Coq Require Export Setoid. Elpi Query HB.structure lp:{{ saturate-type-constructor {{nat}} X, std.assert! (X = {{nat}}) "wrong enriched type" }}. Elpi Query HB.structure lp:{{ saturate-type-constructor {{list}} X, std.assert! (X = app [{{list}}, Y_]) "wrong enriched type" }}. Elpi Query HB.structure lp:{{ Y = (x \ (y \ {{(prod (list lp:x) (list lp:y))}})), saturate-type-constructor (Y _ _) X, std.assert! (X = (app [{{prod}}, (app[{{list}},X1_]), app[{{list}},C_]])) "wrong enriched type" }}. Class Inj {A B} (R : relation A) (S : relation B) (f : A -> B) : Prop := inj x y : S (f x) (f y) -> R x y. Elpi Query HB.structure lp:{{ saturate-type-constructor {{Inj}} X, std.assert! (X = app [(global (const Inj_)), A_, B_, R_, S_, F_]) "wrong enriched type" }}. hierarchy-builder-1.8.1/tests/unit/mixin_src_has_mixin_instance.v000066400000000000000000000015131474513043100253530ustar00rootroot00000000000000From HB Require Import structures. From elpi Require Import elpi. HB.mixin Record m1 T := { default1 : T }. HB.mixin Record m2 T := { default2 : T }. HB.structure Definition s1 := { T of m1 T }. HB.instance Definition i1 (X : s1.type) : m1 (list X) := m1.Build (list X) (cons default1 nil). HB.instance Definition nat_m1 : m1 nat := m1.Build nat 1. HB.instance Definition nat_m2 : m2 nat := m2.Build nat 1. Elpi Query HB.instance lp:{{ mixin-src->has-mixin-instance (mixin-src {{nat}} M1_ {{nat_m1}}) Y, Y = has-mixin-instance (cs-gref {{:gref nat}}) {{:gref m1.phant_axioms}} {{:gref nat_m1}}. }}. Section Test. Variable X:s1.type. Elpi Query HB.instance lp:{{ mixin-src->has-mixin-instance (mixin-src {{list X}} M1_ {{i1 X}}) Y, Y = has-mixin-instance (cs-gref {{:gref list}}) {{:gref m1.phant_axioms}} {{:gref i1}}. }}. End Test. hierarchy-builder-1.8.1/tests/unit/mk_src_map.v000066400000000000000000000016551474513043100215570ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record is_foo P A := { op : P -> A -> A }. HB.mixin Record is_foo' P A := { op : P -> A -> A }. HB.instance Definition list_foo P := is_foo.Build P (list P) (fun _ x => x). HB.instance Definition list_foo' P A := is_foo.Build P (list A) (fun _ x => x). Check list_foo'. Check list_foo. Elpi Query HB.structure lp:{{ has-mixin-instance->mixin-src (has-mixin-instance (cs-gref{{:gref list}}) {{:gref is_foo.axioms_}} {{:gref list_foo}}) MS, MS = (pi a b \ mixin-src (app [{{list}}, b]) ({{:gref is_foo.axioms_}}) (app [{{list_foo}}, a]) :- [coq.unify-eq a b ok]) }}. Elpi Query HB.structure lp:{{ has-mixin-instance->mixin-src (has-mixin-instance (cs-gref{{:gref list}}) {{:gref is_foo.axioms_}} {{:gref list_foo'}}) MS', MS' = (pi p a b \ mixin-src (app [{{list}}, b]) {{:gref is_foo.axioms_}} (app [{{list_foo'}}, p,a]) :- [coq.unify-eq a b ok]). }}.hierarchy-builder-1.8.1/tests/unit/struct.v000066400000000000000000000023341474513043100207630ustar00rootroot00000000000000From HB Require Import structures. HB.mixin Record m1 T := { default1 : T }. HB.mixin Record m2 T := { default2 : T }. HB.mixin Record is_foo P A := { op : P -> A -> A }. HB.structure Definition foo P := { A of is_foo P A}. HB.structure Definition foo1 := { A of is_foo (option nat) A & m1 A}. Elpi Query HB.structure lp:{{ std.findall (has-mixin-instance _ _ _) H_ }}. (* here we don't have any declared instances but a clause is still created by the system : has-mixin-instance (cs-gref (const «eta»)) (indt «is_foo.axioms_») (const «struct_foo1__to__struct_is_foo») struct_foo1__to__struct_is_foo is an instance created by the system upon structure declaration to allow coercions from foo1 to other structures with the mixin is_foo. *) Print struct_foo1__to__struct_foo. (* its type is forall A : foo1.type, is_foo.axioms_ (option nat) (eta A)) which means it can't serve as a coercion for foo2 or foo3, however foo3 can still be declared because it has another mixin, while foo2 can't because it has the exact same mixins than foo *) Fail HB.structure Definition foo2 := { A of is_foo bool A}. HB.structure Definition foo3 := { A of is_foo bool A & m2 A}. Fail HB.structure Definition fooj := { A of foo1 A & foo3 A}.