package rapanui.core;

import rapanui.dsl.Formula;

public class ProofJustification extends Justification {
	private final ConclusionProcess conclusion;
	private final int startTermIndex;
	private final int endTermIndex;

	public ProofJustification(
			Formula justifiedFormula,
			ConclusionProcess conclusion,
			int startTermIndex,
			int endTermIndex) {
		super(justifiedFormula);

		assert conclusion != null;
		assert 0 <= startTermIndex && startTermIndex <= endTermIndex;
		assert endTermIndex < conclusion.getTransformations().length;

		this.conclusion = conclusion;
		this.startTermIndex = startTermIndex;
		this.endTermIndex = endTermIndex;
	}

	public ConclusionProcess getConclusion() {
		return conclusion;
	}

	public int getStartTermIndex() {
		return startTermIndex;
	}

	public int getEndTermIndex() {
		return endTermIndex;
	}
}

@@ -414,78 +414,183 @@
 ;%0A%09%09
-assert 0 %3C= startTermIndex && startTermIndex %3C= endTermIndex;%0A%09%09assert
+// allow inverted ranges (endTermIndex %3C startTermIndex)%0A%09%09assert 0 %3C= startTermIndex && startTermIndex %3C conclusion.getTransformations().length;%0A%09%09assert 0 %3C= endTermIndex &&
  end

allow inverted ranges