Deducteam / lambdapi

Proof assistant based on the λΠ-calculus modulo rewriting
Other
280 stars 35 forks source link

Fail to establish physical links to external symbols #1115

Open NotBad4U opened 6 months ago

NotBad4U commented 6 months ago

Hi !

I am working on a way to split my long proof into multiple files to check them across multiprocess. Each proof is cut into a segment that contains N symbols/steps of the proofs and there is a file that contains all the definitions. I wrote a simple Makefile like this that I want to run make -j N

SRC := $(wildcard *.lp)
OBJ := $(SRC:%.lp=%.lpo)

all: $(OBJ)

%.lpo: %.lp
    lambdapi check -c $<

However, the compilation of .lpofails. Here is my trace:

lambdapi check -c axioms-0-10.lp
Checking "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/axioms-0-10.lp" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Prop.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Set.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Eq.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Nat.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Bool.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/FOL.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Classic.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Alethe.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Pos.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Comp.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Z.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Simplify.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Rare.lpo" ...
Checking "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/definitions.lp" ...
Writing "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/definitions.lpo" ...
Writing "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/axioms-0-10.lpo" ...
lambdapi check -c axioms-10-20.lp
Checking "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/axioms-10-20.lp" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Prop.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Set.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Eq.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Nat.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Bool.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/FOL.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Classic.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Alethe.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Pos.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Comp.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Z.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Simplify.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Rare.lpo" ...
Loading "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/definitions.lpo" ...
[/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/axioms-10-20.lp:17:0-38 ] Uncaught exception: File "src/core/sign.ml", line 95, characters 22-28: Assertion failed.
make: *** [axioms-10-20.lpo] Error 1

It failed because of this assert and looking at the code does not help me to much to understand what could be possible goes wrong. First, Make creates the .lpo for the file axioms-0-10.lp and also compile definitions.lp because it requires it. Second, it try to create the .lpo for axioms-10-20.lp and this time just load definitions.lpo but I got this error. If I delete the definitions.lpo by hand and retry to run make then it work but fail again for the next segment (axioms-20-30.lp):

lambdapi check -c axioms-10-20.lp
Checking "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/axioms-10-20.lp" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Prop.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Set.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Eq.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Nat.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Bool.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/FOL.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Classic.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Alethe.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Pos.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Comp.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Z.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Simplify.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Rare.lpo" ...
Checking "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/definitions.lp" ...
Writing "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/definitions.lpo" ...
Writing "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/axioms-10-20.lpo" ...
lambdapi check -c axioms-20-30.lp
Checking "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/axioms-20-30.lp" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Prop.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Set.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Eq.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Nat.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Bool.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/FOL.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Classic.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Alethe.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Pos.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Comp.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/Stdlib/Z.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Simplify.lpo" ...
Loading "/Users/alessiocoltellacci/.opam/5.0.0/lib/lambdapi/lib_root/lambdapi/Rare.lpo" ...
Loading "/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/definitions.lpo" ...
[/Users/alessiocoltellacci/Projects/Inria/carcara/tlapm_6f89fe/axioms-20-30.lp:17:0-38 ] Uncaught exception: File "src/core/sign.ml", line 95, characters 22-28: Assertion failed.
make: *** [axioms-20-30.lpo] Error 1

any idea what could go wrong ?

fblanqui commented 6 months ago

I suggest that you generate a file with lpo dependencies that you include in your Makefile (see #1108): it will be more optimal and may solve your problem (this is what I do in hol2dk). To generate dependencies, you can use a small script like https://github.com/Deducteam/hol2dk/blob/main/dep-lpo.

fblanqui commented 6 months ago

Example: in your Makefile, add:

include lpo.mk
LP_FILES := $(wildcard *.lp)
lpo.mk: $(LP_FILES:%.lp=%.lpo.mk)
    find . -maxdepth 1 -name '*.lpo.mk' | xargs cat > $@
%.lpo.mk: %.lp
        dep-lpo $*.lp
fblanqui commented 6 months ago

PS. As you generate the lp files, it doesn't cost much to generate the .lpo.mk files as well at the same time, so that you don't need dep-lpo. This is what we do in hol2dk.

NotBad4U commented 6 months ago

Example: in your Makefile, add:

include lpo.mk
LP_FILES := $(wildcard *.lp)
lpo.mk: $(LP_FILES:%.lp=%.lpo.mk)
  find . -maxdepth 1 -name '*.lpo.mk' | xargs cat > $@
%.lpo.mk: %.lp
        dep-lpo $*.lp

This command return me an empty lpo.mk. Could you explain to me what these commands are supposed to do? What should contain the lpo.mk and how I am supposed to use it? I understand that the dep-lpo script collect for a given lp file its list of requires and map into a list of *.lpo.