APP := ../../bin/mre

demo1 :
	@echo "**";
	@echo "** The tool automatically proves properties of a gives specification";
	@echo "** and prints witnesses for existential proofs. Lets try a simple";
	@echo "** example. A setoid for boolean values can be defined by a term 'dBool'.";
	@echo "**";
	$(APP) -term "dBool"

demo2 :
	@echo "**";
	@echo "** We can find all constructions in specification language with";
	@echo "** '-syntax' argument.";
	@echo "**";
	$(APP) -syntax
	

demo3 :
	@echo "**";
	@echo "** For graph algorithms the most interesting algebraic structures are";
	@echo "** bisemigroups with unit elements for both operations. To find shortest";
	@echo "** paths we can use 'bAddZero bNatMinPlus'.";
	@echo "**";
	$(APP) -term "bAddZero bNatMinPlus"

demo4 :
	@echo "**";
	@echo "** We can use algebras that we constructed to find routing solutions.";
	@echo "** Specify the algebra and the graph labeled with elements of this";
	@echo "** algebra in a text file and use the '-g' argument.";
	@echo "** In this example the graph is:";
	@echo "**        0  ----(1)----- 1   ";	
	@echo "**        |            _/ |   ";
	@echo "**        |          _/   |   ";
	@echo "**        |        _/     |   ";
	@echo "**       (3)     (1)     (3)  ";
	@echo "**        |    _/         |   ";
	@echo "**        |  _/           |   ";
	@echo "**        | /             |   ";
	@echo "**        2  ----(1)----- 3   ";	
	@echo "**";
	$(APP) -g "demo4.txt"

demo5 :
	@echo "**";
	@echo "** If bisemigroup is not distributive, we shortest path algorithms may";
	@echo "** not return the best paths. For example the matrix multiplication";
	@echo "** algorithm may give you best paths that are consistent with";
	@echo "** neightbours. The following directed graph shows the problem when";
	@echo "** we want to find best paths ordered by lexicographic product of bandwidth ";
	@echo "** and length.";
	@echo "**";
	@echo "**         +-> 1 --+           ";
	@echo "**        /         \          ";
	@echo "**     (5,10)       (5,10)     ";
	@echo "**      /              \       ";
	@echo "**     /                v      ";
	@echo "**    0------(10,1)---->2-----(5,1)--->3         ";
	@echo "**";
	@echo "** The best path from 0 to 3 is 0-1-2-3 with metric (5,12). But it is not";
	@echo "** consistant with the best path from 0 to 2, which is 0-2 with metric (10,1).";
	@echo "** Hence the computed path from 0 to 3 is 0-2-3 with metric (5,2)."
	@echo "**";
	$(APP) -g "demo5.txt"
	
demo6 :
	@echo "**";
	@echo "** In this demo we show how you can construct an algebra that calculates all";
	@echo "** minimal cutsets the graph between every pair of nodes.";
	@echo "**";
	@echo "**     0 ---[[(0,1)]]---> 1  ";
	@echo "**     |                  |  ";
	@echo "**     |                  |  ";
	@echo "**  [[(0,3)]]         [[(1,2)]] ";
	@echo "**     |                  |  ";
	@echo "**     v                  v  ";
	@echo "**     3 ---[[(3,2)]]---> 2  ";
	@echo "**";
	$(APP) -g "demo6.txt"
	
demo7 :
	@echo "**";
	@echo "** The same as 'demo6', but without additional 0 element";
	@echo "**";
	$(APP) -g "demo7.txt"

demo8 :
	@echo "**";
	@echo "** Scoped product example.";
	@echo "**";
	@echo "** S = stCayley bNatMinPlus";
	@echo "** T = stCayley bNatMinPlus";
	@echo "**";
	@echo "** (S scoped T) = stUnion (stSelLex S (stLeft (ST_SG T)))";
	@echo "**                        (stSelLex (stRight (ST_SG S)) T)";
	@echo "**";
	$(APP) -term "stUnion (stSelLex (stCayley bNatMinPlus) (stLeft (ST_SG (stCayley bNatMinPlus)))) (stSelLex (stRight (ST_SG (stCayley bNatMinPlus))) (stCayley bNatMinPlus))"
	
paper1 :
	$(APP) -term "bAddOne (bAddZero (bSelLex bNatMinPlus bNatMaxMin))"

paper2 :
	$(APP) -term "bAddOne (bAddZero (bSelLex bNatMaxMin bNatMinPlus))"

paper3 :
	$(APP) -term "bAddZero (bLex bNatMinPlus (bFSetsOp (sSeq dNat)))"

paper4 :
	$(APP) -term "bFMinSets(oBsLeftNaturalOrder(bProduct (bAddZero bNatMinPlus) (bAddOne bNatMaxMin)))"

paper5 :
	$(APP) -term "bFMinSetsOpUnion (oRightNaturalOrder sNatMax)"

paper6 :
	$(APP) -term "let S = stCayley bNatMinPlus in let T = stCayley bNatMinPlus in stUnion (stSelLex S (stLeft (ST_SG T))) (stSelLex (stRight (ST_SG S)) T)"
	
paper4g :
	$(APP) -g paper4.txt

paper5g :
	$(APP) -g paper5.txt

paper6g :
	$(APP) -g paper6g.txt

paper1a :
	$(APP) -term "bSelLex (bAddZero bNatMinPlus) (bAddOne bNatMaxMin)"

paper7 :
	$(APP) -term "bAddZero (bSelLex bBoolOrAnd bNatMinPlus)"
	
paper8 :
	$(APP) -term "sFSetsOp (sProduct sNatMin sNatMin)"
	
paper9 :
	$(APP) -term "sFMinSetsOp (oRightNaturalOrder (sProduct sNatMin sNatMin))"
	
paper10 :
	$(APP) -term "bFMinSets(oRightNaturalOrder(sFMinSetsUnion(pRightNaturalOrder(sProduct sNatMin sNatMin))))"
	
paper10g :
	$(APP) -g paper10g.txt
	
dijkstra1 :
	$(APP) -term "bRevTimes (bAddOne (bAddZero (bSelLex bNatMaxMin (bSelLex bNatMinPlus (bLeft sNatMin)))))"

dijkstra1g :
	$(APP) -g dijkstra1g.txt

dijkstra2 :
	$(APP) -term "(bFSetsOp(BS_SG_times(bAddOne (bSelLex bNatMaxMin (bSelLex bNatMinPlus (bLeft sNatMin))))))"

dijkstra2g :
	$(APP) -g dijkstra2g.txt
	
dijkstra3 :
	$(APP) -term "bFMinSets (oSimpleSeq dNat)"

dijkstra3g :
	$(APP) -g dijkstra3g.txt
	
dijkstra4 :
	$(APP) -term "oLex (oSimpleSeq dNat) (oBsLeftNaturalOrder (bFSetsOp(BS_SG_times(bAddOne (bSelLex bNatMaxMin (bSelLex bNatMinPlus (bLeft sNatMin)))))))"
	
simple-paths :
	$(APP) -term "bAddZero (bFMinSets (oBsLeftNaturalOrder (bLex (bMultiSets dNat) (bFSetsOp (sProduct sNatMin sNatMax)))))"
	
simple-paths-1 :
	$(APP) -term "bFMinSets (oBsLeftNaturalOrder (bLex (bMultiSets dNat) (bFSetsOp (sProduct sNatMin sNatMax))))"

simple-paths-2 :
	$(APP) -term "oBsLeftNaturalOrder (bLex (bMultiSets dNat) (bFSetsOp (sProduct sNatMin sNatMax)))"

simple-paths-3 :
	$(APP) -term "bLex ((bMultiSets dNat)) (bFSetsOp (sProduct sNatMin sNatMax))"

simple-paths-4 :
	$(APP) -term "bAddZero (bMultiSets dNat)"

simple-paths-5 :
	$(APP) -term "bFSetsOp (sProduct sNatMin sNatMax)"

