19.01.2015 Views

Nominal Inversion Principles

Nominal Inversion Principles

Nominal Inversion Principles

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4 Stefan Berghofer and Christian Urban<br />

8 x s 2 s 1: u 1 = App (Lam x:s 1) s 2 ^ u 2 = s 1[x:=s 2] ) P<br />

8 s 1 s 2 t: u 1 = App s 1 t ^ u 2 = App s 2 t ^ s 1 ! s 2 ) P<br />

8 s 1 s 2 t: u 1 = App t s 1 ^ u 2 = App t s 2 ^ s 1 ! s 2 ) P<br />

8 s 1 s 2 x: u 1 = Lam x:s 1 ^ u 2 = Lam x:s 2 ^ s 1 ! s 2 ) P<br />

u 1 ! u 2 ) P (4)<br />

8 x T: ¡ = ^ u = Var x ^ U = T ^ valid ^ (x; T) 2 ) P<br />

8 t 1 T 1 T 2 t 2: ¡ = ^ u = App t 1 t 2 ^ U = T 2 ^ ` t 1 : T 1 ! T 2 ^ ` t 2 : T 1 ) P<br />

8 x T 1 t T 2: ¡ = ^ u = Lam x:t ^ U = T 1 ! T 2 ^ (x; T 1):: ` t : T 2 ) P<br />

¡ ` u : U ) P (5)<br />

Fig. 1. <strong>Inversion</strong> principles derived by Isabelle/HOL for the inductive predicates beta-reduction<br />

and typing.<br />

If we use inversion principle for ! (i.e. (4)) and invert Var x ! u 0 , we obtain the<br />

following four subgoals:<br />

8 x 0 s 2 s 1 : Var x = App (Lam x 0 :s 1 ) s 2 ^ u 0 = s 1 [x 0 :=s 2 ] ^ : : : ) ` u 0 : T<br />

8 s 1 s 2 t: Var x = App s 1 t ^ u 0 = App s 2 t ^ s 1 ! s 2 ^ : : : ) ` u 0 : T<br />

8 s 1 s 2 t: Var x = App t s 1 ^ u 0 = App t s 2 ^ s 1 ! s 2 ^ : : : ) ` u 0 : T<br />

8 s 1 s 2 x 0 : Var x = Lam x 0 :s 1 ^ u 0 = Lam x 0 :s 2 ^ s 1 ! s 2 ^ : : : ) ` u 0 : T<br />

The left-hand sides of these subgoals all reduce to False because the term constructors<br />

are in conflict (Var can never be equal to App). Therefore we can quickly, like in the<br />

informal reasoning, discharge all subgoals.<br />

In case (ii) where we invert App t 1 t 2 ! u 0 , we obtain the following four subgoals:<br />

8 x s 2 s 1 : App t 1 t 2 = App (Lam x:s 1 ) s 2 ^ u 0 = s 1 [x:=s 2 ] ^ : : : ) ` u 0 : T<br />

8 s 1 s 2 t: App t 1 t 2 = App s 1 t ^ u 0 = App s 2 t ^ s 1 ! s 2 ^ : : : ) ` u 0 : T<br />

8 s 1 s 2 t: App t 1 t 2 = App t s 1 ^ u 0 = App t s 2 ^ s 1 ! s 2 ^ : : : ) ` u 0 : T<br />

8 s 1 s 2 x: App t 1 t 2 = Lam x:s 1 ^ u 0 = Lam x:s 2 ^ s 1 ! s 2 ^ : : : ) ` u 0 : T<br />

The fourth subgoal can again be discharged because of the conflicting equality between<br />

App and Lam. The reasoning in the second and third is very similar with the informal<br />

inversion by matching, because the App-term constructor is injective and therefore we<br />

can infer<br />

App t 1 t 2 = App s 1 t ) t 1 = s 1 ^ t 2 = t; and<br />

App t 1 t 2 = App t s 1 ) t 1 = t ^ t 2 = s 1<br />

(6)<br />

which are the same equations we would have got by the informal inversion by matching.<br />

The first subgoal (corresponding to b 1 ) is more complicated: although we obtain by<br />

injectivity of App the equations t 1 = Lam x:s 1 and t 2 = s 2 , we will encounter problems<br />

with inverting the typing judgement ` Lam x:s 1 : T 1 ! T 2 . That is, we will not be<br />

able to infer that (x; T 1 ):: ` s 1 : T 2 holds. This is because Lam is not injective and<br />

we cannot reason as in (6).<br />

We encounter the same problem with the reasoning in case (iii). There we have to<br />

invert the reduction Lam x:t ! u 0 and obtain by using the first inversion principle<br />

from (4) the following four subgoals:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!